From bbe86f7d5a47a9da087dc95c3c061b8cd5b6a977 Mon Sep 17 00:00:00 2001 From: David Hampton Date: Sun, 2 Dec 2001 01:25:58 +0000 Subject: [PATCH] Fix problem adding child to single parent family. svn: r603 --- gramps/src/SelectChild.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/gramps/src/SelectChild.py b/gramps/src/SelectChild.py index 00864788f..9b82e96fd 100644 --- a/gramps/src/SelectChild.py +++ b/gramps/src/SelectChild.py @@ -66,17 +66,29 @@ class SelectChild: self.add_child = self.xml.get_widget("addChild") self.add_child.set_column_visibility(1,Config.id_visible) - father = self.family.getFather() - if father != None: - fname = father.getPrimaryName().getName() - ftitle = _("Relationship to %s") % fname - self.xml.get_widget("flabel").set_text(ftitle) + if (self.family): + father = self.family.getFather() + mother = self.family.getMother() - mother = self.family.getMother() - if mother != None: - mname = mother.getPrimaryName().getName() - mtitle = _("Relationship to %s") % mname - self.xml.get_widget("mlabel").set_text(mtitle) + if father != None: + fname = father.getPrimaryName().getName() + label = _("Relationship to %s") % fname + self.xml.get_widget("flabel").set_text(label) + + if mother != None: + mname = mother.getPrimaryName().getName() + label = _("Relationship to %s") % mname + self.xml.get_widget("mlabel").set_text(label) + else: + fname = self.person.getPrimaryName().getName() + label = _("Relationship to %s") % fname + + if self.person.getGender() == Person.male: + self.xml.get_widget("flabel").set_text(label) + self.xml.get_widget("mrel_combo").set_sensitive(0) + else: + self.xml.get_widget("mlabel").set_text(label) + self.xml.get_widget("frel_combo").set_sensitive(0) self.mrel = self.xml.get_widget("mrel") self.frel = self.xml.get_widget("frel")