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



svn: r9225
This commit is contained in:
Benny Malengier 2007-10-21 07:59:42 +00:00
parent 6ca81346cf
commit 734d81bc79
2 changed files with 27 additions and 7 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-19 Piotr Czubaszek <pioterus@gmail.com>
* src/docgen/PdfDoc.py (PdfDoc.add_media_object): Missing period.

View File

@ -166,19 +166,34 @@ class EditPerson(EditPrimary):
self._add_db_signal('family-add', self.family_change)
def family_change(self, handle_list):
flist = self.obj.get_family_handle_list() + self.obj.get_parent_family_handle_list()
for handle in handle_list:
if handle in flist:
self._update_families()
return
"""Callback for family change signals. This should rebuild the
backreferences to family in person when:
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
##flist = self.obj.get_family_handle_list() + \
## self.obj.get_parent_family_handle_list()
##for handle in handle_list:
## if handle in flist:
## self._update_families()
## return
self._update_families()
def _update_families(self):
phandle = self.obj.get_handle()
person = self.dbstate.db.get_person_from_handle(phandle)
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.person_ref_list.data = self.obj.get_person_ref_list()
self.person_ref_list.rebuild()
#self.person_ref_list.data = self.obj.get_person_ref_list()
#self.person_ref_list.rebuild()
def _setup_fields(self):
"""