* src/Editors/_EditPerson.py: If a family changes, rebuild family backref of all 
	open editors. issue #1309, causing corrupt database.
	Also remove unneeded associations rebuild when family changes



svn: r9226
This commit is contained in:
Benny Malengier
2007-10-21 08:04:01 +00:00
parent b3fcd5a4f5
commit 6462f4b339
2 changed files with 20 additions and 8 deletions

View File

@@ -1,3 +1,8 @@
2007-10-21 Benny Malengier <benny.malengier@gramps-project.org>
* src/Editors/_EditPerson.py: If a family changes, rebuild family backref of all
open editors. issue #1309, causing corrupt database.
Also remove unneeded associations rebuild when family changes
2007-10-20 Brian Matherly <brian@gramps-project.org> 2007-10-20 Brian Matherly <brian@gramps-project.org>
* src/ReportBase/_BareReportDialog.py: * src/ReportBase/_BareReportDialog.py:
* src/plugins/WebCal.py: * src/plugins/WebCal.py:

View File

@@ -172,19 +172,26 @@ class EditPerson(EditPrimary):
self._add_db_signal('family-add', self.family_change) self._add_db_signal('family-add', self.family_change)
def family_change(self, handle_list): def family_change(self, handle_list):
flist = self.obj.get_family_handle_list() + self.obj.get_parent_family_handle_list() """Callback for family change signals. This should rebuild the
for handle in handle_list: backreferences to family in person when:
if handle in flist: 1)a family the person is parent of changes. Person could have
been removed
2)a family the person is child in changes. Child could have been
removed
3)a family is changed. The person could be added as child or
parent
"""
#As this would be an extensive check, we choose the easy path and
# rebuild family backreferences on all family changes
self._update_families() self._update_families()
return
def _update_families(self): def _update_families(self):
phandle = self.obj.get_handle() phandle = self.obj.get_handle()
person = self.dbstate.db.get_person_from_handle(phandle) person = self.dbstate.db.get_person_from_handle(phandle)
self.obj.set_family_handle_list(person.get_family_handle_list()) self.obj.set_family_handle_list(person.get_family_handle_list())
self.obj.set_parent_family_handle_list(person.get_parent_family_handle_list()) self.obj.set_parent_family_handle_list(
self.person_ref_list.data = self.obj.get_person_ref_list() person.get_parent_family_handle_list())
self.person_ref_list.rebuild()
def _setup_fields(self): def _setup_fields(self):
""" """