diff --git a/gramps2/example/gramps/data.gramps b/gramps2/example/gramps/data.gramps index 64b0eebc6..b386f19cc 100644 --- a/gramps2/example/gramps/data.gramps +++ b/gramps2/example/gramps/data.gramps @@ -2,11 +2,11 @@
- + Joe Smith Over There - Springfield + Somewhere New York USA 12345 @@ -311,18 +311,6 @@ - - M - - Lars Peter - Smith - - - - - - - F @@ -556,6 +544,18 @@ Company. He enlisted in the army at Sparks 7 December 1917 and served as a Corpo + + F + + Darcy + Horne + + + + + + + F @@ -597,17 +597,17 @@ Company. He enlisted in the army at Sparks 7 December 1917 and served as a Corpo - - F + + M - Darcy - Horne + Lars Peter + Smith - - + + - + M @@ -846,15 +846,15 @@ Martin was listed as being a Husman, (owning a house as opposed to a farm) in th - - + + - + - + @@ -864,4 +864,10 @@ Martin was listed as being a Husman, (owning a house as opposed to a farm) in th + + + + + + diff --git a/gramps2/src/AttrEdit.py b/gramps2/src/AttrEdit.py index 76af9d717..8928f4650 100644 --- a/gramps2/src/AttrEdit.py +++ b/gramps2/src/AttrEdit.py @@ -92,7 +92,7 @@ class AttributeEditor: l = self.top.get_widget("title") Utils.set_titles(self.window,l,title,_('Attribute Editor')) - AutoComp.AutoEntry(self.attrib_menu.entry,list) + AutoComp.AutoCombo(self.attrib_menu,list) if attrib != None: self.type_field.set_text(attrib.getType()) diff --git a/gramps2/src/AutoComp.py b/gramps2/src/AutoComp.py index 2127621d6..d55d602eb 100644 --- a/gramps2/src/AutoComp.py +++ b/gramps2/src/AutoComp.py @@ -134,14 +134,14 @@ class AutoCombo(AutoCompBase): AutoCompBase.__init__(self,widget,plist,source) self.entry = widget widget.entry.connect("insert-text",self.insert_text) - button1 = widget.get_children()[1] - button1.connect("button-press-event",self.build_list) - button1.connect("button-release-event",self.setval) +# button1 = widget.get_children()[1] +# button1.connect("pressed",self.build_list) +# button1.connect("released",self.setval) self.vals = [""] self.inb = 0 widget.set_popdown_strings(plist) - def setval(self,widget,event): + def setval(self,widget): """Callback task called on the button release""" self.inb = 0 @@ -150,15 +150,18 @@ class AutoCombo(AutoCompBase): gtk.Editable.set_position(self.entry.entry,self.l) gtk.Editable.select_region(self.entry.entry,self.l,-1) - def build_list(self,widget,event): + def build_list(self,widget): """Internal task that builds the popdown strings. This task is called when the combo button that activates the dropdown menu is pressed """ self.inb = 1 + + print text if self.vals[0] == "": self.entry.set_popdown_strings([self.entry.entry.get_text()]) else: self.entry.set_popdown_strings(self.vals) + return 1 def timer_callback(self,entry): """ diff --git a/gramps2/src/Bookmarks.py b/gramps2/src/Bookmarks.py index 2ac0304d5..d4f3dfed5 100644 --- a/gramps2/src/Bookmarks.py +++ b/gramps2/src/Bookmarks.py @@ -89,10 +89,12 @@ class Bookmarks : """Draws the bookmark dialog box""" title = "%s - GRAMPS" % _("Edit Bookmarks") self.top = gtk.Dialog(title) - self.top.set_default_size(350,250) + self.top.set_default_size(400,350) + self.top.set_has_separator(gtk.FALSE) self.top.vbox.set_spacing(5) - self.top.vbox.pack_start(gtk.Label(_("Edit Bookmarks")),0,0,5) - self.top.vbox.pack_start(gtk.HSeparator(),0,0,5) + label = gtk.Label('%s' % _("Edit Bookmarks")) + label.set_use_markup(gtk.TRUE) + self.top.vbox.pack_start(label,0,0,5) box = gtk.HBox() self.top.vbox.pack_start(box,1,1,5) self.namelist = gtk.CList(1) @@ -102,6 +104,7 @@ class Bookmarks : box.pack_start(slist,1,1,5) bbox = gtk.VButtonBox() bbox.set_layout(gtk.BUTTONBOX_START) + bbox.set_spacing(6) up = gtk.Button() up.set_label(gtk.STOCK_GO_UP) up.set_use_stock(1) diff --git a/gramps2/src/GrampsCfg.py b/gramps2/src/GrampsCfg.py index 33c52288e..d4dc09671 100644 --- a/gramps2/src/GrampsCfg.py +++ b/gramps2/src/GrampsCfg.py @@ -583,11 +583,13 @@ class GrampsPreferences: self.top.get_widget("fprefix").set_text(fprefix) self.top.get_widget("sprefix").set_text(sprefix) self.top.get_widget("pprefix").set_text(pprefix) - + if status_bar == 0: self.top.get_widget("stat1").set_active(1) - else: + elif status_bar == 1: self.top.get_widget("stat2").set_active(1) + else: + self.top.get_widget("stat3").set_active(1) if toolbar == 0: self.top.get_widget("tool1").set_active(1) diff --git a/gramps2/src/Makefile.am b/gramps2/src/Makefile.am index ba5ef3b8a..6e9cf19bd 100644 --- a/gramps2/src/Makefile.am +++ b/gramps2/src/Makefile.am @@ -72,6 +72,7 @@ pkgpython_PYTHON = \ QuestionDialog.py\ QuickAdd.py\ ReadXML.py\ + Relationship.py\ RelImage.py\ RelLib.py\ Report.py\ diff --git a/gramps2/src/Relationship.py b/gramps2/src/Relationship.py new file mode 100644 index 000000000..a698ce125 --- /dev/null +++ b/gramps2/src/Relationship.py @@ -0,0 +1,249 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000 Donald N. Allingham +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- + +import RelLib +import GrampsCfg + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- + +level_name = [ "", "First", "Second", "Third", "Fourth", "Fifth", "Sixth", + "Seventh", "Eighth", "Ninth", "Tenth", "Eleventh", "Twelfth", + "Thirteenth", "Fourteenth", "Fifteenth", "Sixteenth", + "Seventeenth", "Eigthteenth", "Nineteenth", "Twentieth" ] + +removed_level = [ "", " once removed", " twice removed", " three times removed", + " four times removed", " five times removed", " six times removed", + " sevent times removed", " eight times removed", " nine times removed", + " ten times removed", " eleven times removed", " twelve times removed", + " thirteen times removed", " fourteen times removed", " fifteen times removed", + " sixteen times removed", " seventeen times removed", " eighteen times removed", + " nineteen times removed", " twenty times removed" ] + +father_level = [ "", "Father", "Grandfather", "Great Grandfather", "Second Great Grandfather", + "Third Great Grandfather", "Fourth Great Grandfather", + "Fifth Great Grandfather", "Sixth Great Grandfather", + "Seventh Great Grandfather", "Eighth Great Grandfather", + "Ninth Great Grandfather", "Tenth Great Grandfather", + "Eleventh Great Grandfather", "Twelefth Great Grandfather", + "Thirteenth Great Grandfather", "Fourteenth Great Grandfather", + "Fifteenth Great Grandfather", "Sixteenth Great Grandfather", + "Seventeenth Great Grandfather", "Eightteenth Great Grandfather", + "Ninetheen Great Grandfather", "Twentieth Great Grandfather", ] + +mother_level = [ "", "Mother", "Grandmother", "Great Grandmother", "Second Great Grandmother", + "Third Great Grandmother", "Fourth Great Grandmother", + "Fifth Great Grandmother", "Sixth Great Grandmother", + "Seventh Great Grandmother", "Eighth Great Grandmother", + "Ninth Great Grandmother", "Tenth Great Grandmother", + "Eleventh Great Grandmother", "Twelefth Great Grandmother", + "Thirteenth Great Grandmother", "Fourteenth Great Grandmother", + "Fifteenth Great Grandmother", "Sixteenth Great Grandmother", + "Seventeenth Great Grandmother", "Eightteenth Great Grandmother", + "Ninetheen Great Grandmother", "Twentieth Great Grandmother", ] + +son_level = [ "", "Son", "Grandson", "Great Grandson", "Second Great Grandson", + "Third Great Grandson", "Fourth Great Grandson", + "Fifth Great Grandson", "Sixth Great Grandson", + "Seventh Great Grandson", "Eighth Great Grandson", + "Ninth Great Grandson", "Tenth Great Grandson", + "Eleventh Great Grandson", "Twelefth Great Grandson", + "Thirteenth Great Grandson", "Fourteenth Great Grandson", + "Fifteenth Great Grandson", "Sixteenth Great Grandson", + "Seventeenth Great Grandson", "Eightteenth Great Grandson", + "Ninetheen Great Grandson", "Twentieth Great Grandson", ] + +daughter_level = [ "", "Daughter", "Granddaughter", "Great Granddaughter", "Second Great Granddaughter", + "Third Great Granddaughter", "Fourth Great Granddaughter", + "Fifth Great Granddaughter", "Sixth Great Granddaughter", + "Seventh Great Granddaughter", "Eighth Great Granddaughter", + "Ninth Great Granddaughter", "Tenth Great Granddaughter", + "Eleventh Great Granddaughter", "Twelefth Great Granddaughter", + "Thirteenth Great Granddaughter", "Fourteenth Great Granddaughter", + "Fifteenth Great Granddaughter", "Sixteenth Great Granddaughter", + "Seventeenth Great Granddaughter", "Eightteenth Great Granddaughter", + "Ninetheen Great Granddaughter", "Twentieth Great Granddaughter", ] + +sister_level = [ "", "Sister", "Aunt", "Grandaunt", "Great Grandaunt", "Second Great Grandaunt", + "Third Great Grandaunt", "Fourth Great Grandaunt", + "Fifth Great Grandaunt", "Sixth Great Grandaunt", + "Seventh Great Grandaunt", "Eighth Great Grandaunt", + "Ninth Great Grandaunt", "Tenth Great Grandaunt", + "Eleventh Great Grandaunt", "Twelefth Great Grandaunt", + "Thirteenth Great Grandaunt", "Fourteenth Great Grandaunt", + "Fifteenth Great Grandaunt", "Sixteenth Great Grandaunt", + "Seventeenth Great Grandaunt", "Eightteenth Great Grandaunt", + "Ninetheen Great Grandaunt", "Twentieth Great Grandaunt", ] + +brother_level = [ "", "Brother", "Uncle", "Granduncle", "Great Granduncle", "Second Great Granduncle", + "Third Great Granduncle", "Fourth Great Granduncle", + "Fifth Great Granduncle", "Sixth Great Granduncle", + "Seventh Great Granduncle", "Eighth Great Granduncle", + "Ninth Great Granduncle", "Tenth Great Granduncle", + "Eleventh Great Granduncle", "Twelefth Great Granduncle", + "Thirteenth Great Granduncle", "Fourteenth Great Granduncle", + "Fifteenth Great Granduncle", "Sixteenth Great Granduncle", + "Seventeenth Great Granduncle", "Eightteenth Great Granduncle", + "Ninetheen Great Granduncle", "Twentieth Great Granduncle", ] + +nephew_level = [ "", "Nephew", "Grandnephew", "Great Grandnephew", "Second Great Grandnephew", + "Third Great Grandnephew", "Fourth Great Grandnephew", + "Fifth Great Grandnephew", "Sixth Great Grandnephew", + "Seventh Great Grandnephew", "Eighth Great Grandnephew", + "Ninth Great Grandnephew", "Tenth Great Grandnephew", + "Eleventh Great Grandnephew", "Twelefth Great Grandnephew", + "Thirteenth Great Grandnephew", "Fourteenth Great Grandnephew", + "Fifteenth Great Grandnephew", "Sixteenth Great Grandnephew", + "Seventeenth Great Grandnephew", "Eightteenth Great Grandnephew", + "Ninetheen Great Grandnephew", "Twentieth Great Grandnephew", ] +niece_level = [ "", "Niece", "Grandniece", "Great Grandniece", "Second Great Grandniece", + "Third Great Grandniece", "Fourth Great Grandniece", + "Fifth Great Grandniece", "Sixth Great Grandniece", + "Seventh Great Grandniece", "Eighth Great Grandniece", + "Ninth Great Grandniece", "Tenth Great Grandniece", + "Eleventh Great Grandniece", "Twelefth Great Grandniece", + "Thirteenth Great Grandniece", "Fourteenth Great Grandniece", + "Fifteenth Great Grandniece", "Sixteenth Great Grandniece", + "Seventeenth Great Grandniece", "Eightteenth Great Grandniece", + "Ninetheen Great Grandniece", "Twentieth Great Grandniece", ] + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def filter(person,index,list,map): + if person == None: + return + list.append(person) + map[person.getId()] = index + + family = person.getMainParents() + if family != None: + filter(family.getFather(),index+1,list,map) + filter(family.getMother(),index+1,list,map) + +def get_cousin(f,s,level,removed): + return "%s cousin%s of %s" % (level_name[level],removed_level[removed],f) + +def get_father(f,s,level): + return "%s of %s" % (father_level[level],f) + +def get_son(f,s,level): + return "%s of %s" % (son_level[level],f) + +def get_mother(f,s,level): + return "%s of %s" % (mother_level[level],f) + +def get_daughter(f,s,level): + return "%s of %s" % (daughter_level[level],f) + +def get_aunt(f,s,level): + return "%s of %s" % (sister_level[level],f) + +def get_uncle(f,s,level): + return "%s of %s" % (brother_level[level],f) + +def get_nephew(f,s,level): + return "%s of %s" % (nephew_level[level],f) + +def get_niece(f,s,level): + return "%s of %s" % (niece_level[level],f) + +def get_relationship(orig_person,other_person): + firstMap = {} + firstList = [] + secondMap = {} + secondList = [] + common = [] + rank = 9999999 + + filter(orig_person,0,firstList,firstMap) + filter(other_person,0,secondList,secondMap) + + for person in firstList: + if person in secondList: + new_rank = firstMap[person.getId()] + if new_rank < rank: + rank = new_rank + common = [ person ] + elif new_rank == rank: + common.append(person) + + firstRel = -1 + secondRel = -1 + + firstName = orig_person.getPrimaryName().getRegularName() + secondName = other_person.getPrimaryName().getRegularName() + + length = len(common) + + if length == 1: + person = common[0] + secondRel = firstMap[person.getId()] + firstRel = secondMap[person.getId()] + elif length == 2: + p1 = common[0] + secondRel = firstMap[p1.getId()] + firstRel = secondMap[p1.getId()] + elif length > 2: + person = common[0] + secondRel = firstMap[person.getId()] + firstRel = secondMap[person.getId()] + + if firstRel == -1: + return "No relationship to %s" % firstName + elif firstRel == 0: + if secondRel == 0: + return firstName + elif other_person.getGender() == RelLib.Person.male: + return get_father(firstName,secondName,secondRel) + else: + return get_mother(firstName,secondName,secondRel) + elif secondRel == 0: + if other_person.getGender() == RelLib.Person.male: + return get_son(firstName,secondName,firstRel) + else: + return get_daughter(firstName,secondName,firstRel) + elif firstRel == 1: + if other_person.getGender() == RelLib.Person.male: + return get_uncle(firstName,secondName,secondRel) + else: + return get_aunt(firstName,secondName,secondRel) + elif secondRel == 1: + if other_person.getGender() == RelLib.Person.male: + return get_nephew(firstName,secondName,firstRel-1) + else: + return get_niece(firstName,secondName,firstRel-1) + else: + if secondRel > firstRel: + return get_cousin(firstName,secondName,firstRel-1,secondRel-firstRel) + else: + return get_cousin(firstName,secondName,secondRel-1,firstRel-secondRel) + diff --git a/gramps2/src/edit_person.glade b/gramps2/src/edit_person.glade index 8428e731d..cb1f96346 100644 --- a/gramps2/src/edit_person.glade +++ b/gramps2/src/edit_person.glade @@ -3417,6 +3417,7 @@ + 6 True GTK_POLICY_NEVER GTK_POLICY_ALWAYS @@ -3432,11 +3433,11 @@ GTK_JUSTIFY_LEFT GTK_WRAP_WORD True - 0 - 0 - 0 - 0 - 0 + 12 + 12 + 12 + 12 + 12 0 diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 84a1a3ffe..deaefcf02 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -2,7 +2,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allingham +# Copyright (C) 2000 Donald N. Allinghamg # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -73,6 +73,7 @@ import VersionControl import ReadXML import ListModel import GrampsXML +import Relationship try: import GrampsZODB @@ -764,6 +765,7 @@ class Gramps: self.full_update() def read_file(self,filename): + self.topWindow.set_resizable(gtk.FALSE) filename = os.path.normpath(os.path.abspath(filename)) base = os.path.basename(filename) @@ -786,7 +788,8 @@ class Gramps: self.topWindow.set_title("%s - GRAMPS" % name) else: GrampsCfg.save_last_file("") - + self.topWindow.set_resizable(gtk.TRUE) + def on_ok_button2_clicked(self,obj): filename = obj.get_filename() filename = os.path.normpath(os.path.abspath(filename)) @@ -1011,11 +1014,18 @@ class Gramps: self.edit_button.set_sensitive(val) def modify_statusbar(self): + if self.active_person == None: self.status_text("") else: - pname = GrampsCfg.nameof(self.active_person) - name = "[%s] %s" % (self.active_person.getId(),pname) + if GrampsCfg.status_bar == 0: + name = GrampsCfg.nameof(self.active_person) + elif GrampsCfg.status_bar == 1: + pname = GrampsCfg.nameof(self.active_person) + name = "[%s] %s" % (self.active_person.getId(),pname) + else: + name = Relationship.get_relationship(self.db.getDefaultPerson(), + self.active_person) self.status_text(name) return 0 @@ -1304,34 +1314,37 @@ class Gramps: self.setup_bookmarks() -# mylist = self.db.getPersonEventTypes() -# for type in mylist: -# ntype = const.display_pevent(type) -# if ntype not in const.personalEvents: -# const.personalEvents.append(ntype) -# -# mylist = self.db.getFamilyEventTypes() -# for type in mylist: -# ntype = const.display_fevent(type) -# if ntype not in const.marriageEvents: -# const.marriageEvents.append(ntype) -# -# mylist = self.db.getPersonAttributeTypes() -# for type in mylist: -# ntype = const.display_pattr(type) -# if ntype not in const.personalAttributes: -# const.personalAttributes.append(ntype) -# -# mylist = self.db.getFamilyAttributeTypes() -# for type in mylist: -# if type not in const.familyAttributes: -# const.familyAttributes.append(type) -# -# mylist = self.db.getFamilyRelationTypes() -# for type in mylist: -# if type not in const.familyRelations: -# const.familyRelations.append(type) -# + try: + mylist = self.db.getPersonEventTypes() + for type in mylist: + ntype = const.display_pevent(type) + if ntype not in const.personalEvents: + const.personalEvents.append(ntype) + + mylist = self.db.getFamilyEventTypes() + for type in mylist: + ntype = const.display_fevent(type) + if ntype not in const.marriageEvents: + const.marriageEvents.append(ntype) + + mylist = self.db.getPersonAttributeTypes() + for type in mylist: + ntype = const.display_pattr(type) + if ntype not in const.personalAttributes: + const.personalAttributes.append(ntype) + + mylist = self.db.getFamilyAttributeTypes() + for type in mylist: + if type not in const.familyAttributes: + const.familyAttributes.append(type) + + mylist = self.db.getFamilyRelationTypes() + for type in mylist: + if type not in const.familyRelations: + const.familyRelations.append(type) + except: + pass + GrampsCfg.save_last_file(name) self.gtop.get_widget("filter").set_text("") diff --git a/gramps2/src/plugins/Check.py b/gramps2/src/plugins/Check.py index df1094656..05fb77b22 100644 --- a/gramps2/src/plugins/Check.py +++ b/gramps2/src/plugins/Check.py @@ -209,7 +209,8 @@ class CheckIntegrity: title = _("Check Integrity") top = topDialog.get_widget("summary") textwindow = topDialog.get_widget("textwindow") - topDialog.get_widget("summaryTitle").set_text(title) + + Utils.set_titles(top,topDialog.get_widget("title"),title) textwindow.get_buffer().set_text(text) top.show() diff --git a/gramps2/src/plugins/Merge.py b/gramps2/src/plugins/Merge.py index e0632375d..10b2d06e5 100644 --- a/gramps2/src/plugins/Merge.py +++ b/gramps2/src/plugins/Merge.py @@ -258,11 +258,11 @@ class Merge: pn2 = self.db.getPerson(p2) MergeData.MergePeople(self.db,pn1,pn2,self.on_update) - def on_update(self,p1,p2): - self.dellist[p2] = p1 + def on_update(self,p1,p2,old_id): + self.dellist[p2.getId()] = p1.getId() for key in self.dellist.keys(): - if self.dellist[key] == p2: - self.dellist[key] = p1 + if self.dellist[key] == p2.getId(): + self.dellist[key] = p1.getId() self.redraw() def update_and_destroy(self,obj): diff --git a/gramps2/src/plugins/relcalc.glade b/gramps2/src/plugins/relcalc.glade index 67812e7b7..6a783164a 100644 --- a/gramps2/src/plugins/relcalc.glade +++ b/gramps2/src/plugins/relcalc.glade @@ -132,7 +132,7 @@ 0 - True + False True diff --git a/gramps2/src/plugins/soundex.glade b/gramps2/src/plugins/soundex.glade index cdf0982d1..8d24ef46c 100644 --- a/gramps2/src/plugins/soundex.glade +++ b/gramps2/src/plugins/soundex.glade @@ -24,20 +24,6 @@ True GTK_BUTTONBOX_END - - - True - Calculate SoundEx code for the name - True - True - gtk-apply - True - GTK_RELIEF_NORMAL - 0 - - - - True diff --git a/gramps2/src/plugins/soundgen.py b/gramps2/src/plugins/soundgen.py index de8163291..d5c6aea14 100644 --- a/gramps2/src/plugins/soundgen.py +++ b/gramps2/src/plugins/soundgen.py @@ -49,7 +49,6 @@ class SoundGen: self.glade = gtk.glade.XML(glade_file,"soundEx") self.glade.signal_autoconnect({ "destroy_passed_object" : Utils.destroy_passed_object, - "on_apply_clicked" : self.on_apply_clicked, }) Utils.set_titles(self.glade.get_widget('soundEx'), @@ -58,6 +57,9 @@ class SoundGen: self.value = self.glade.get_widget("value") self.name = self.glade.get_widget("name") + + self.name.connect('changed',self.on_apply_clicked) + names = [] for person in self.db.getPersonMap().values(): lastname = person.getPrimaryName().getSurname() diff --git a/gramps2/src/preferences.glade b/gramps2/src/preferences.glade index c13df1d43..81efab87d 100644 --- a/gramps2/src/preferences.glade +++ b/gramps2/src/preferences.glade @@ -738,7 +738,7 @@ 12 True - 7 + 8 3 False 6 @@ -870,7 +870,6 @@ True False True - tool1 @@ -893,7 +892,7 @@ False False True - tool1 + stat1 @@ -905,6 +904,29 @@ + + + + True + True + Active person's _relationship to Home Person (English only) + True + GTK_RELIEF_NORMAL + True + False + True + stat1 + + + + 1 + 3 + 7 + 8 + fill + + + 0