From 753b5c28ec95b593fcf40a6587f21bba836b9089 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 29 Mar 2005 16:41:40 +0000 Subject: [PATCH] * src/gramps_main.py (delete_person_response): Object/handle mixups, remove unneeded commits. svn: r4252 --- gramps2/ChangeLog | 2 ++ gramps2/src/gramps_main.py | 32 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 1e1648d8a..f83d8d3bf 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,6 +1,8 @@ 2005-03-29 Alex Roitman * src/Witness.py (WitnessEditor.__init__): Work around missing reference. + * src/gramps_main.py (delete_person_response): Object/handle mixups, + remove unneeded commits. 2005-03-29 Richard Taylor * src/plugins/ScratchPad.py (on_object_select_row): fixed the drop of diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 57854eb5e..d171ddf09 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -1388,26 +1388,26 @@ class Gramps: if not family_handle: continue family = self.db.get_family_from_handle(family_handle) + family_to_remove = False if self.active_person.get_handle() == family.get_father_handle(): - if family.get_mother_handle() == None: - for child_handle in family.get_child_handle_list(): - child = self.db.get_person_from_handle(child_handle) - child.remove_parent_family_handle(family.get_handle()) - self.db.commit_person(child,trans) - self.db.remove_family(family.get_handle(),trans) - else: + if family.get_mother_handle(): family.set_father_handle(None) - else: - if family.get_father_handle() == None: - for child_handle in family.get_child_handle_list(): - child = self.db.get_person_from_handle(child_handle) - child.remove_parent_family_handle(family) - self.db.commit_person(child,trans) - self.db.remove_family(family,trans) else: + family_to_remove = True + else: + if family.get_father_handle(): family.set_mother_handle(None) - self.db.commit_family(family,trans) - + else: + family_to_remove = True + if family_to_remove: + for child_handle in family.get_child_handle_list(): + child = self.db.get_person_from_handle(child_handle) + child.remove_parent_family_handle(family_handle) + self.db.commit_person(child,trans) + self.db.remove_family(family_handle,trans) + else: + self.db.commit_family(family,trans) + for (family_handle,mrel,frel) in self.active_person.get_parent_family_handle_list(): if family_handle: family = self.db.get_family_from_handle(family_handle)