* src/Merge/_MergePerson.py: fixed check_for_child function to handle childrefs

svn: r7713
This commit is contained in:
Don Allingham 2006-11-26 22:34:02 +00:00
parent 2c617e4326
commit be83b6f8ba
2 changed files with 20 additions and 4 deletions

View File

@ -1,4 +1,5 @@
2006-11-26 Don Allingham <don@gramps-project.org>
* src/Merge/_MergePerson.py: fixed check_for_child function to handle childrefs
* po/gramps.pot: updated
2006-11-26 Alex Roitman <shura@gramps-project.org>

View File

@ -83,7 +83,6 @@ class PersonCompare(ManagedWindow.ManagedWindow):
GrampsDisplay.help('adv-merge-people')
def merge(self,obj):
if check_for_spouse(self.p1,self.p2):
QuestionDialog.ErrorDialog(
_("Cannot merge people"),
@ -245,10 +244,10 @@ def check_for_spouse(p1, p2):
def check_for_child(p1, p2):
fs1 = sets.Set(p1.get_family_handle_list())
fp1 = sets.Set(map(lambda x: x[0], p1.get_parent_family_handle_list()))
fp1 = sets.Set(p1.get_parent_family_handle_list())
fs2 = sets.Set(p2.get_family_handle_list())
fp2 = sets.Set(map(lambda x: x[0], p2.get_parent_family_handle_list()))
fp2 = sets.Set(p2.get_parent_family_handle_list())
return len(fs1.intersection(fp2)) != 0 or len(fs2.intersection(fp1))
@ -261,6 +260,21 @@ class MergePeopleUI(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, person1, person2, update=None):
if check_for_spouse(person1, person2):
QuestionDialog.ErrorDialog(
_("Cannot merge people"),
_("Spouses cannot be merged. To merge these people, "
"you must first break the relationship between them."))
return
if check_for_child(person1, person2):
QuestionDialog.ErrorDialog(
_("Cannot merge people"),
_("A parent and child cannot be merged. To merge these "
"people, you must first break the relationship between "
"them."))
return
ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__)
glade = gtk.glade.XML(const.merge_glade, 'merge_people')
@ -369,6 +383,7 @@ class MergePeople:
Finally, the merged person is delete from the database and the
entire transaction is committed.
"""
self.debug_person(self.p1, "P1")
self.debug_person(self.p2, "P2")