diff --git a/gramps/src/GrampsParser.py b/gramps/src/GrampsParser.py index 27f026c15..a51653e1a 100644 --- a/gramps/src/GrampsParser.py +++ b/gramps/src/GrampsParser.py @@ -297,8 +297,6 @@ class GrampsParser: else: frel = "Birth" self.person.AltFamilyList.append((family,mrel,frel)) - if attrs.has_key('pref'): - self.person.setMainFamily(family) def start_parentin(self,attrs): self.person.FamilyList.append(self.db.findFamilyNoMap(u2l(attrs["ref"]))) diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index 89dccc862..119c44d89 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -1079,12 +1079,15 @@ class Person: def addAltFamily(self,family,mrel,frel): """adds a Family to the alternate family list, indicating the relationship to the mother (mrel) and the father (frel)""" + assert(family==None) self.AltFamilyList.append((family,mrel,frel)) def removeAltFamily(self,family): """removes a Family instance from the alternate family list""" for f in self.AltFamilyList[:]: + print "+",f[0],family if f[0] == family: + print f, family self.AltFamilyList.remove(f) return f else: @@ -1101,9 +1104,9 @@ class Person: """sets the main Family of the Person, the Family in which the Person is a natural born child""" assert(family in self.AltFamilyList) - - f = self.removeFamily(family) - self.AltFamilyList = [f] + self.AltFamilyList + f = self.removeAltFamily(family) + if f: + self.AltFamilyList = [f] + self.AltFamilyList def getMainFamily(self): """returns the main Family of the Person, the Family in which the diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py index 0fb2fb056..6020f64ed 100644 --- a/gramps/src/WriteXML.py +++ b/gramps/src/WriteXML.py @@ -250,13 +250,12 @@ class XmlWriter: self.write_attribute_list(person.getAttributeList()) self.write_url_list(person.getUrlList()) - self.write_ref("childof",person.getMainFamily(),3) for alt in person.getAltFamilyList(): - if alt[1] != "": + if alt[1] != "Birth": mrel=' mrel="%s"' % alt[1] else: mrel='' - if alt[2] != "": + if alt[2] != "Birth": frel=' frel="%s"' % alt[2] else: frel='' diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index 6ee3fd3f5..a72e79d71 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -1511,7 +1511,7 @@ GtkFrame - frame1 + rel_frame 5 0 @@ -1784,7 +1784,7 @@ GtkFrame - frame2 + parent_frame 5 0 @@ -1998,9 +1998,119 @@ + + GtkHBox + hbox75 + False + 0 + + 1 + 3 + 1 + 2 + 0 + 0 + False + False + False + False + True + True + + + + GtkLabel + label301 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 5 + 0 + + 0 + False + False + + + + + GtkLabel + frel + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + True + True + + + + + + GtkHBox + hbox76 + False + 0 + + 1 + 3 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + GtkLabel + label302 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 5 + 0 + + 0 + False + False + + + + + GtkLabel + mrel + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + True + True + + + + GtkVBox - vbox50 + multi_parents False 0 @@ -2011,7 +2121,7 @@ 0 0 False - False + True False False True @@ -2081,122 +2191,17 @@ - - GtkHBox - hbox75 - False - 0 - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - GtkLabel - label301 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 5 - 0 - - 0 - False - False - - - - - GtkLabel - frel - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - True - True - - - - - - GtkHBox - hbox76 - False - 0 - - 1 - 2 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - GtkLabel - label302 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 5 - 0 - - 0 - False - False - - - - - GtkLabel - mrel - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - True - True - - - - GtkCheckButton preffam False True - + + toggled + on_preffam_toggled + Sun, 24 Mar 2002 16:20:15 GMT + + False True @@ -2204,8 +2209,8 @@ 2 4 5 - 5 - 5 + 0 + 0 False False False diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index fbbe4b5cb..a7c57fa12 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -211,6 +211,7 @@ class Gramps: self.gtop.signal_autoconnect({ "delete_event" : self.delete_event, "destroy_passed_object" : Utils.destroy_passed_object, + "on_preffam_toggled" : self.on_preferred_fam_toggled, "on_family_up_clicked" : self.family_up_clicked, "on_family_down_clicked" : self.family_down_clicked, "on_prefrel_toggled" : self.on_preferred_rel_toggled, @@ -1307,6 +1308,13 @@ class Gramps: self.spouse_ptab.set_page(1) self.spouse_pref.set_active(0) self.active_person.setPreferred(self.active_family) + Utils.modified() + + def on_preferred_fam_toggled(self,obj): + obj.set_active(0) + self.active_person.setMainFamily(self.active_parents) + self.change_parents(self.active_parents) + Utils.modified() def new_after_edit(self,epo,plist): if epo: @@ -1402,31 +1410,15 @@ class Gramps: if self.active_parents == None and len(family_types) > 0: self.active_parents = family_types[0][0] + if len(family_types) > 1: + self.gtop.get_widget('multi_parents').show() + self.gtop.get_widget('preffam').show() + else: + self.gtop.get_widget('multi_parents').hide() + self.gtop.get_widget('preffam').hide() else: self.active_parents = None -# if len(family_types) > 0: -# typeMenu = gtk.GtkMenu() -# index = 0 -# pref = 0 -# for fam in family_types: -# if fam[0] == main_family: -# pref = index -# if self.active_person == fam[0].getFather(): -# menuitem = gtk.GtkMenuItem("%s/%s" % (fam[1],fam[2])) -# else: -# menuitem = gtk.GtkMenuItem("%s/%s" % (fam[2],fam[1])) -# menuitem.set_data("parents",fam[0]) -# menuitem.connect("activate",self.on_current_type_changed) -# menuitem.show() -# typeMenu.append(menuitem) -# index = index + 1 -# self.child_type.set_menu(typeMenu) -# self.child_type.set_history(pref) -# self.child_type.show() -# else: -# self.child_type.hide() - self.change_parents(self.active_parents) if self.active_person: @@ -1494,6 +1486,8 @@ class Gramps: self.display_marriage(None) def change_parents(self,family): + """Switches to a different set of parents on the Family View""" + if self.active_parents and self.active_parents.getRelationship() == "Partners": fn = _("Parent") mn = _("Parent") @@ -1501,6 +1495,24 @@ class Gramps: fn = _("Father") mn = _("Mother") + pframe = self.gtop.get_widget('parent_frame') + if self.active_parents: + val = len(self.active_person.getAltFamilyList()) + if self.active_parents == self.active_person.getMainFamily(): + self.gtop.get_widget('preffam').set_sensitive(0) + if val > 1: + pframe.set_label(_("Preferred Parents (%d of %d)") % \ + (self.parents_index+1,val)) + else: + pframe.set_label(_("Preferred Parents")) + else: + self.gtop.get_widget('preffam').set_sensitive(1) + pframe.set_label(_("Alternate Parents (%d of %d)") % \ + (self.parents_index+1,val)) + else: + self.gtop.get_widget('parent_frame').set_label(_("No Parents")) + + self.gtop.get_widget("editFather").children()[0].set_text(fn) self.gtop.get_widget("editMother").children()[0].set_text(mn) @@ -1508,6 +1520,9 @@ class Gramps: fv_mother = self.gtop.get_widget("fv_mother") father_next = self.gtop.get_widget("father_next") mother_next = self.gtop.get_widget("mother_next") + + self.gtop.get_widget("mrel").set_text('') + self.gtop.get_widget("frel").set_text('') if family != None : self.active_father = family.getFather() @@ -1529,6 +1544,7 @@ class Gramps: if f[0] == family: self.gtop.get_widget("mrel").set_text(_(f[1])) self.gtop.get_widget("frel").set_text(_(f[2])) + break elif self.active_person == None: fv_father.set_text("") fv_mother.set_text("")