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> 2007-10-19 Piotr Czubaszek <pioterus@gmail.com>
* src/docgen/PdfDoc.py (PdfDoc.add_media_object): Missing period. * 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) 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
##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() 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(person.get_parent_family_handle_list())
self.person_ref_list.data = self.obj.get_person_ref_list() #self.person_ref_list.data = self.obj.get_person_ref_list()
self.person_ref_list.rebuild() #self.person_ref_list.rebuild()
def _setup_fields(self): def _setup_fields(self):
""" """