* src/SelectChild.py (on_save_child_clicke): Dont add the same person multiple times as child

* src/gramps_main.py (delete_person_response): Purge empty family after the last child of a single-spouse family was deleted.


svn: r5125
This commit is contained in:
Martin Hawlisch 2005-08-25 21:05:44 +00:00
parent acedbb4417
commit 59162682c0
3 changed files with 32 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2005-08-25 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/SelectChild.py (on_save_child_clicke): Dont add the same person
multiple times as child
* src/gramps_main.py (delete_person_response): Purge empty family
after the last child of a single-spouse family was deleted.
2005-08-24 Don Allingham <don@gramps-project.org>
* src/ImgManip.py: convert to png instead of jpeg
* src/ReadGedcom.py: try to catch bad secondary index error.

View File

@ -206,7 +206,15 @@ class SelectChild:
else:
self.family.set_mother_handle(self.person.get_handle())
self.db.commit_family(self.family,trans)
# check that selected child is not already a child in family
if handle in self.family.get_child_handle_list():
ErrorDialog(_("Error selecting a child"),
_("The person is already linked as child"),
self.top)
return
# check that selected child is not already a spouse in family
if handle in (self.family.get_father_handle(),self.family.get_mother_handle()):
ErrorDialog(_("Error selecting a child"),
_("A person cannot be linked as his/her own child"),

View File

@ -1527,10 +1527,25 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
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)
family = self.db.get_family_from_handle(family_handle)
if family:
family.remove_child_handle(self.active_person.get_handle())
self.db.commit_family(family,trans)
# Purge empty family
if len(family.get_child_handle_list()) == 0:
if not family.get_father_handle():
mother = self.db.get_person_from_handle( family.get_mother_handle())
if mother:
mother.remove_family_handle( family_handle)
self.db.commit_person( mother,trans)
self.db.remove_family(family_handle,trans)
if not family.get_mother_handle():
father = self.db.get_person_from_handle( family.get_father_handle())
if father:
father.remove_family_handle( family_handle)
self.db.commit_person( father,trans)
self.db.remove_family(family_handle,trans)
handle = self.active_person.get_handle()