* src/ChooseParents.py: Disallow selecting self as a parent.
* src/SelectChild.py: Disallow selecting self as a child. svn: r3093
This commit is contained in:
parent
0417838641
commit
c518c0fd66
@ -1,3 +1,9 @@
|
|||||||
|
2004-04-20 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
|
* src/ChooseParents.py: Disallow selecting self as a parent.
|
||||||
|
|
||||||
|
2004-04-20 Jason Salaz <whatsizbucket@comcast.net>
|
||||||
|
* src/SelectChild.py: Disallow selecting self as a child.
|
||||||
|
|
||||||
2004-04-18 Don Allingham <dallingham@users.sourceforge.net>
|
2004-04-18 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
* src/DbPrompter.py: support for new GTK 2.4 file chooser
|
* src/DbPrompter.py: support for new GTK 2.4 file chooser
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ import const
|
|||||||
import Utils
|
import Utils
|
||||||
import GrampsCfg
|
import GrampsCfg
|
||||||
import PeopleModel
|
import PeopleModel
|
||||||
|
from QuestionDialog import ErrorDialog
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -472,7 +473,7 @@ class ChooseParents:
|
|||||||
|
|
||||||
def save_parents_clicked(self,obj):
|
def save_parents_clicked(self,obj):
|
||||||
"""
|
"""
|
||||||
Called with the OK button nis pressed. Saves the selected people as parents
|
Called with the OK button is pressed. Saves the selected people as parents
|
||||||
of the main perosn.
|
of the main perosn.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@ -489,26 +490,42 @@ class ChooseParents:
|
|||||||
if self.mother and not self.father:
|
if self.mother and not self.father:
|
||||||
if self.mother.get_gender() == RelLib.Person.male:
|
if self.mother.get_gender() == RelLib.Person.male:
|
||||||
self.father = self.mother
|
self.father = self.mother
|
||||||
|
father_id = self.father.get_id()
|
||||||
self.mother = None
|
self.mother = None
|
||||||
self.family = self.find_family(self.father.get_id(),self.mother.get_id())
|
mother_id = None
|
||||||
|
else:
|
||||||
|
mother_id = self.mother.get_id()
|
||||||
|
father_id = None
|
||||||
elif self.father and not self.mother:
|
elif self.father and not self.mother:
|
||||||
if self.father.get_gender() == RelLib.Person.female:
|
if self.father.get_gender() == RelLib.Person.female:
|
||||||
self.mother = self.father
|
self.mother = self.father
|
||||||
self.father = None
|
self.father = None
|
||||||
self.family = self.find_family(self.father.get_id(),self.mother.get_id())
|
mother_id = self.mother.get_id()
|
||||||
|
father_id = None
|
||||||
|
else:
|
||||||
|
father_id = self.father.get_id()
|
||||||
|
mother_id = None
|
||||||
elif self.mother.get_gender() != self.father.get_gender():
|
elif self.mother.get_gender() != self.father.get_gender():
|
||||||
if self.type == "Partners":
|
if self.type == "Partners":
|
||||||
self.type = "Unknown"
|
self.type = "Unknown"
|
||||||
if self.father.get_gender() == RelLib.Person.female:
|
if self.father.get_gender() == RelLib.Person.female:
|
||||||
self.father, self.mother = self.mother, self.father
|
self.father, self.mother = self.mother, self.father
|
||||||
self.family = self.find_family(self.father.get_id(),self.mother.get_id())
|
father_id = self.father.get_id()
|
||||||
|
mother_id = self.mother.get_id()
|
||||||
else:
|
else:
|
||||||
self.type = "Partners"
|
self.type = "Partners"
|
||||||
self.family = self.find_family(self.father.get_id(),self.mother.get_id())
|
father_id = self.father.get_id()
|
||||||
|
mother_id = self.mother.get_id()
|
||||||
|
self.family = self.find_family(father_id,mother_id)
|
||||||
else:
|
else:
|
||||||
self.family = None
|
self.family = None
|
||||||
|
|
||||||
if self.family:
|
if self.family:
|
||||||
|
if self.person.get_id() in (father_id,mother_id):
|
||||||
|
ErrorDialog(_("Error selecting a child"),
|
||||||
|
_("A person cannot be linked as his/her own parent"),
|
||||||
|
self.top)
|
||||||
|
return
|
||||||
self.family.add_child_id(self.person.get_id())
|
self.family.add_child_id(self.person.get_id())
|
||||||
self.family.set_relationship(self.type)
|
self.family.set_relationship(self.type)
|
||||||
self.change_family_type(self.family,mother_rel,father_rel)
|
self.change_family_type(self.family,mother_rel,father_rel)
|
||||||
|
@ -47,6 +47,7 @@ import Utils
|
|||||||
import PeopleModel
|
import PeopleModel
|
||||||
import GrampsCfg
|
import GrampsCfg
|
||||||
from RelLib import Person
|
from RelLib import Person
|
||||||
|
from QuestionDialog import ErrorDialog
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -300,10 +301,16 @@ class SelectChild:
|
|||||||
|
|
||||||
select_child.add_parent_family_id(self.family.get_id(),mrel,frel)
|
select_child.add_parent_family_id(self.family.get_id(),mrel,frel)
|
||||||
|
|
||||||
|
if id in (self.family.get_father_id(),self.family.get_mother_id()):
|
||||||
|
ErrorDialog(_("Error selecting a child"),
|
||||||
|
_("A person cannot be linked as his/her own child"),
|
||||||
|
self.top)
|
||||||
|
return
|
||||||
|
|
||||||
trans = self.db.start_transaction()
|
trans = self.db.start_transaction()
|
||||||
self.db.commit_person(select_child,trans)
|
self.db.commit_person(select_child,trans)
|
||||||
self.db.add_transaction(trans)
|
self.db.add_transaction(trans)
|
||||||
|
|
||||||
self.redraw(self.family)
|
self.redraw(self.family)
|
||||||
self.close(obj)
|
self.close(obj)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user