Additional Reference fixes

svn: r2888
This commit is contained in:
Don Allingham 2004-02-22 04:57:06 +00:00
parent 9ae8955fc0
commit 72659f98ac
11 changed files with 104 additions and 94 deletions

View File

@ -67,26 +67,27 @@ class Bookmarks :
"""Create the pulldown menu""" """Create the pulldown menu"""
if len(self.bookmarks) > 0: if len(self.bookmarks) > 0:
self.myMenu = gtk.Menu() self.myMenu = gtk.Menu()
for person in self.bookmarks: for person_id in self.bookmarks:
self.add_to_menu(person) self.add_to_menu(person_id)
self.menu.set_submenu(self.myMenu) self.menu.set_submenu(self.myMenu)
self.menu.set_sensitive(1) self.menu.set_sensitive(1)
else: else:
self.menu.remove_submenu() self.menu.remove_submenu()
self.menu.set_sensitive(0) self.menu.set_sensitive(0)
def add(self,person): def add(self,person_id):
"""appends the person to the bottom of the bookmarks""" """appends the person to the bottom of the bookmarks"""
if person not in self.bookmarks: if person_id not in self.bookmarks:
Utils.modified() Utils.modified()
self.bookmarks.append(person) self.bookmarks.append(person_id)
self.redraw() self.redraw()
def add_to_menu(self,person_id): def add_to_menu(self,person_id):
"""adds a person's name to the drop down menu""" """adds a person's name to the drop down menu"""
person = self.db.find_person_from_id(person_id) data = self.db.person_map.get(str(person_id))
item = gtk.MenuItem(person.get_primary_name().get_name()) name = data[2].get_name()
item.connect("activate", self.callback, person) item = gtk.MenuItem(name)
item.connect("activate", self.callback, person_id)
item.show() item.show()
self.myMenu.append(item) self.myMenu.append(item)
@ -143,8 +144,10 @@ class Bookmarks :
self.draw_window() self.draw_window()
index = 0 index = 0
for person in self.bookmarks: for person in self.bookmarks:
self.namelist.append([person.get_primary_name().get_name()]) data = self.db.person_map.get(str(person_id))
self.namelist.set_row_data(index,person) name = data[2].get_name()
self.namelist.append([name])
self.namelist.set_row_data(index,person_id)
index = index + 1 index = index + 1
self.response = self.top.run() self.response = self.top.run()
@ -176,9 +179,9 @@ class Bookmarks :
"""Saves the current bookmarks from the list""" """Saves the current bookmarks from the list"""
del self.bookmarks[0:] del self.bookmarks[0:]
for index in range(0,self.namelist.rows): for index in range(0,self.namelist.rows):
person = self.namelist.get_row_data(index) person_id = self.namelist.get_row_data(index)
if person: if person_id:
self.bookmarks.append(person) self.bookmarks.append(person_id)
self.redraw() self.redraw()
def help_clicked(self): def help_clicked(self):

View File

@ -355,7 +355,7 @@ class EditPerson:
"on_add_aka_clicked" : self.on_add_aka_clicked, "on_add_aka_clicked" : self.on_add_aka_clicked,
"on_add_attr_clicked" : self.on_add_attr_clicked, "on_add_attr_clicked" : self.on_add_attr_clicked,
"on_add_url_clicked" : self.on_add_url_clicked, "on_add_url_clicked" : self.on_add_url_clicked,
"on_addphoto_clicked" : self.gallery.on_add_photo_clicked, "on_addphoto_clicked" : self.gallery.on_add_media_object_clicked,
"on_selectphoto_clicked" : self.gallery.on_select_photo_clicked, "on_selectphoto_clicked" : self.gallery.on_select_photo_clicked,
"on_aka_delete_clicked" : self.on_aka_delete_clicked, "on_aka_delete_clicked" : self.on_aka_delete_clicked,
"on_aka_update_clicked" : self.on_aka_update_clicked, "on_aka_update_clicked" : self.on_aka_update_clicked,

