* src/FamilyView.py: make load_family more robust to signals

svn: r4363
This commit is contained in:
Don Allingham 2005-04-14 20:43:14 +00:00
parent aa44f2b10b
commit 5617c42d2c
2 changed files with 18 additions and 14 deletions

View File

@ -1,3 +1,6 @@
2005-04-14 Don Allingham <don@gramps-project.org>
* src/FamilyView.py: make load_family more robust to signals
2005-04-14 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2005-04-14 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/gramps_main.py (undo): Dont emit "database-changed" * src/gramps_main.py (undo): Dont emit "database-changed"
* src/plugins/plugins/TestcaseGenerator.py: Added option to generate * src/plugins/plugins/TestcaseGenerator.py: Added option to generate

View File

@ -964,35 +964,37 @@ class FamilyView:
if self.parent.active_person: if self.parent.active_person:
handle = self.parent.active_person.get_handle() handle = self.parent.active_person.get_handle()
self.person = self.parent.db.get_person_from_handle(handle) self.person = self.parent.db.get_person_from_handle(handle)
splist = self.person.get_family_handle_list()
else: else:
self.person = None self.person = None
self.clear() self.clear()
return return
bhandle = self.person.get_birth_handle() person = self.person
dhandle = self.person.get_death_handle() bhandle = person.get_birth_handle()
dhandle = person.get_death_handle()
bd = self.parent.db.get_event_from_handle(bhandle) bd = self.parent.db.get_event_from_handle(bhandle)
dd = self.parent.db.get_event_from_handle(dhandle) dd = self.parent.db.get_event_from_handle(dhandle)
if bd and dd: if bd and dd:
n = "%s [%s]\n\t%s %s\n\t%s %s " % ( n = "%s [%s]\n\t%s %s\n\t%s %s " % (
NameDisplay.displayer.display(self.person), NameDisplay.displayer.display(person),
self.person.get_gramps_id(), person.get_gramps_id(),
_BORN,DateHandler.displayer.display(bd.get_date_object()), _BORN,DateHandler.displayer.display(bd.get_date_object()),
_DIED,DateHandler.displayer.display(dd.get_date_object())) _DIED,DateHandler.displayer.display(dd.get_date_object()))
elif bd: elif bd:
n = "%s [%s]\n\t%s %s" % ( n = "%s [%s]\n\t%s %s" % (
NameDisplay.displayer.display(self.person), NameDisplay.displayer.display(person),
self.person.get_gramps_id(), person.get_gramps_id(),
_BORN,DateHandler.displayer.display(bd.get_date_object())) _BORN,DateHandler.displayer.display(bd.get_date_object()))
elif dd: elif dd:
n = "%s [%s]\n\t%s %s" % ( n = "%s [%s]\n\t%s %s" % (
NameDisplay.displayer.display(self.person), NameDisplay.displayer.display(person),
self.person.get_gramps_id(), person.get_gramps_id(),
_DIED,DateHandler.displayer.display(dd.get_date_object())) _DIED,DateHandler.displayer.display(dd.get_date_object()))
else: else:
n = "%s [%s]" % (NameDisplay.displayer.display(self.person), n = "%s [%s]" % (NameDisplay.displayer.display(person),
self.person.get_gramps_id()) person.get_gramps_id())
self.ap_model.clear() self.ap_model.clear()
self.ap_data.get_selection().set_mode(gtk.SELECTION_NONE) self.ap_data.get_selection().set_mode(gtk.SELECTION_NONE)
@ -1003,8 +1005,6 @@ class FamilyView:
self.spouse_model.clear() self.spouse_model.clear()
self.sp_parents_model.clear() self.sp_parents_model.clear()
splist = self.person.get_family_handle_list()
if len(splist) > 1: if len(splist) > 1:
self.spouse_selection.set_mode(gtk.SELECTION_SINGLE) self.spouse_selection.set_mode(gtk.SELECTION_SINGLE)
else: else:
@ -1016,7 +1016,7 @@ class FamilyView:
fm = self.parent.db.get_family_from_handle(f) fm = self.parent.db.get_family_from_handle(f)
if not fm: if not fm:
continue continue
if fm.get_father_handle() == self.person.get_handle(): if fm.get_father_handle() == person.get_handle():
sp_id = fm.get_mother_handle() sp_id = fm.get_mother_handle()
else: else:
sp_id = fm.get_father_handle() sp_id = fm.get_father_handle()
@ -1041,6 +1041,7 @@ class FamilyView:
self.spouse_model.set(node,0,"%s\n" % _("<double click to add spouse>")) self.spouse_model.set(node,0,"%s\n" % _("<double click to add spouse>"))
self.spouse_model.set(node,1,f) self.spouse_model.set(node,1,f)
if family and family.get_handle() in flist: if family and family.get_handle() in flist:
self.display_marriage(family) self.display_marriage(family)
node = flist[family.get_handle()] node = flist[family.get_handle()]
@ -1054,7 +1055,7 @@ class FamilyView:
else: else:
self.display_marriage(None) self.display_marriage(None)
self.update_list(self.ap_parents_model,self.ap_parents,self.person) self.update_list(self.ap_parents_model,self.ap_parents,person)
def find_marriage(self,family): def find_marriage(self,family):
for event_handle in family.get_event_list(): for event_handle in family.get_event_list():