diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 9fae7a3ae..d4b1f13cf 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,5 @@ 2006-04-19 Don Allingham + * src/RelLib/_Family.py: add remove_child_handle * src/DataViews/_EventView.py: more GrampsTypes changes * src/DataViews/_PedigreeView.py: more GrampsTypes changes * src/RelLib/_ChildRef.py: more GrampsTypes changes diff --git a/gramps2/src/Editors/_EditFamily.py b/gramps2/src/Editors/_EditFamily.py index c467bbc71..6ec48df66 100644 --- a/gramps2/src/Editors/_EditFamily.py +++ b/gramps2/src/Editors/_EditFamily.py @@ -238,9 +238,11 @@ class ChildEmbedList(EmbeddedList): skip=[ x for x in skip if x]) def del_button_clicked(self,obj): - ref = self.get_selected() - if ref: - self.family.remove_child_ref(ref) + handle = self.get_selected() + if handle: + for ref in self.family.get_child_ref_list(): + if ref.ref == handle: + self.family.remove_child_ref(ref) self.rebuild() def edit_button_clicked(self,obj): diff --git a/gramps2/src/RelLib/_Family.py b/gramps2/src/RelLib/_Family.py index 885983d26..0fd4a20bd 100644 --- a/gramps2/src/RelLib/_Family.py +++ b/gramps2/src/RelLib/_Family.py @@ -382,6 +382,21 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase, if ref.ref != child_ref.ref ] self.child_ref_list = new_list + def remove_child_handle(self,child_handle): + """ + Removes the database handle for L{Person} to the Family's list + of children if the L{Person} is already in the list. + + @param person_handle: L{Person} database handle + @type person_handle: str + @return: True if the handle was removed, False if it was not + in the list. + @rtype: bool + """ + new_list = [ref for ref in self.child_ref_list + if ref.ref != child_handle ] + self.child_ref_list = new_list + def get_child_ref_list(self): """ Returns the list of L{Person} handles identifying the children