View File

@ -168,7 +168,7 @@ class EditPlace:
self.top_window.signal_autoconnect({ self.top_window.signal_autoconnect({
"on_switch_page" : self.on_switch_page, "on_switch_page" : self.on_switch_page,
"on_addphoto_clicked" : self.glry.on_add_photo_clicked, "on_addphoto_clicked" : self.glry.on_add_media_object_clicked,
"on_selectphoto_clicked" : self.glry.on_select_photo_clicked, "on_selectphoto_clicked" : self.glry.on_select_photo_clicked,
"on_deletephoto_clicked" : self.glry.on_delete_photo_clicked, "on_deletephoto_clicked" : self.glry.on_delete_photo_clicked,
"on_edit_photo_clicked" : self.glry.on_edit_photo_clicked, "on_edit_photo_clicked" : self.glry.on_edit_photo_clicked,

View File

@ -189,15 +189,12 @@ class EditSource:
for key in self.db.get_person_keys(): for key in self.db.get_person_keys():
p = self.db.get_person(key) p = self.db.get_person(key)
name = GrampsCfg.nameof(p) name = GrampsCfg.nameof(p)
birth_event = self.db.find_event_from_id(p.get_birth_id()) for event_id in p.get_event_list() + [p.get_birth_id(), p.get_death_id()]:
death_event = self.db.find_event_from_id(p.get_death_id()) if event_id:
for v_id in p.get_event_list() + [p.get_birth_id(), p.get_death_id()]: event = self.db.find_event_from_id(event_id)
v = self.db.find_event_from_id(v_id) for sref in event.get_source_references():
if not v: if sref.get_base_id() == self.source.get_id():
continue p_event_list.append((name,event.get_name()))
for sref in v.get_source_references():
if sref.get_base_id() == self.source.get_id():
p_event_list.append((name,v.get_name()))
for v in p.get_attribute_list(): for v in p.get_attribute_list():
for sref in v.get_source_references(): for sref in v.get_source_references():
if sref.get_base_id() == self.source.get_id(): if sref.get_base_id() == self.source.get_id():
@ -210,14 +207,16 @@ class EditSource:
for sref in v.get_source_references(): for sref in v.get_source_references():
if sref.get_base_id() == self.source.get_id(): if sref.get_base_id() == self.source.get_id():
p_addr_list.append((name,v.get_street())) p_addr_list.append((name,v.get_street()))
for p in self.db.get_object_map().values(): for object_id in self.db.get_object_keys():
name = p.get_description() object = self.db.find_object_from_id(object_id)
for sref in p.get_source_references(): name = object.get_description()
for sref in object.get_source_references():
if sref.get_base_id() == self.source.get_id(): if sref.get_base_id() == self.source.get_id():
m_list.append(name) m_list.append(name)
for p in self.db.get_family_id_map().values(): for family_id in self.db.get_family_keys():
f_id = p.get_father_id() family = self.db.find_family_from_id(family_id)
m_id = p.get_mother_id() f_id = family.get_father_id()
m_id = family.get_mother_id()
f = self.db.find_person_from_id(f_id) f = self.db.find_person_from_id(f_id)
m = self.db.find_person_from_id(m_id) m = self.db.find_person_from_id(m_id)
if f and m: if f and m:

View File

@ -473,13 +473,13 @@ class GrampsParser:
if attrs.has_key('priv'): if attrs.has_key('priv'):
self.objref.set_privacy(int(attrs['priv'])) self.objref.set_privacy(int(attrs['priv']))
if self.family: if self.family:
self.family.add_media_object(self.objref) self.family.add_media_reference(self.objref)
elif self.source: elif self.source:
self.source.add_media_object(self.objref) self.source.add_media_reference(self.objref)
elif self.person: elif self.person:
self.person.add_media_object(self.objref) self.person.add_media_reference(self.objref)
elif self.placeobj: elif self.placeobj:
self.placeobj.add_media_object(self.objref) self.placeobj.add_media_reference(self.objref)
def start_object(self,attrs): def start_object(self,attrs):
self.object = self.db.find_object_from_id(attrs['id']) self.object = self.db.find_object_from_id(attrs['id'])
@ -530,13 +530,13 @@ class GrampsParser:
self.photo.set_mime_type(Utils.get_mime_type(self.photo.get_path())) self.photo.set_mime_type(Utils.get_mime_type(self.photo.get_path()))
self.db.add_object(self.photo) self.db.add_object(self.photo)
if self.family: if self.family:
self.family.add_media_object(self.pref) self.family.add_media_reference(self.pref)
elif self.source: elif self.source:
self.source.add_media_object(self.pref) self.source.add_media_reference(self.pref)
elif self.person: elif self.person:
self.person.add_media_object(self.pref) self.person.add_media_reference(self.pref)
elif self.placeobj: elif self.placeobj:
self.placeobj.add_media_object(self.pref) self.placeobj.add_media_reference(self.pref)
def start_daterange(self,attrs): def start_daterange(self,attrs):
if self.source_ref: if self.source_ref:
@ -1037,13 +1037,13 @@ class GrampsImportParser(GrampsParser):
if attrs.has_key('priv'): if attrs.has_key('priv'):
self.objref.set_privacy(int(attrs['priv'])) self.objref.set_privacy(int(attrs['priv']))
if self.family: if self.family:
self.family.add_media_object(self.objref) self.family.add_media_reference(self.objref)
elif self.source: elif self.source:
self.source.add_media_object(self.objref) self.source.add_media_reference(self.objref)
elif self.person: elif self.person:
self.person.add_media_object(self.objref) self.person.add_media_reference(self.objref)
elif self.placeobj: elif self.placeobj:
self.placeobj.add_media_object(self.objref) self.placeobj.add_media_reference(self.objref)
def start_object(self,attrs): def start_object(self,attrs):
self.object = self.db.find_object_no_conflicts(attrs['id'],self.MediaFileMap) self.object = self.db.find_object_no_conflicts(attrs['id'],self.MediaFileMap)

View File

@ -178,7 +178,7 @@ class ImageSelect:
if (already_imported): if (already_imported):
oref = RelLib.MediaRef() oref = RelLib.MediaRef()
oref.set_reference(already_imported) oref.set_reference(already_imported)
self.dataobj.add_media_object(oref) self.dataobj.add_media_reference(oref)
self.add_thumbnail(oref) self.add_thumbnail(oref)
else: else:
type = Utils.get_mime_type(filename) type = Utils.get_mime_type(filename)
@ -369,7 +369,7 @@ class Gallery(ImageSelect):
self.db.add_object(photo) self.db.add_object(photo)
oref = RelLib.MediaRef() oref = RelLib.MediaRef()
oref.set_reference(photo) oref.set_reference(photo)
self.dataobj.add_media_object(oref) self.dataobj.add_media_reference(oref)
def add_thumbnail(self, photo): def add_thumbnail(self, photo):
"""Scale the image and add it to the IconList.""" """Scale the image and add it to the IconList."""
@ -510,7 +510,7 @@ class Gallery(ImageSelect):
self.db.add_object(photo) self.db.add_object(photo)
oref = RelLib.MediaRef() oref = RelLib.MediaRef()
oref.set_reference(photo) oref.set_reference(photo)
self.dataobj.add_media_object(oref) self.dataobj.add_media_reference(oref)
try: try:
id = photo.get_id() id = photo.get_id()
name = RelImage.import_media_object(tfile,self.path,id) name = RelImage.import_media_object(tfile,self.path,id)
@ -549,7 +549,7 @@ class Gallery(ImageSelect):
index = index + 1 index = index + 1
oref = RelLib.MediaRef() oref = RelLib.MediaRef()
oref.set_reference(self.db.find_object_from_id(data.data)) oref.set_reference(self.db.find_object_from_id(data.data))
self.dataobj.add_media_object(oref) self.dataobj.add_media_reference(oref)
self.add_thumbnail(oref) self.add_thumbnail(oref)
self.parent.lists_changed = 1 self.parent.lists_changed = 1
if GrampsCfg.globalprop: if GrampsCfg.globalprop:
@ -578,7 +578,7 @@ class Gallery(ImageSelect):
return return
oref = RelLib.MediaRef() oref = RelLib.MediaRef()
oref.set_reference(object) oref.set_reference(object)
self.dataobj.add_media_object(oref) self.dataobj.add_media_reference(oref)
self.add_thumbnail(oref) self.add_thumbnail(oref)
self.parent.lists_changed = 1 self.parent.lists_changed = 1

View File

@ -335,7 +335,7 @@ class MergePeople:
self.merge_families() self.merge_families()
for photo in self.p2.get_media_list(): for photo in self.p2.get_media_list():
self.p1.add_media_object(photo) self.p1.add_media_reference(photo)
if self.p1.get_nick_name() == "": if self.p1.get_nick_name() == "":
self.p1.set_nick_name(self.p2.get_nick_name()) self.p1.set_nick_name(self.p2.get_nick_name())
@ -860,7 +860,7 @@ class MergePlaces:
# Copy photos from P2 to P1 # Copy photos from P2 to P1
for photo in self.p2.get_media_list(): for photo in self.p2.get_media_list():
self.p1.add_media_object(photo) self.p1.add_media_reference(photo)
# Copy sources from P2 to P1 # Copy sources from P2 to P1
for source in self.p2.get_source_references(): for source in self.p2.get_source_references():

View File

@ -278,7 +278,7 @@ class Place(SourceNote):
SourceNote.__init__(self,source) SourceNote.__init__(self,source)
if source: if source:
self.long = source.log self.long = source.long
self.lat = source.lat self.lat = source.lat
self.title = source.title self.title = source.title
self.main_loc = Location(source.main_loc) self.main_loc = Location(source.main_loc)
@ -290,8 +290,8 @@ class Place(SourceNote):
for u in source.urls: for u in source.urls:
self.urls.append(Url(u)) self.urls.append(Url(u))
self.media_list = [] self.media_list = []
for photo in source.media_list: for media_id in source.media_list:
self.media_list.append(MediaRef(photo)) self.media_list.append(MediaRef(media_id))
else: else:
self.long = "" self.long = ""
self.lat = "" self.lat = ""
@ -377,9 +377,9 @@ class Place(SourceNote):
if loc not in self.alt_loc: if loc not in self.alt_loc:
self.alt_loc.append(loc) self.alt_loc.append(loc)
def add_media_object(self,photo): def add_media_reference(self,media_id):
"""Adds a Photo object to the place object's image list""" """Adds a Photo object to the place object's image list"""
self.media_list.append(photo) self.media_list.append(media_id)
def get_media_list(self): def get_media_list(self):
"""Returns the list of Photo objects""" """Returns the list of Photo objects"""
@ -1296,9 +1296,9 @@ class Person(SourceNote):
# else: # else:
# return e # return e
def add_media_object(self,photo): def add_media_reference(self,media_id):
"""adds a MediaObject instance to the image list""" """adds a MediaObject instance to the image list"""
self.media_list.append(photo) self.media_list.append(media_id)
def get_media_list(self): def get_media_list(self):
"""returns the list of MediaObjects""" """returns the list of MediaObjects"""
@ -1970,9 +1970,9 @@ class Family(SourceNote):
"""sets the event list to the passed list""" """sets the event list to the passed list"""
self.event_list = list self.event_list = list
def add_media_object(self,photo): def add_media_reference(self,media_id):
"""Adds a MediaObject object to the Family instance's image list""" """Adds a MediaObject object to the Family instance's image list"""
self.media_list.append(photo) self.media_list.append(media_id)
def get_media_list(self): def get_media_list(self):
"""Returns the list of MediaObject objects""" """Returns the list of MediaObject objects"""
@ -2018,9 +2018,10 @@ class Source:
"""returns the gramps' ID of the Source instance""" """returns the gramps' ID of the Source instance"""
return self.id return self.id
def add_media_object(self,photo): #EARNEY, this should eventually be a list of ids not objects, right?
def add_media_reference(self,media_id):
"""Adds a MediaObject object to the Source instance's image list""" """Adds a MediaObject object to the Source instance's image list"""
self.media_list.append(photo) self.media_list.append(media_id)
def get_media_list(self): def get_media_list(self):
"""Returns the list of MediaObject objects""" """Returns the list of MediaObject objects"""
@ -2306,6 +2307,9 @@ class GrampsDB:
def get_person_keys(self): def get_person_keys(self):
return self.person_map.keys() return self.person_map.keys()
def get_family_keys(self):
return self.family_map.keys()
def sort_by_name(self,f,s): def sort_by_name(self,f,s):
n1 = self.person_map.get(str(f))[2].sname n1 = self.person_map.get(str(f))[2].sname
n2 = self.person_map.get(str(s))[2].sname n2 = self.person_map.get(str(s))[2].sname
@ -2441,9 +2445,13 @@ class GrampsDB:
self.place2title = {} self.place2title = {}
self.genderStats = GenderStats () self.genderStats = GenderStats ()
#EARNEY, may eventually be able to use secondary indexes for this
#that way we will not have to track these with code.
def get_surnames(self): def get_surnames(self):
return self.surnames return self.surnames
#this function may eventually become obsolete.. if we use
#secondary indexes.
def add_surname(self,name): def add_surname(self,name):
if name and name not in self.surnames: if name and name not in self.surnames:
self.surnames.append(name) self.surnames.append(name)
@ -2456,8 +2464,8 @@ class GrampsDB:
def clean_bookmarks(self): def clean_bookmarks(self):
"""cleans up the bookmark list, removing empty slots""" """cleans up the bookmark list, removing empty slots"""
new_bookmarks = [] new_bookmarks = []
for person in self.bookmarks: for person_id in self.bookmarks:
new_bookmarks.append(person) new_bookmarks.append(person_id)
self.bookmarks = new_bookmarks self.bookmarks = new_bookmarks
def set_researcher(self,owner): def set_researcher(self,owner):
@ -2489,7 +2497,7 @@ class GrampsDB:
return person return person
def get_person(self,id): def get_person(self,id):
"""returns a map of gramps's IDs to Person instances""" """returns a Person from a GRAMPS's ID"""
p = Person() p = Person()
data = self.person_map.get(str(id)) data = self.person_map.get(str(id))
p.unserialize(data) p.unserialize(data)
@ -2556,7 +2564,7 @@ class GrampsDB:
def get_place_ids(self): def get_place_ids(self):
"""returns a list of Place instances""" """returns a list of Place instances"""
return self.place_map.values() return self.place_map.keys()
def get_family_relation_types(self): def get_family_relation_types(self):
"""returns a list of all relationship types assocated with Family """returns a list of all relationship types assocated with Family
@ -2568,13 +2576,13 @@ class GrampsDB:
def remove_person_id(self,id): def remove_person_id(self,id):
# self.genderStats.uncount_person (self.person_map[id]) # self.genderStats.uncount_person (self.person_map[id])
del self.person_map[str(id)] self.person_map.delete(str(id))
def remove_source_id(self,id): def remove_source_id(self,id):
del self.source_map[str(id)] self.source_map.delete(str(id))
def remove_event_id(self,id): def remove_event_id(self,id):
del self.event_map[str(id)] self.event_map.delete(str(id))
def add_person_as(self,person): def add_person_as(self,person):
assert(person.get_id()) assert(person.get_id())
@ -2614,8 +2622,8 @@ class GrampsDB:
self.genderStats.count_person (person, self) self.genderStats.count_person (person, self)
return person return person
def has_person_id(self,val): def has_person_id(self,val): #what does this function do?
return self.person_map.get(str(val)) return self.person_map.get(str(val)) #EARNEY
def find_person_from_id(self,val): def find_person_from_id(self,val):
"""finds a Person in the database from the passed gramps' ID. """finds a Person in the database from the passed gramps' ID.
@ -2661,7 +2669,6 @@ class GrampsDB:
def add_event(self,event): def add_event(self,event):
"""adds a Event instance to the database, assigning it a gramps' """adds a Event instance to the database, assigning it a gramps'
ID number""" ID number"""
return Event()
index = self.eprefix % self.emap_index index = self.eprefix % self.emap_index
while self.event_map.get(str(index)): while self.event_map.get(str(index)):
self.emap_index += 1 self.emap_index += 1
@ -2835,10 +2842,10 @@ class GrampsDB:
return index return index
def remove_object(self,id): def remove_object(self,id):
del self.media_map[str(id)] self.media_map.delete(str(id))
def remove_place(self,id): def remove_place(self,id):
del self.place_map[str(id)] self.place_map.delete(str(id))
def add_place_as(self,place): def add_place_as(self,place):
self.place_map.put(str(place.get_id()),place.serialize()) self.place_map.put(str(place.get_id()),place.serialize())
@ -2876,15 +2883,15 @@ class GrampsDB:
self.lmap_index = self.lmap_index + 1 self.lmap_index = self.lmap_index + 1
return index return index
def find_place_from_id(self,val): def find_place_from_id(self,id):
"""finds a Place in the database from the passed gramps' ID. """finds a Place in the database from the passed gramps' ID.
If no such Place exists, a new Place is added to the database.""" If no such Place exists, a new Place is added to the database."""
data = self.place_map.get(str(val)) data = self.place_map.get(str(id))
place = Place() place = Place()
if not data: if not data:
place.id = val place.id = id
self.place_map.put(str(val),place.serialize()) self.place_map.put(str(id),place.serialize())
self.lmap_index = self.lmap_index + 1 self.lmap_index = self.lmap_index + 1
else: else:
place.unserialize(data) place.unserialize(data)
@ -2906,7 +2913,7 @@ class GrampsDB:
def get_place_id(self,key): def get_place_id(self,key):
place = Place() place = Place()
place.serialize(self.place_map.get(str(key))) place.unserialize(self.place_map.get(str(key)))
return place return place
def get_place_display(self,key): def get_place_display(self,key):
@ -2938,7 +2945,9 @@ class GrampsDB:
return source.get_display_info() return source.get_display_info()
def get_source(self,key): def get_source(self,key):
return self.source_map[key] source = Source()
source.unserialize(self.source_map[key])
return source
def build_source_display(self,nkey,okey=None): def build_source_display(self,nkey,okey=None):
pass pass
@ -3012,7 +3021,7 @@ class GrampsDB:
def delete_family(self,family_id): def delete_family(self,family_id):
"""deletes the Family instance from the database""" """deletes the Family instance from the database"""
if self.family_map.get(str(family_id)): if self.family_map.get(str(family_id)):
del self.family_map[str(family_id)] self.family_map.delete(str(family_id))
def find_person_no_conflicts(self,idVal,map): def find_person_no_conflicts(self,idVal,map):
"""finds a Person in the database using the idVal and map """finds a Person in the database using the idVal and map

View File

@ -188,14 +188,12 @@ class XmlWriter:
date = string.split(time.ctime(time.time())) date = string.split(time.ctime(time.time()))
owner = self.db.get_researcher() owner = self.db.get_researcher()
familyMap = self.db.get_family_id_map() familyList = self.db.get_family_keys()
familyList = familyMap.keys ()
person_len = self.db.get_number_of_people() person_len = self.db.get_number_of_people()
family_len = len(familyMap) family_len = len(familyList)
source_len = len(self.db.get_source_keys()) source_len = len(self.db.get_source_keys())
place_len = len(self.db.get_place_id_keys()) place_len = len(self.db.get_place_id_keys())
objMap = self.db.get_object_map() objList = self.db.get_object_keys()
objList = objMap.keys ()
total = person_len + family_len + place_len + source_len total = person_len + family_len + place_len + source_len
@ -315,8 +313,8 @@ class XmlWriter:
self.g.write(" <families>\n") self.g.write(" <families>\n")
familyList.sort () familyList.sort ()
for key in familyList: for key in self.db.get_family_keys():
family = familyMap[key] family = self.db.find_family_from_id(key)
if self.callback and count % delta == 0: if self.callback and count % delta == 0:
self.callback(float(count)/float(total)) self.callback(float(count)/float(total))
count = count + 1 count = count + 1
@ -380,15 +378,15 @@ class XmlWriter:
if len(objList) > 0: if len(objList) > 0:
self.g.write(" <objects>\n") self.g.write(" <objects>\n")
objList.sort () objList.sort ()
for key in objList: for key in self.db.get_object_keys():
object = objMap[key] object = self.db.find_object_from_id(key)
self.write_object(object) self.write_object(object)
self.g.write(" </objects>\n") self.g.write(" </objects>\n")
if len(self.db.get_bookmarks()) > 0: if len(self.db.get_bookmarks()) > 0:
self.g.write(" <bookmarks>\n") self.g.write(" <bookmarks>\n")
for person in self.db.get_bookmarks(): for person_id in self.db.get_bookmarks():
self.g.write(' <bookmark ref="%s"/>\n' % person.get_id()) self.g.write(' <bookmark ref="%s"/>\n' % person_id)
self.g.write(" </bookmarks>\n") self.g.write(" </bookmarks>\n")
self.g.write("</database>\n") self.g.write("</database>\n")

View File

@ -1258,7 +1258,7 @@ class Gramps:
def load_selected_people(self,obj): def load_selected_people(self,obj):
"""Display the selected people in the EditPerson display""" """Display the selected people in the EditPerson display"""
mlist = self.people_view.person_tree.get_selected_objects() mlist = self.people_view.person_tree.get_selected_objects()
if mlist and self.active_person == self.db.get_person(mlist[0]): if mlist and self.active_person.get_id() == mlist[0]:
self.load_person(self.active_person) self.load_person(self.active_person)
def load_active_person(self,obj): def load_active_person(self,obj):
@ -1799,8 +1799,9 @@ class Gramps:
def on_edit_bookmarks_activate(self,obj): def on_edit_bookmarks_activate(self,obj):
self.bookmarks.edit() self.bookmarks.edit()
def bookmark_callback(self,obj,person): def bookmark_callback(self,obj,person_id):
old_person = self.active_person old_person = self.active_person
person = self.db.find_person_from_id(person_id)
try: try:
self.change_active_person(person) self.change_active_person(person)
self.update_display(0) self.update_display(0)

View File

@ -972,7 +972,7 @@ class GedcomParser:
self.db.add_object(photo) self.db.add_object(photo)
oref = RelLib.MediaRef() oref = RelLib.MediaRef()
oref.set_reference(photo) oref.set_reference(photo)
self.person.add_media_object(oref) self.person.add_media_reference(oref)
def parse_family_object(self,level): def parse_family_object(self,level):
form = "" form = ""
@ -1010,7 +1010,7 @@ class GedcomParser:
self.db.add_object(photo) self.db.add_object(photo)
oref = RelLib.MediaRef() oref = RelLib.MediaRef()
oref.set_reference(photo) oref.set_reference(photo)
self.family.add_media_object(photo) self.family.add_media_reference(photo)
self.db.commit_family(self.family) self.db.commit_family(self.family)
def parse_residence(self,address,level): def parse_residence(self,address,level):