Fix/tweak ChooseParents dialog.
svn: r506
This commit is contained in:
parent
4e5b38782a
commit
346908cece
@ -187,11 +187,12 @@ class ChooseParents:
|
|||||||
family = self.db.newFamily()
|
family = self.db.newFamily()
|
||||||
family.setFather(father)
|
family.setFather(father)
|
||||||
family.setMother(mother)
|
family.setMother(mother)
|
||||||
|
family.addChild(self.person)
|
||||||
|
|
||||||
if father:
|
if father:
|
||||||
father.addFamily(self.family)
|
father.addFamily(family)
|
||||||
if mother:
|
if mother:
|
||||||
mother.addFamily(self.family)
|
mother.addFamily(family)
|
||||||
|
|
||||||
return family
|
return family
|
||||||
|
|
||||||
@ -211,7 +212,7 @@ class ChooseParents:
|
|||||||
if self.father or self.mother:
|
if self.father or self.mother:
|
||||||
if self.mother and not self.father:
|
if self.mother and not self.father:
|
||||||
if self.mother.getGender() == Person.male:
|
if self.mother.getGender() == Person.male:
|
||||||
self.father = self._mother
|
self.father = self.mother
|
||||||
self.mother = None
|
self.mother = None
|
||||||
self.family = self.find_family(self.father,self.mother)
|
self.family = self.find_family(self.father,self.mother)
|
||||||
elif self.father and not self.mother:
|
elif self.father and not self.mother:
|
||||||
@ -239,22 +240,24 @@ class ChooseParents:
|
|||||||
self.change_family_type(self.family,mrel,frel)
|
self.change_family_type(self.family,mrel,frel)
|
||||||
self.update(self.family)
|
self.update(self.family)
|
||||||
|
|
||||||
def on_addfather_clicked(self,obj):
|
def on_addparent_clicked(self,obj,sex):
|
||||||
xml = libglade.GladeXML(const.gladeFile,"addperson")
|
|
||||||
xml.get_widget("male").set_active(1)
|
|
||||||
xml.signal_autoconnect({
|
|
||||||
"on_addfather_close": on_addparent_close,
|
|
||||||
"destroy_passed_object" : utils.destroy_passed_object
|
|
||||||
})
|
|
||||||
|
|
||||||
def on_addmother_clicked(self,obj):
|
|
||||||
self.xml = libglade.GladeXML(const.gladeFile,"addperson")
|
self.xml = libglade.GladeXML(const.gladeFile,"addperson")
|
||||||
self.xml.get_widget("female").set_active(1)
|
self.xml.get_widget(sex).set_active(1)
|
||||||
self.xml.signal_autoconnect({
|
self.xml.signal_autoconnect({
|
||||||
"on_addfather_close": self.on_addparent_close,
|
"on_addfather_close": self.on_addparent_close,
|
||||||
"destroy_passed_object" : utils.destroy_passed_object
|
"destroy_passed_object" : utils.destroy_passed_object
|
||||||
})
|
})
|
||||||
|
|
||||||
|
window = self.xml.get_widget("addperson")
|
||||||
|
window.editable_enters(self.xml.get_widget("given"))
|
||||||
|
window.editable_enters(self.xml.get_widget("surname"))
|
||||||
|
|
||||||
|
def on_addfather_clicked(self,obj):
|
||||||
|
self.on_addparent_clicked(obj,"male")
|
||||||
|
|
||||||
|
def on_addmother_clicked(self,obj):
|
||||||
|
self.on_addparent_clicked(obj,"female")
|
||||||
|
|
||||||
def change_family_type(self,family,mrel,frel):
|
def change_family_type(self,family,mrel,frel):
|
||||||
|
|
||||||
is_main = (mrel == "Birth") and (frel == "Birth")
|
is_main = (mrel == "Birth") and (frel == "Birth")
|
||||||
|
Loading…
Reference in New Issue
Block a user