* src/RelLib/_Family.py: add remove_child_handle

svn: r6376
This commit is contained in:
Don Allingham 2006-04-20 03:44:11 +00:00
parent a71ac389b2
commit 2f5aa02120
3 changed files with 21 additions and 3 deletions

View File

@ -1,4 +1,5 @@
2006-04-19 Don Allingham <don@gramps-project.org>
* 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

View File

@ -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):

View File

@ -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