diff --git a/src/EditPerson.py b/src/EditPerson.py index f912ac693..c55081b83 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -921,9 +921,6 @@ class EditPerson: original record""" surname = unicode(self.surname_field.get_text()) - if GrampsCfg.capitalize: - surname = surname.upper() - self.birth.setDate(self.bdate.get_text()) self.death.setDate(self.ddate.get_text()) @@ -949,12 +946,8 @@ class EditPerson: changed = 1 if prefix != name.getSurnamePrefix(): changed = 1 - if GrampsCfg.capitalize: - if surname != name.getSurname(): - changed = 1 - else: - if surname.upper() != name.getSurname().upper(): - changed = 1 + if surname.upper() != name.getSurname().upper(): + changed = 1 if ntype != const.InverseNameTypesMap[name.getType()]: changed = 1 if given != name.getFirstName(): @@ -1316,14 +1309,9 @@ class EditPerson: if ntype != name.getType(): name.setType(ntype) - if GrampsCfg.capitalize: - if surname.upper() != name.getSurname().upper(): - name.setSurname(surname.upper()) - self.db.addSurname(surname.upper()) - else: - if surname != name.getSurname(): - name.setSurname(surname) - self.db.addSurname(surname) + if surname != name.getSurname(): + name.setSurname(surname) + self.db.addSurname(surname) if given != name.getFirstName(): name.setFirstName(given) diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 37f54f011..71089d3ac 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -89,6 +89,8 @@ _date_entry_list = [ _name_format_list = [ (_("Firstname Surname"), Utils.normal_name), (_("Surname, Firstname"), Utils.phonebook_name), + (_("Firstname SURNAME"), Utils.upper_name), + (_("SURNAME, Firstname"), Utils.phonebook_upper_name), ] panellist = [ @@ -129,6 +131,8 @@ vc_comment = 0 uncompress = 0 lastfile = None nameof = Utils.normal_name +display_name = Utils.normal_name +display_surname = lambda x : x.getSurname() status_bar = 1 toolbar = 2 calendar = 0 @@ -144,7 +148,6 @@ index_visible = 0 mediaref = 1 globalprop = 1 localprop = 1 -capitalize = 0 defaultview = 0 familyview = 0 @@ -199,6 +202,8 @@ def loadConfig(call): global index_visible global lastfile global nameof + global display_name + global display_surname global _name_format global _callback global paper_preference @@ -213,7 +218,7 @@ def loadConfig(call): global mediaref global globalprop global localprop - global capitalize +# global capitalize global defaultview global familyview @@ -229,7 +234,7 @@ def loadConfig(call): vc_comment = get_bool("/apps/gramps/use-comment") uncompress = get_bool("/apps/gramps/dont-compress-xml") id_edit = get_bool("/apps/gramps/id-edit") - capitalize = get_bool("/apps/gramps/capitalize") +# capitalize = get_bool("/apps/gramps/capitalize") index_visible = get_bool("/apps/gramps/index-visible") status_bar = get_int("/apps/gramps/statusbar") toolbar = get_int("/apps/gramps/toolbar",2) @@ -296,11 +301,15 @@ def loadConfig(call): Calendar.set_format_code(dateFormat) Calendar.Calendar.ENTRYCODE = dateEntry - if _name_format == 0: - nameof = Utils.normal_name + nameof = _name_format_list[_name_format][1] + + if _name_format%2: + display_name = Utils.phonebook_name + display_surname = lambda x : x.getSurname() else: - nameof = Utils.phonebook_name - + display_name = Utils.phonebook_upper_name + display_surname = lambda x : x.getUpperSurname() + make_path(os.path.expanduser("~/.gramps")) make_path(os.path.expanduser("~/.gramps/filters")) make_path(os.path.expanduser("~/.gramps/plugins")) @@ -554,7 +563,7 @@ class GrampsPreferences: auto = self.top.get_widget("autoload") asave_int = self.top.get_widget("autosave_interval") idedit = self.top.get_widget("gid_edit") - cap = self.top.get_widget('capitalize') +# cap = self.top.get_widget('capitalize') index_vis = self.top.get_widget("show_child_id") lds = self.top.get_widget("uselds") ac = self.top.get_widget("autocomp") @@ -582,7 +591,7 @@ class GrampsPreferences: vcom.set_active(vc_comment) compress.set_active(uncompress) idedit.set_active(id_edit) - cap.set_active(capitalize) +# cap.set_active(capitalize) index_vis.set_active(index_visible) self.top.get_widget("iprefix").set_text(iprefix) @@ -813,7 +822,7 @@ class GrampsPreferences: global vc_comment global uncompress global id_edit - global capitalize +# global capitalize global index_visible global status_bar global toolbar @@ -840,7 +849,7 @@ class GrampsPreferences: vc_comment = self.top.get_widget("vc_comment").get_active() uncompress = self.top.get_widget("uncompress").get_active() id_edit = self.top.get_widget("gid_edit").get_active() - capitalize = self.top.get_widget('capitalize').get_active() +# capitalize = self.top.get_widget('capitalize').get_active() index_visible = self.top.get_widget("show_child_id").get_active() paper_obj = self.top.get_widget("paper_size").get_menu().get_active() @@ -912,7 +921,7 @@ class GrampsPreferences: set_bool("/apps/gramps/use-comment",vc_comment) set_bool("/apps/gramps/dont-compress-xml",uncompress) set_bool("/apps/gramps/id-edit",id_edit) - set_bool("/apps/gramps/capitalize",capitalize) +# set_bool("/apps/gramps/capitalize",capitalize) set_bool("/apps/gramps/index-visible",index_visible) set_int("/apps/gramps/statusbar",status_bar) set_int("/apps/gramps/toolbar",toolbar) diff --git a/src/RelLib.py b/src/RelLib.py index eb63092a0..8e877bb82 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -38,6 +38,7 @@ import os # #------------------------------------------------------------------------- from Date import Date, SingleDate, compare_dates, not_too_old +import GrampsCfg import sort import const @@ -878,6 +879,10 @@ class Name(DataObj): """returns the surname (or last name) for the Name instance""" return self.Surname + def getUpperSurname(self): + """returns the surname (or last name) for the Name instance""" + return self.Surname.upper() + def getSuffix(self): """returns the suffix for the Name instance""" return self.Suffix @@ -905,6 +910,21 @@ class Name(DataObj): else: return "%s, %s" % (self.Surname, self.FirstName) + def getUpperName(self): + """returns a name string built from the components of the Name + instance, in the form of Surname, Firstname""" + + if self.Suffix: + if self.Prefix: + return "%s %s, %s %s" % (self.Prefix.upper(), self.Surname.upper(), self.FirstName, self.Suffix) + else: + return "%s, %s %s" % (self.Surname.upper(), self.FirstName, self.Suffix) + else: + if self.Prefix: + return "%s %s, %s" % (self.Prefix.upper(), self.Surname.upper(), self.FirstName) + else: + return "%s, %s" % (self.Surname.upper(), self.FirstName) + def getRegularName(self): """returns a name string built from the components of the Name instance, in the form of Firstname Surname""" @@ -919,6 +939,20 @@ class Name(DataObj): else: return "%s %s, %s" % (self.FirstName, self.Surname, self.Suffix) + def getRegularUpperName(self): + """returns a name string built from the components of the Name + instance, in the form of Firstname Surname""" + if (self.Suffix == ""): + if self.Prefix: + return "%s %s %s" % (self.FirstName, self.Prefix.upper(), self.Surname.upper()) + else: + return "%s %s" % (self.FirstName, self.Surname.upper()) + else: + if self.Prefix: + return "%s %s %s, %s" % (self.FirstName, self.Prefix.upper(), self.Surname.upper(), self.Suffix) + else: + return "%s %s, %s" % (self.FirstName, self.Surname.upper(), self.Suffix) + def are_equal(self,other): """compares to names to see if they are equal, return 0 if they are not""" @@ -1044,11 +1078,11 @@ class Person(Persistent): gender = const.unknown bday = self.getBirth().getDateObj() dday = self.getDeath().getDateObj() - return [ self.getPrimaryName().getName(),self.id,gender, + return [ GrampsCfg.display_name(self),self.id,gender, bday.getQuoteDate(), dday.getQuoteDate(), sort.build_sort_name(self.getPrimaryName()), sort.build_sort_date(bday),sort.build_sort_date(dday), - self.getPrimaryName().getSurname()] + GrampsCfg.display_surname(self.PrimaryName)] def setPrimaryName(self,name): """sets the primary name of the Person to the specified diff --git a/src/Utils.py b/src/Utils.py index b41735af8..991321763 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -136,6 +136,24 @@ def phonebook_name(person): else: return u'' +def phonebook_upper_name(person): + if person: + return person.getPrimaryName().getUpperName() + else: + return u'' + +def normal_name(person): + if person: + return person.getPrimaryName().getRegularName() + else: + return u'' + +def upper_name(person): + if person: + return person.getPrimaryName().getRegularUpperName() + else: + return u'' + def family_name(family): """Builds a name for the family from the parents names""" father = family.getFather() @@ -149,18 +167,21 @@ def family_name(family): else: name = mother.getPrimaryName().getName() return name - -def phonebook_from_name(name,alt): - if alt: - return "%s *" % name.getName() - else: - return name.getName() -def normal_name(person): - if person: - return person.getPrimaryName().getRegularName() +def family_upper_name(family): + """Builds a name for the family from the parents names""" + father = family.getFather() + mother = family.getMother() + if father and mother: + fname = father.getPrimaryName().getUpperName() + mname = mother.getPrimaryName().getUpperName() + name = _("%s and %s") % (fname,mname) + elif father: + name = father.getPrimaryName().getUpperName() else: - return u'' + name = mother.getPrimaryName().getUpperName() + return name + #------------------------------------------------------------------------- # diff --git a/src/preferences.glade b/src/preferences.glade index dbfed3a43..a3b9c065f 100644 --- a/src/preferences.glade +++ b/src/preferences.glade @@ -225,7 +225,7 @@ 12 True - 6 + 5 4 False 6 @@ -252,8 +252,8 @@ 1 2 - 4 - 5 + 3 + 4 fill @@ -274,8 +274,8 @@ 2 3 - 4 - 5 + 3 + 4 @@ -301,8 +301,8 @@ 1 2 - 5 - 6 + 4 + 5 fill @@ -325,8 +325,8 @@ 3 4 - 4 - 5 + 3 + 4 fill @@ -384,29 +384,8 @@ 2 4 - 5 - 6 - - - - - - - True - True - _Capitalize family names - True - GTK_RELIEF_NORMAL - False - False - True - - - 1 - 4 - 3 - 4 - fill + 4 + 5