From 63d7153857bc0648461189d24a7699b8280256c0 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 1 Jan 2005 04:27:15 +0000 Subject: [PATCH] * src/gramps.glade: remove name display options * src/GrampsCfg.py: remove name displaying functions * src/Makefile.am: add NameDisplay.py to list * src/NameDisplay.py: New name displaying class * src/Utils.py: use new NameDisplay class * src/AddSpouse.py: use new NameDisplay class * src/AddrEdit.py: use new NameDisplay class * src/Bookmarks.py: use new NameDisplay class * src/ChooseParents.py: use new NameDisplay class * src/DisplayModels.py: use new NameDisplay class * src/EditPerson.py: use new NameDisplay class * src/EditPlace.py: use new NameDisplay class * src/EditSource.py: use new NameDisplay class * src/FamilyView.py: use new NameDisplay class * src/GenericFilter.py: use new NameDisplay class * src/ImageSelect.py: use new NameDisplay class * src/Marriage.py: use new NameDisplay class * src/MergeData.py: use new NameDisplay class * src/NameEdit.py: use new NameDisplay class * src/PedView.py: use new NameDisplay class * src/PeopleModel.py: use new NameDisplay class * src/ReadGedcom.py: use new NameDisplay class * src/Report.py: use new NameDisplay class * src/SelectChild.py: use new NameDisplay class * src/SubstKeywords.py: use new NameDisplay class * src/Witness.py: use new NameDisplay class * src/WriteGedcom.py: use new NameDisplay class * src/gramps_main.py: use new NameDisplay class * src/plugins/Desbrowser.py: use new NameDisplay class * src/plugins/Merge.py: use new NameDisplay class * src/plugins/RelCalc.py: use new NameDisplay class svn: r3852 --- gramps2/ChangeLog | 33 ++++++++++++++++++++++ gramps2/src/AddSpouse.py | 9 +++--- gramps2/src/AddrEdit.py | 3 +- gramps2/src/Bookmarks.py | 11 ++++---- gramps2/src/ChooseParents.py | 13 +++++---- gramps2/src/DisplayModels.py | 15 ++++++++-- gramps2/src/EditPerson.py | 35 ++++++++++++----------- gramps2/src/EditPlace.py | 12 ++++---- gramps2/src/EditSource.py | 12 ++++---- gramps2/src/FamilyView.py | 25 ++++++++-------- gramps2/src/GenericFilter.py | 4 ++- gramps2/src/GrampsCfg.py | 30 -------------------- gramps2/src/ImageSelect.py | 10 +++++-- gramps2/src/Makefile.am | 1 + gramps2/src/Marriage.py | 24 ++++++++-------- gramps2/src/MergeData.py | 24 ++++++++-------- gramps2/src/NameEdit.py | 3 +- gramps2/src/PedView.py | 21 +++++++------- gramps2/src/PeopleModel.py | 5 ++-- gramps2/src/ReadGedcom.py | 2 +- gramps2/src/Report.py | 8 ++++-- gramps2/src/SelectChild.py | 16 ++++++----- gramps2/src/SubstKeywords.py | 14 +++++---- gramps2/src/Utils.py | 32 ++++----------------- gramps2/src/Witness.py | 3 +- gramps2/src/WriteGedcom.py | 8 ++++-- gramps2/src/gramps.glade | 47 ------------------------------- gramps2/src/gramps_main.py | 18 ++++++------ gramps2/src/plugins/Desbrowser.py | 4 +-- gramps2/src/plugins/Merge.py | 4 +-- gramps2/src/plugins/RelCalc.py | 6 ++-- 31 files changed, 216 insertions(+), 236 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index ba94a82a0..71cf51e8a 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,36 @@ +2004-12-31 Don Allingham + * src/gramps.glade: remove name display options + * src/GrampsCfg.py: remove name displaying functions + * src/Makefile.am: add NameDisplay.py to list + * src/NameDisplay.py: New name displaying class + * src/Utils.py: use new NameDisplay class + * src/AddSpouse.py: use new NameDisplay class + * src/AddrEdit.py: use new NameDisplay class + * src/Bookmarks.py: use new NameDisplay class + * src/ChooseParents.py: use new NameDisplay class + * src/DisplayModels.py: use new NameDisplay class + * src/EditPerson.py: use new NameDisplay class + * src/EditPlace.py: use new NameDisplay class + * src/EditSource.py: use new NameDisplay class + * src/FamilyView.py: use new NameDisplay class + * src/GenericFilter.py: use new NameDisplay class + * src/ImageSelect.py: use new NameDisplay class + * src/Marriage.py: use new NameDisplay class + * src/MergeData.py: use new NameDisplay class + * src/NameEdit.py: use new NameDisplay class + * src/PedView.py: use new NameDisplay class + * src/PeopleModel.py: use new NameDisplay class + * src/ReadGedcom.py: use new NameDisplay class + * src/Report.py: use new NameDisplay class + * src/SelectChild.py: use new NameDisplay class + * src/SubstKeywords.py: use new NameDisplay class + * src/Witness.py: use new NameDisplay class + * src/WriteGedcom.py: use new NameDisplay class + * src/gramps_main.py: use new NameDisplay class + * src/plugins/Desbrowser.py: use new NameDisplay class + * src/plugins/Merge.py: use new NameDisplay class + * src/plugins/RelCalc.py: use new NameDisplay class + 2004-12-31 Alex Roitman * src/RelLib.py (Family.set_mother_handle): Typo. * src/Report.py: Use gen and pagebbg. diff --git a/gramps2/src/AddSpouse.py b/gramps2/src/AddSpouse.py index af099a852..ac358e0fa 100644 --- a/gramps2/src/AddSpouse.py +++ b/gramps2/src/AddSpouse.py @@ -51,10 +51,10 @@ import gnome import RelLib import const import Utils -import GrampsCfg import PeopleModel import Date import Marriage +import NameDisplay #------------------------------------------------------------------------- # @@ -122,8 +122,9 @@ class AddSpouse: self.ok = self.glade.get_widget('spouse_ok') self.ok.set_sensitive(0) - - title = _("Choose Spouse/Partner of %s") % GrampsCfg.get_nameof()(person) + + name = NameDisplay.displayer.display(person) + title = _("Choose Spouse/Partner of %s") % name Utils.set_titles(self.glade.get_widget('spouseDialog'), self.glade.get_widget('title'),title, @@ -213,7 +214,7 @@ class AddSpouse: trans = self.db.transaction_begin() handle = self.db.add_person(person,trans) - n = person.get_primary_name().get_name() + n = NameDisplay.displayer.display(person) self.db.transaction_commit(trans,_('Add Person (%s)' % n)) self.addperson(person) self.update_data(handle) diff --git a/gramps2/src/AddrEdit.py b/gramps2/src/AddrEdit.py index 00b41cebf..18d4d8b5a 100644 --- a/gramps2/src/AddrEdit.py +++ b/gramps2/src/AddrEdit.py @@ -51,6 +51,7 @@ import Date import RelLib import Sources import DateEdit +import NameDisplay #------------------------------------------------------------------------- # @@ -82,7 +83,7 @@ class AddressEditor: self.addr = addr self.callback = callback self.child_windows = {} - name = parent.person.get_primary_name().get_name() + name = NameDisplay.displayer.display(person) if name == ", ": text = _("Address Editor") else: diff --git a/gramps2/src/Bookmarks.py b/gramps2/src/Bookmarks.py index d5c01679d..ccc2513f8 100644 --- a/gramps2/src/Bookmarks.py +++ b/gramps2/src/Bookmarks.py @@ -39,6 +39,7 @@ import gnome # #------------------------------------------------------------------------- from gettext import gettext as _ +import NameDisplay #------------------------------------------------------------------------- # @@ -82,9 +83,9 @@ class Bookmarks : def add_to_menu(self,person_handle): """adds a person's name to the drop down menu""" - data = self.db.person_map.get(str(person_handle)) - if data: - name = data[3].get_name() + person = self.db.get_person_from_handle(person_handle) + if person: + name = NameDisplay.displayer.display(person) item = gtk.MenuItem(name) item.connect("activate", self.callback, person_handle) item.show() @@ -143,8 +144,8 @@ class Bookmarks : self.draw_window() index = 0 for person_handle in self.bookmarks: - data = self.db.person_map.get(str(person_handle)) - name = data[3].get_name() + person = self.db.get_person_from_handle(person_handle) + name = NameDisplay.displayer.display(person) self.namelist.append([name]) self.namelist.set_row_data(index,person_handle) index = index + 1 diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index 3967271d7..669ee4828 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -52,8 +52,8 @@ import gnome import RelLib import const import Utils -import GrampsCfg import PeopleModel +import NameDisplay from QuestionDialog import ErrorDialog #------------------------------------------------------------------------- @@ -117,8 +117,8 @@ class ChooseParents: self.glade = gtk.glade.XML(const.gladeFile,"familyDialog","gramps") self.top = self.glade.get_widget("familyDialog") - self.title_text = _("Choose the Parents of %s") % \ - GrampsCfg.get_nameof()(self.person) + name = NameDisplay.displayer.display(self.person) + self.title_text = _("Choose the Parents of %s") % name Utils.set_titles(self.top,self.glade.get_widget('title'), self.title_text,_('Choose Parents')) @@ -643,7 +643,8 @@ class ModifyParents: self.top = self.glade.get_widget("modparents") self.title = self.glade.get_widget("title") - title = _("Modify the Parents of %s") % GrampsCfg.get_nameof()(self.person) + name = NameDisplay.displayer.display(self.person) + title = _("Modify the Parents of %s") % name Utils.set_titles(self.top, self.title, title, _("Modify Parents")) self.mother_rel = self.glade.get_widget("mrel") @@ -676,13 +677,13 @@ class ModifyParents: if self.father: - fname = self.father.get_primary_name().get_name() + fname = NameDisplay.displayer.display(self.father) self.glade.get_widget("fname").set_text(fname) else: self.father_rel.set_sensitive(0) if self.mother: - mname = self.mother.get_primary_name().get_name() + mname = NameDisplay.displayer.display(self.mother) self.glade.get_widget("mname").set_text(mname) else: self.mother_rel.set_sensitive(0) diff --git a/gramps2/src/DisplayModels.py b/gramps2/src/DisplayModels.py index f79033726..71885b5c8 100644 --- a/gramps2/src/DisplayModels.py +++ b/gramps2/src/DisplayModels.py @@ -18,7 +18,13 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +#------------------------------------------------------------------------- +# +# python modules +# +#------------------------------------------------------------------------- import time +from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -28,7 +34,12 @@ import time import gobject import gtk -from gettext import gettext as _ +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +import NameDisplay _GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ] @@ -160,7 +171,7 @@ class ChildModel(gtk.ListStore): child = db.get_person_from_handle(child_handle) self.append(row=[index, child.get_gramps_id(), - child.get_primary_name().get_name(), + NameDisplay.displayer.display(child), _GENDER[child.get_gender()], self.column_birth_day(child), self.column_death_day(child), diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index 722edd02f..50644cdb3 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -60,6 +60,7 @@ import DateEdit import Date import DateHandler import TransTable +import NameDisplay from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog @@ -120,6 +121,7 @@ class EditPerson: self.update_death = False self.pdmap = {} self.add_places = [] + self.name_display = NameDisplay.displayer self.should_guess_gender = (person.get_gramps_id() == '' and person.get_gender () == RelLib.Person.unknown) @@ -548,7 +550,7 @@ class EditPerson: def add_itself_to_winsmenu(self): self.parent.child_windows[self.orig_handle] = self - win_menu_label = GrampsCfg.get_nameof()(self.person) + win_menu_label = self.name_display.display(self.person) if not win_menu_label.strip(): win_menu_label = _("New Person") self.win_menu_item = gtk.MenuItem(win_menu_label) @@ -663,12 +665,12 @@ class EditPerson: m = self.db.get_person_from_handle(m_id) if f and m: name = _("%(father)s and %(mother)s") % { - 'father' : GrampsCfg.get_nameof()(f), - 'mother' : GrampsCfg.get_nameof()(m) } + 'father' : self.name_display.display(f), + 'mother' : self.name_display.display(m) } elif f: - name = GrampsCfg.get_nameof()(f) + name = self.name_display.display(f) elif m: - name = GrampsCfg.get_nameof()(m) + name = self.name_display.display(m) else: name = _("unknown") item = gtk.MenuItem(name) @@ -1027,13 +1029,13 @@ class EditPerson: def on_add_url_clicked(self,obj): """Invokes the url editor to add a new name""" import UrlEdit - pname = self.person.get_primary_name().get_name() + pname = self.name_display.display(self.person) UrlEdit.UrlEditor(self,pname,None,self.url_edit_callback,self.window) def on_add_attr_clicked(self,obj): """Brings up the AttributeEditor for a new attribute""" import AttrEdit - pname = self.person.get_primary_name().get_name() + pname = self.name_display.display(self.person) AttrEdit.AttributeEditor(self,None,pname,const.personalAttributes, self.attr_edit_callback,self.window) @@ -1054,9 +1056,10 @@ class EditPerson: def on_event_add_clicked(self,obj): """Brings up the EventEditor for a new event""" import EventEdit - pname = self.person.get_primary_name().get_name() + pname = self.name_display.display(self.person) EventEdit.EventEditor(self,pname,const.personalEvents, - const.personal_events,None,None,0,self.event_edit_callback) + const.personal_events,None,None,0, + self.event_edit_callback) def on_edit_birth_clicked(self,obj): """Brings up the EventEditor for the birth record, event @@ -1064,7 +1067,7 @@ class EditPerson: import EventEdit self.update_birth = True - pname = self.person.get_primary_name().get_name() + pname = self.name_display.display(self.person) event = self.birth event.set_date_object(Date.Date(self.birth_date_object)) def_placename = unicode(self.bplace.get_text()) @@ -1082,7 +1085,7 @@ class EditPerson: import EventEdit self.update_death = True - pname = self.person.get_primary_name().get_name() + pname = self.name_display.display(self.person) event = self.death event.set_date_object(Date.Date(self.death_date_object)) def_placename = unicode(self.dplace.get_text()) @@ -1310,7 +1313,7 @@ class EditPerson: store,node = self.atree.get_selected() if node: attr = self.atree.get_object(node) - pname = self.person.get_primary_name().get_name() + pname = self.name_display.display(self.person) AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes, self.attr_edit_callback,self.window) @@ -1325,7 +1328,7 @@ class EditPerson: import UrlEdit store,node = self.wtree.get_selected() if node: - pname = self.person.get_primary_name().get_name() + pname = self.name_display.display(self.person) url = self.wtree.get_object(node) UrlEdit.UrlEditor(self,pname,url,self.url_edit_callback,self.window) @@ -1335,7 +1338,7 @@ class EditPerson: store,node = self.etree.get_selected() if not node: return - pname = self.person.get_primary_name().get_name() + pname = self.name_display.display(self.person) event = self.etree.get_object(node) EventEdit.EventEditor(self,pname,const.personalEvents, const.personal_events,event,None,0, @@ -1556,7 +1559,7 @@ class EditPerson: if not person: self.person.set_gramps_id(idval) else: - n = GrampsCfg.get_nameof()(person) + n = self.name_display.display(person) msg1 = _("GRAMPS ID value was not changed.") msg2 = _("You have attempted to change the GRAMPS ID to a value " "of %(grampsid)s. This value is already used by %(person)s.") % { @@ -1860,7 +1863,7 @@ class EditPerson: def write_primary_name(self): # initial values - name = '%s' % GrampsCfg.get_nameof()(self.person) + name = '%s' % self.name_display.display(self.person) self.get_widget("activepersonTitle").set_text(name) self.get_widget("activepersonTitle").set_use_markup(gtk.TRUE) self.suffix.set_text(self.pname.get_suffix()) diff --git a/gramps2/src/EditPlace.py b/gramps2/src/EditPlace.py index f0180266e..6a61cec28 100644 --- a/gramps2/src/EditPlace.py +++ b/gramps2/src/EditPlace.py @@ -47,6 +47,7 @@ import Utils import GrampsCfg import Sources import ImageSelect +import NameDisplay from gettext import gettext as _ @@ -74,6 +75,7 @@ class EditPlace: self.win_key = place.get_handle() else: self.win_key = self + self.name_display = NameDisplay.displayer.display self.place = place self.db = parent.db self.child_windows = {} @@ -501,7 +503,7 @@ class EditPlace: t = _("%s [%s]: event %s\n") for e in pevent: - msg = msg + ( t % (GrampsCfg.get_nameof()(e[0]),e[0].get_handle(),_(e[1].get_name()))) + msg = msg + ( t % (self.name_display(e[0]),e[0].get_handle(),_(e[1].get_name()))) if len(fevent) > 0: any = 1 @@ -514,12 +516,12 @@ class EditPlace: mother = e[0].get_mother_handle() if father and mother: fname = _("%(father)s and %(mother)s") % { - "father" : GrampsCfg.get_nameof()(father), - "mother" : GrampsCfg.get_nameof()(mother) } + "father" : self.name_display(father), + "mother" : self.name_display(mother) } elif father: - fname = "%s" % GrampsCfg.get_nameof()(father) + fname = self.name_display(father) else: - fname = "%s" % GrampsCfg.get_nameof()(mother) + fname = self.name_display(mother) msg = msg + ( t % (fname,e[0].get_handle(),_(e[1].get_name()))) diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index 94af5dab9..6746bece1 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -39,6 +39,7 @@ import GrampsCfg import ImageSelect import ListModel import RelLib +import NameDisplay from gettext import gettext as _ @@ -57,6 +58,7 @@ class EditSource: self.source = RelLib.Source() self.db = db self.parent = parent + self.name_display = NameDisplay.displayer.display if source: if self.parent.child_windows.has_key(source.get_handle()): self.parent.child_windows[source.get_handle()].present(None) @@ -248,7 +250,7 @@ class EditSource: p_list.append(name) for key in self.db.get_person_handles(sort_handles=False): p = self.db.get_person_from_handle(key) - name = GrampsCfg.get_nameof()(p) + name = self.name_display(p) for event_handle in p.get_event_list() + [p.get_birth_handle(), p.get_death_handle()]: if event_handle: event = self.db.get_event_from_handle(event_handle) @@ -283,12 +285,12 @@ class EditSource: m = self.db.get_person_from_handle(m_id) if f_id and m_id: name = _("%(father)s and %(mother)s") % { - "father" : GrampsCfg.get_nameof()(f), - "mother" : GrampsCfg.get_nameof()(m)} + "father" : self.name_display(f), + "mother" : self.name_display(m)} elif f_id: - name = GrampsCfg.get_nameof()(f) + name = self.name_display(f) else: - name = GrampsCfg.get_nameof()(m) + name = self.name_display(m) for v_id in p.get_event_list(): v = self.db.get_event_from_handle(v_id) if not v: diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index 12007d131..a6917e70b 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -47,6 +47,7 @@ import RelLib import EditPerson import DateHandler import DisplayModels +import NameDisplay from gettext import gettext as _ from QuestionDialog import QuestionDialog,WarningDialog @@ -808,8 +809,8 @@ class FamilyView: def remove_spouse(self,obj): if self.selected_spouse: - nap = GrampsCfg.get_nameof()(self.person) - nsp = GrampsCfg.get_nameof()(self.selected_spouse) + nap = NameDisplay.displayer.display(self.person) + nsp = NameDisplay.displayer.display(self.selected_spouse) QuestionDialog(_('Remove %s as a spouse of %s?') % (nsp,nap), _('Removing a spouse removes the relationship between ' 'the spouse and the active person. It does not ' @@ -897,7 +898,7 @@ class FamilyView: person = self.parent.db.get_person_from_handle(person_handle) self.parent.change_active_person(person) - n = person.get_primary_name().get_name() + n = NameDisplay.displayer.display(person) trans = self.parent.db.transaction_begin() self.parent.db.commit_family(family,trans) self.parent.db.transaction_commit(trans,_("Select Parents (%s)") % n) @@ -926,22 +927,22 @@ class FamilyView: if bd and dd: n = "%s [%s]\n\t%s %s\n\t%s %s " % ( - GrampsCfg.get_nameof()(self.person), + NameDisplay.displayer.display(self.person), self.person.get_gramps_id(), _BORN,DateHandler.displayer.display(bd.get_date_object()), _DIED,DateHandler.displayer.display(dd.get_date_object())) elif bd: n = "%s [%s]\n\t%s %s" % ( - GrampsCfg.get_nameof()(self.person), + NameDisplay.displayer.display(self.person), self.person.get_gramps_id(), _BORN,DateHandler.displayer.display(bd.get_date_object())) elif dd: n = "%s [%s]\n\t%s %s" % ( - GrampsCfg.get_nameof()(self.person), + NameDisplay.displayer.display(self.person), self.person.get_gramps_id(), _DIED,DateHandler.displayer.display(dd.get_date_object())) else: - n = "%s [%s]" % (GrampsCfg.get_nameof()(self.person), + n = "%s [%s]" % (NameDisplay.displayer.display(self.person), self.person.get_gramps_id()) self.ap_model.clear() @@ -982,7 +983,7 @@ class FamilyView: else: mdate = "" v = "%s [%s]\n\t%s%s" % ( - GrampsCfg.get_nameof()(sp), + NameDisplay.displayer.display(sp), sp.get_gramps_id(), const.family_relations[fm.get_relationship()][0], mdate) self.spouse_model.set(node,0,v) @@ -1042,7 +1043,7 @@ class FamilyView: def nameof(self,l,p,mode): if p: - n = GrampsCfg.get_nameof()(p) + n = NameDisplay.displayer.display(p) pid = p.get_gramps_id() return _("%s: %s [%s]\n\tRelationship: %s") % (l,n,pid,_(mode)) else: @@ -1058,7 +1059,7 @@ class FamilyView: self.family = self.parent.db.get_family_from_handle(flist[0]) else: self.family = None - n = person.get_primary_name().get_name() + n = NameDisplay.display.displayer(person) self.parent.db.transaction_commit(trans,_("Remove from family (%s)") % n) def display_marriage(self,family): @@ -1221,7 +1222,7 @@ class FamilyView: def del_parents_clicked(self,obj): if len(self.person.get_parent_family_handle_list()) == 0: return - n = GrampsCfg.get_nameof()(self.person) + n = NameDisplay.displayer.display(self.person) QuestionDialog(_('Remove Parents of %s') % n, _('Removing the parents of a person removes the person as a ' 'child of the parents. The parents are not removed from the ' @@ -1236,7 +1237,7 @@ class FamilyView: def del_sp_parents(self,obj): if not self.selected_spouse or len(self.selected_spouse.get_parent_family_handle_list()) == 0: return - n = GrampsCfg.get_nameof()(self.selected_spouse) + n = NameDisplay.displayer.display(self.selected_spouse) QuestionDialog(_('Remove Parents of %s') % n, _('Removing the parents of a person removes the person as a ' 'child of the parents. The parents are not removed from the ' diff --git a/gramps2/src/GenericFilter.py b/gramps2/src/GenericFilter.py index 526ebf02b..fc2873362 100644 --- a/gramps2/src/GenericFilter.py +++ b/gramps2/src/GenericFilter.py @@ -49,6 +49,7 @@ import const import RelLib import Date import DateHandler +import NameDisplay from TransTable import TransTable from gettext import gettext as _ from Utils import for_each_ancestor @@ -1330,7 +1331,8 @@ class SearchName(Rule): def apply(self,db,p_id): self.f = self.list[0] p = db.get_person_from_handle(p_id) - return self.f and string.find(p.get_primary_name().get_name().upper(),self.f.upper()) != -1 + n = NameDisplay.displayer.display(p) + return self.f and string.find(n.upper(),self.f.upper()) != -1 #------------------------------------------------------------------------- # diff --git a/gramps2/src/GrampsCfg.py b/gramps2/src/GrampsCfg.py index 173882d34..01b65a790 100644 --- a/gramps2/src/GrampsCfg.py +++ b/gramps2/src/GrampsCfg.py @@ -67,13 +67,6 @@ _surname_styles = [ _("Icelandic style"), ] -_name_format_list = [ - (_("Firstname Surname"), Utils.normal_name, Utils.phonebook_name, lambda x: x.get_surname()), - (_("Surname, Firstname"), Utils.phonebook_name, Utils.phonebook_name, lambda x: x.get_surname()), - (_("Firstname SURNAME"), Utils.upper_name, Utils.phonebook_upper_name, lambda x : x.get_upper_surname()), - (_("SURNAME, Firstname"), Utils.phonebook_upper_name, Utils.phonebook_upper_name, lambda x: x.get_upper_surname()), - ] - panellist = [ (_("Display"), [( _("General"), 3), @@ -87,14 +80,6 @@ panellist = [ # Not exactly gconf keys, but the functions directly dependent on them -def get_nameof(): - return _name_format_list[GrampsGconfKeys.get_name_format(_name_format_list)][1] - -def get_display_name(): - return _name_format_list[GrampsGconfKeys.get_name_format(_name_format_list)][2] - -def get_display_surname(): - return _name_format_list[GrampsGconfKeys.get_name_format(_name_format_list)][3] def get_toolbar_style(): saved_toolbar = GrampsGconfKeys.get_toolbar() @@ -312,21 +297,6 @@ class GrampsPreferences: GrampsGconfKeys.save_date_format(obj.get_menu().get_active().get_data(INDEX),dlist) ) - name_option = self.top.get_widget("name_format") - name_menu = gtk.Menu() - for index in range(0,len(_name_format_list)): - name_tuple = _name_format_list[index] - item = gtk.MenuItem(name_tuple[0]) - item.set_data(INDEX,index) - item.show() - name_menu.append(item) - name_menu.set_active(GrampsGconfKeys.get_name_format(_name_format_list)) - name_option.set_menu(name_menu) - name_option.connect("changed", - lambda obj: - GrampsGconfKeys.save_name_format(obj.get_menu().get_active().get_data(INDEX),_name_format_list) - ) - resname = self.top.get_widget("resname") resname.set_text(GrampsGconfKeys.get_researcher_name()) resname.connect('changed', diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index 03b724dc8..a552b64c3 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -49,7 +49,7 @@ import gtk.glade import const import Utils import GrampsGconfKeys -import GrampsCfg +import NameDisplay import Plugins import RelLib import RelImage @@ -1092,13 +1092,17 @@ class GlobalMediaProperties: p = self.db.get_person_from_handle(key) for o in p.get_media_list(): if o.get_reference_handle() == self.obj.get_handle(): - self.refmodel.add([_("Person"),p.get_gramps_id(),GrampsCfg.get_nameof()(p)]) + self.refmodel.add([_("Person"), + p.get_gramps_id(), + NameDisplay.displayer.display(p)]) any = 1 for key in self.db.get_family_handles(): p = self.db.get_family_from_handle(key) for o in p.get_media_list(): if o.get_reference_handle() == self.obj.get_handle(): - self.refmodel.add([_("Family"),p.get_gramps_id(),Utils.family_name(p,self.db)]) + self.refmodel.add([_("Family"), + p.get_gramps_id(), + Utils.family_name(p,self.db)]) any = 1 for key in self.db.get_source_handles(): p = self.db.get_source_from_handle(key) diff --git a/gramps2/src/Makefile.am b/gramps2/src/Makefile.am index a5b7519ef..873c8b509 100644 --- a/gramps2/src/Makefile.am +++ b/gramps2/src/Makefile.am @@ -69,6 +69,7 @@ gdir_PYTHON = \ Marriage.py\ MediaView.py\ MergeData.py\ + NameDisplay.py\ NameEdit.py\ NoteEdit.py\ PaperMenu.py\ diff --git a/gramps2/src/Marriage.py b/gramps2/src/Marriage.py index 091d5f9cf..538670abe 100644 --- a/gramps2/src/Marriage.py +++ b/gramps2/src/Marriage.py @@ -40,7 +40,6 @@ import gnome #------------------------------------------------------------------------- import const -import GrampsCfg import Utils import AutoComp import ListModel @@ -49,6 +48,7 @@ import ImageSelect import DateHandler import Sources import GrampsGconfKeys +import NameDisplay from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog from gettext import gettext as _ @@ -137,8 +137,8 @@ class Marriage: father = self.db.get_person_from_handle(fid) mother = self.db.get_person_from_handle(mid) - self.title = _("%s and %s") % (GrampsCfg.get_nameof()(father), - GrampsCfg.get_nameof()(mother)) + self.title = _("%s and %s") % (NameDisplay.displayer.display(father), + NameDisplay.displayer.display(mother)) Utils.set_title_label(self.top,self.title) @@ -734,12 +734,13 @@ class Marriage: father = self.db.get_person_from_handle(father_handle) mother = self.db.get_person_from_handle(mother_handle) if father and mother: - name = _("%s and %s") % (father.get_primary_name().get_name(), - mother.get_primary_name().get_name()) + name = _("%s and %s") % ( + NameDisplay.displayer.display(father), + NameDisplay.displayer.display(mother)) elif father: - name = father.get_primary_name().get_name() + name = NameDisplay.displayer.display(father) else: - name = mother.get_primary_name().get_name() + name = NameDisplay.displayer.display(mother) AttrEdit.AttributeEditor(self,attr,name,const.familyAttributes, self.attr_edit_callback) @@ -755,12 +756,13 @@ class Marriage: father = self.db.get_person_from_handle(father_handle) mother = self.db.get_person_from_handle(mother_handle) if father and mother: - name = _("%s and %s") % (father.get_primary_name().get_name(), - mother.get_primary_name().get_name()) + name = _("%s and %s") % ( + NameDisplay.displayer.display(father), + NameDisplay.displayer.display(mother)) elif father: - name = father.get_primary_name().get_name() + name = NameDisplay.displayer.display(father) else: - name = mother.get_primary_name().get_name() + name = NameDisplay.displayer.display(mother) AttrEdit.AttributeEditor(self,None,name,const.familyAttributes, self.attr_edit_callback) diff --git a/gramps2/src/MergeData.py b/gramps2/src/MergeData.py index f1613684a..af1b39edf 100644 --- a/gramps2/src/MergeData.py +++ b/gramps2/src/MergeData.py @@ -41,8 +41,8 @@ import gtk.glade #------------------------------------------------------------------------- import RelLib import Utils -import GrampsCfg import ListModel +import NameDisplay import const from gettext import gettext as _ @@ -77,8 +77,8 @@ class MergePeople: "destroy_passed_object" : Utils.destroy_passed_object, }) - fname = GrampsCfg.get_nameof()(person1) - mname = GrampsCfg.get_nameof()(person2) + fname = NameDisplay.displayer.display(person1) + mname = NameDisplay.displayer.display(person2) Utils.set_titles(self.top, self.glade.get_widget('title'), _("Merge %s and %s") % (fname,mname), @@ -87,13 +87,13 @@ class MergePeople: f1 = person1.get_main_parents_family_handle() f2 = person2.get_main_parents_family_handle() - name1 = GrampsCfg.get_nameof()(person1) + name1 = NameDisplay.displayer.display(person1) death1 = person1.get_death().get_date() dplace1 = self.place_name(person1.get_death()) birth1 = person1.get_birth().get_date() bplace1 = self.place_name(person1.get_birth()) - name2 = GrampsCfg.get_nameof()(person2) + name2 = NameDisplay.displayer.display(person2) death2 = person2.get_death().get_date() dplace2 = self.place_name(person2.get_death()) birth2 = person2.get_birth().get_date() @@ -193,7 +193,7 @@ class MergePeople: if spouse == None: name = "unknown" else: - sname = GrampsCfg.get_nameof()(spouse) + sname = NameDisplay.displayer.display(spouse) name = "%s [%s]" % (sname,spouse.get_handle()) widget.add([name]) @@ -361,7 +361,7 @@ class MergePeople: self.db.remove_person(self.p2.get_handle()) self.db.personMap[self.p1.get_handle()] = self.p1 except: - print "%s is not in the person map!" % (GrampsCfg.get_nameof()(self.p2)) + print "%s is not in the person map!" % (NameDisplay.displayer.display(self.p2)) self.update(self.p1,self.p2,old_id) Utils.destroy_passed_object(self.top) @@ -594,8 +594,8 @@ def compare_people(p1,p2): if father1 == father2: chance = chance + 1.0 else: - fname1 = GrampsCfg.get_nameof()(father1) - fname2 = GrampsCfg.get_nameof()(father2) + fname1 = NameDisplay.displayer.display(father1) + fname2 = NameDisplay.displayer.display(father2) value = name_match(fname1,fname2) if value != -1.0: chance = chance + value @@ -606,8 +606,8 @@ def compare_people(p1,p2): if mother1 == mother2: chance = chance + 1.0 else: - mname1 = GrampsCfg.get_nameof()(mother1) - mname2 = GrampsCfg.get_nameof()(mother2) + mname1 = NameDisplay.displayer.display(mother1) + mname2 = NameDisplay.displayer.display(mother2) value = name_match(mname1,mname2) if value != -1.0: chance = chance + value @@ -814,7 +814,7 @@ def ancestors_of(p1,lst): def name_of(p): if not p: return "" - return "%s (%s)" % (GrampsCfg.get_nameof()(p),p.get_handle()) + return "%s (%s)" % (NameDisplay.displayer.display(p),p.get_handle()) #------------------------------------------------------------------------- # diff --git a/gramps2/src/NameEdit.py b/gramps2/src/NameEdit.py index 34d5a54c4..c03835e6b 100644 --- a/gramps2/src/NameEdit.py +++ b/gramps2/src/NameEdit.py @@ -38,6 +38,7 @@ import Utils import AutoComp import Sources import RelLib +import NameDisplay from gettext import gettext as _ @@ -96,7 +97,7 @@ class NameEditor: else: self.srcreflist = [] - full_name = parent.person.get_primary_name().get_name() + full_name = NameDisplay.displayer.display(parent) alt_title = self.top.get_widget("title") diff --git a/gramps2/src/PedView.py b/gramps2/src/PedView.py index c648739a5..658d5cc1d 100644 --- a/gramps2/src/PedView.py +++ b/gramps2/src/PedView.py @@ -38,6 +38,7 @@ import pango import GrampsCfg from gettext import gettext as _ import Relationship +import NameDisplay _PAD = 3 _CANVASPAD = 3 @@ -70,7 +71,7 @@ class DispBox: self.person = person self.root = root - self.name = GrampsCfg.get_nameof()(person) + self.name = NameDisplay.displayer.display(person) birth_handle = self.person.get_birth_handle() death_handle = self.person.get_death_handle() if birth_handle: @@ -232,7 +233,7 @@ class PedigreeView: else: death = u"" - for n in [GrampsCfg.get_nameof()(t[0]), u'%s %s' % (_BORN,birth), + for n in [NameDisplay.displayer.display(t[0]), u'%s %s' % (_BORN,birth), u'%s %s' % (_DIED,death)]: try: a.set_text(n,len(n)) @@ -382,7 +383,7 @@ class PedigreeView: myMenu = gtk.Menu() for child_handle in childlist: child = self.parent.db.get_person_from_handle(child_handle) - cname = GrampsCfg.get_nameof()(child) + cname = NameDisplay.displayer.display(child) menuitem = gtk.MenuItem(None) if find_children(self.parent.db,child): label = gtk.Label('%s' % cname) @@ -474,7 +475,7 @@ class PedigreeView: elif event.type == gtk.gdk.ENTER_NOTIFY: obj.set(fill_color_gdk=style.bg[gtk.STATE_SELECTED], width_pixels=4) - name = GrampsCfg.get_nameof()(person) + name = NameDisplay.displayer.display(person) msg = _("Double clicking will make %s the active person") % name self.sb.set_status(msg) elif event.type == gtk.gdk.LEAVE_NOTIFY: @@ -594,7 +595,7 @@ class PedigreeView: item.set_submenu(gtk.Menu()) sp_menu = item.get_submenu() - sp_item = gtk.MenuItem(GrampsCfg.get_nameof()(spouse)) + sp_item = gtk.MenuItem(NameDisplay.displayer.display(spouse)) sp_item.set_data(_PERSON,sp_id) sp_item.connect("activate",self.on_childmenu_changed) sp_item.show() @@ -625,7 +626,7 @@ class PedigreeView: item.set_submenu(gtk.Menu()) sib_menu = item.get_submenu() - sib_item = gtk.MenuItem(GrampsCfg.get_nameof()(sib)) + sib_item = gtk.MenuItem(NameDisplay.displayer.display(sib)) sib_item.set_data(_PERSON,sib_id) sib_item.connect("activate",self.on_childmenu_changed) sib_item.show() @@ -651,9 +652,9 @@ class PedigreeView: child_menu = item.get_submenu() if find_children(self.parent.db,child): - label = gtk.Label('%s' % GrampsCfg.get_nameof()(child)) + label = gtk.Label('%s' % NameDisplay.displayer.display(child)) else: - label = gtk.Label(GrampsCfg.get_nameof()(child)) + label = gtk.Label(NameDisplay.displayer.display(child)) child_item = gtk.MenuItem(None) label.set_use_markup(gtk.TRUE) @@ -685,9 +686,9 @@ class PedigreeView: par_menu = item.get_submenu() if find_parents(self.parent.db,par): - label = gtk.Label('%s' % GrampsCfg.get_nameof()(par)) + label = gtk.Label('%s' % NameDisplay.displayer.display(par)) else: - label = gtk.Label(GrampsCfg.get_nameof()(par)) + label = gtk.Label(NameDisplay.displayer.display(par)) par_item = gtk.MenuItem(None) label.set_use_markup(gtk.TRUE) diff --git a/gramps2/src/PeopleModel.py b/gramps2/src/PeopleModel.py index 3143869c5..584e0056f 100644 --- a/gramps2/src/PeopleModel.py +++ b/gramps2/src/PeopleModel.py @@ -44,6 +44,7 @@ import pango # #------------------------------------------------------------------------- from RelLib import * +import NameDisplay #------------------------------------------------------------------------- # @@ -252,11 +253,11 @@ class PeopleModel(gtk.GenericTreeModel): spouse = self.db.get_person_from_handle(spouse_id) if len(spouses_names) > 0: spouses_names += ", " - spouses_names += spouse.get_primary_name().get_regular_name() + spouses_names += NameDisplay.displayer.display(spouse) return spouses_names def column_name(self,data,node): - return data[_NAME_COL].get_name() + return NameDisplay.displayer.sorted_name(data[_NAME_COL]) def column_id(self,data,node): return data[_ID_COL] diff --git a/gramps2/src/ReadGedcom.py b/gramps2/src/ReadGedcom.py index da96477c4..62052d125 100644 --- a/gramps2/src/ReadGedcom.py +++ b/gramps2/src/ReadGedcom.py @@ -1308,7 +1308,7 @@ class GedcomParser: event.add_source_reference(self.handle_source(matches,level+1)) elif matches[1] == "PLAC": val = matches[2] - n = string.strip(event.get_name()) + n = event.get_name().strip() if self.is_ftw and n in ["Occupation","Degree","SSN"]: event.set_description(val) self.ignore_sub_junk(level+1) diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index 1f28079ed..e7d020ce0 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -57,6 +57,7 @@ import GrampsGconfKeys import PaperMenu import Errors import GenericFilter +import NameDisplay from QuestionDialog import ErrorDialog, OptionDialog #------------------------------------------------------------------------- @@ -1585,9 +1586,10 @@ class CommandLineReport: id_list = [] for person_handle in self.database.get_person_handles(): person = self.database.get_person_from_handle(person_handle) - id_list.append("%s\t%s" % (person.get_gramps_id(), - person.get_primary_name().get_name())) - self.options_help['id'].append(id_list) + id_list.append("%s\t%s" % ( + person.get_gramps_id(), + NameDisplay.display.displayer(person))) + self.options_help['id'].append(id_list) self.options_help['id'].append(False) if self.options_dict.has_key('filter'): diff --git a/gramps2/src/SelectChild.py b/gramps2/src/SelectChild.py index 09daa966a..cc0965cb7 100644 --- a/gramps2/src/SelectChild.py +++ b/gramps2/src/SelectChild.py @@ -45,6 +45,8 @@ import RelLib import const import Utils import PeopleModel +import NameDisplay + from QuestionDialog import ErrorDialog #------------------------------------------------------------------------- @@ -90,20 +92,20 @@ class SelectChild: mother = self.db.get_person_from_handle(self.family.get_mother_handle()) if father != None: - fname = father.get_primary_name().get_name() + fname = NameDisplay.displayer.display(father) label = _("Relationship to %(father)s") % { 'father' : fname } self.xml.get_widget("flabel").set_text(label) if mother != None: - mname = mother.get_primary_name().get_name() + mname = NameDisplay.displayer.display(mother) label = _("Relationship to %(mother)s") % { 'mother' : mname } self.xml.get_widget("mlabel").set_text(label) else: - fname = self.person.get_primary_name().get_name() + fname = NameDisplay.displayer.display(self.person) label = _("Relationship to %s") % fname if self.person.get_gender() == RelLib.Person.male: @@ -243,7 +245,7 @@ class SelectChild: node = None for idval in person_list: person = self.db.get_person_from_handle(idval) - name = person.get_primary_name().get_name() + name = NameDisplay.displayer.display(person) if person.gender == RelLib.Person.male: gender = _("male") elif person.gender == RelLib.Person.female: @@ -409,7 +411,7 @@ class EditRel: self.mcombo = self.xml.get_widget('mrel_combo') self.fcombo = self.xml.get_widget('frel_combo') - name = child.get_primary_name().get_name() + name = NameDisplay.displayer.display(child) Utils.set_titles(self.top,self.xml.get_widget('title'), _('Relationships of %s') % name) @@ -417,7 +419,7 @@ class EditRel: mother = self.db.get_person_from_handle(self.family.get_mother_handle()) if father: - fname = father.get_primary_name().get_name() + fname = NameDisplay.displayer.display(father) val = _("Relationship to %(father)s") % { 'father' : fname } self.fdesc.set_text('%s' % val) @@ -428,7 +430,7 @@ class EditRel: self.fcombo.set_sensitive(0) if mother: - mname = mother.get_primary_name().get_name() + mname = NameDisplay.displayer.display(mother) val = _("Relationship to %(mother)s") % { 'mother' : mname } self.mdesc.set_text('%s' % val) diff --git a/gramps2/src/SubstKeywords.py b/gramps2/src/SubstKeywords.py index 218db73ee..bdd1bda9b 100644 --- a/gramps2/src/SubstKeywords.py +++ b/gramps2/src/SubstKeywords.py @@ -42,6 +42,8 @@ __version__ = "$Revision$" #------------------------------------------------------------------------ import string +import NameDisplay + #------------------------------------------------------------------------ # # SubstKeywords @@ -69,8 +71,8 @@ class SubstKeywords: """Creates a new object and associates a person with it.""" person = database.get_person_from_handle(person_handle) - self.n = person.get_primary_name().get_regular_name() - self.N = person.get_primary_name().get_name() + self.n = NameDisplay.displayer.display(person) + self.N = NameDisplay.displayer.sorted(person) self.b = "" self.B = "" self.d = "" @@ -104,13 +106,13 @@ class SubstKeywords: if father_handle == person_handle: if mother_handle: mother = database.get_person_from_handle(mother_handle) - self.s = mother.get_primary_name().get_regular_name() - self.S = mother.get_primary_name().get_name() + self.s = NameDisplay.displayer.display(mother) + self.S = NameDIsplay.displayer.sorted(mother) else: if father_handle: father = database.get_person_from_handle(father_handle) - self.s = father.get_primary_name().get_regular_name() - self.S = father.get_primary_name().get_name() + self.s = NameDisplay.displayer.display(father) + self.S = NameDisplay.displayer.sorted(father) for e_id in f.get_event_list(): if not e_id: continue diff --git a/gramps2/src/Utils.py b/gramps2/src/Utils.py index 0e6936e9f..40d7e7928 100644 --- a/gramps2/src/Utils.py +++ b/gramps2/src/Utils.py @@ -43,6 +43,7 @@ import gnome #------------------------------------------------------------------------- import const import GrampsMime +import NameDisplay import Date #------------------------------------------------------------------------- @@ -94,29 +95,6 @@ def wasHistory_broken(): # string if the person is None # #------------------------------------------------------------------------- -def phonebook_name(person): - if person: - return person.get_primary_name().get_name() - else: - return u'' - -def phonebook_upper_name(person): - if person: - return person.get_primary_name().get_upper_name() - else: - return u'' - -def normal_name(person): - if person: - return person.get_primary_name().get_regular_name() - else: - return u'' - -def upper_name(person): - if person: - return person.get_primary_name().get_regular_upper_name() - else: - return u'' def family_name(family,db): """Builds a name for the family from the parents names""" @@ -125,13 +103,13 @@ def family_name(family,db): father = db.get_person_from_handle(father_handle) mother = db.get_person_from_handle(mother_handle) if father and mother: - fname = father.get_primary_name().get_name() - mname = mother.get_primary_name().get_name() + fname = NameDisplay.displayer.display(father) + mname = NameDisplay.displayer.display(mother) name = _("%s and %s") % (fname,mname) elif father: - name = father.get_primary_name().get_name() + name = NameDisplay.displayer.display(father) else: - name = mother.get_primary_name().get_name() + name = NameDisplay.displayer.display(mother) return name def family_upper_name(family,db): diff --git a/gramps2/src/Witness.py b/gramps2/src/Witness.py index 2c47b9db1..34f7cd67b 100644 --- a/gramps2/src/Witness.py +++ b/gramps2/src/Witness.py @@ -38,6 +38,7 @@ import const import Utils import RelLib import ListModel +import NameDisplay from gettext import gettext as _ #------------------------------------------------------------------------- @@ -70,7 +71,7 @@ class WitnessTab: handle = s.get_value() if self.db.has_person_handle(handle): person = self.db.get_person_from_handle(handle) - n = person.get_primary_name().get_name() + n = NameDisplay.displayer.sorted(person) the_id = person.get_gramps_id() else: n = _('Unknown') diff --git a/gramps2/src/WriteGedcom.py b/gramps2/src/WriteGedcom.py index f28f71985..1aa42556d 100644 --- a/gramps2/src/WriteGedcom.py +++ b/gramps2/src/WriteGedcom.py @@ -52,6 +52,8 @@ import GedcomInfo import Errors import ansel_utf8 import Utils +import NameDisplay + from gettext import gettext as _ from QuestionDialog import ErrorDialog @@ -328,16 +330,16 @@ class GedcomWriterOptionBox: all.add_rule(GenericFilter.Everyone([])) des = GenericFilter.GenericFilter() - des.set_name(_("Descendants of %s") % self.person.get_primary_name().get_name()) + des.set_name(_("Descendants of %s") % NameDisplay.displayer.display(self.person)) des.add_rule(GenericFilter.IsDescendantOf([self.person.get_handle(),1])) ans = GenericFilter.GenericFilter() - ans.set_name(_("Ancestors of %s") % self.person.get_primary_name().get_name()) + ans.set_name(_("Ancestors of %s") % NameDisplay.displayer.display(self.person)) ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_handle(),1])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % - self.person.get_primary_name().get_name()) + NameDisplay.displayer.display(self.person)) com.add_rule(GenericFilter.HasCommonAncestorWith([self.person.get_handle()])) self.filter_menu = GenericFilter.build_filter_menu([all,des,ans,com]) diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index 5ddfefafd..f837fb2e9 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -18475,53 +18475,6 @@ Other - - - True - _Name format: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 5 - 5 - name_format - - - 1 - 2 - 2 - 3 - fill - - - - - - - True - True - -1 - - - - True - - - - - 2 - 3 - 2 - 3 - fill - - - - True diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index c38d4a406..50d96deb1 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -74,6 +74,7 @@ import ArgHandler import Exporter import RelImage import RecentFiles +import NameDisplay from QuestionDialog import * @@ -593,7 +594,8 @@ class Gramps: haveit.append(pid) person = self.db.get_person_from_handle(pid) item = gtk.MenuItem("_%d. %s [%s]" % - (num,person.get_primary_name().get_name(), + (num, + NameDisplay.displayer.display(person), person.get_gramps_id())) item.connect("activate",self.bookmark_callback, person.get_handle()) @@ -628,7 +630,7 @@ class Gramps: person = self.db.get_person_from_handle(pid) item = gtk.MenuItem("%s. %s [%s]" % (hotkey, - person.get_primary_name().get_name(), + NameDisplay.displayer.display(person), person.get_gramps_id())) item.connect("activate",self.back_clicked,num) item.show() @@ -658,7 +660,7 @@ class Gramps: person = self.db.get_person_from_handle(pid) item = gtk.MenuItem("%s. %s [%s]" % (hotkey, - person.get_primary_name().get_name(), + NameDisplay.displayer.display(person), person.get_gramps_id())) item.connect("activate",self.fwd_clicked,num) item.show() @@ -1239,7 +1241,7 @@ class Gramps: for sel in mlist: p = self.db.get_person_from_handle(sel) self.active_person = p - name = GrampsCfg.get_nameof()(p) + name = NameDisplay.displayer.display(p) QuestionDialog(_('Delete %s?') % name, _('Deleting the person will remove the person ' @@ -1371,7 +1373,7 @@ class Gramps: self.status_text("") else: if GrampsGconfKeys.get_statusbar() <= 1: - pname = GrampsCfg.get_nameof()(self.active_person) + pname = NameDisplay.displayer.display(self.active_person) name = "[%s] %s" % (self.active_person.get_gramps_id(),pname) else: name = self.display_relationship() @@ -1383,7 +1385,7 @@ class Gramps: if not default_person: return u'' try: - pname = GrampsCfg.get_nameof()(default_person) + pname = NameDisplay.displayer.display(default_person) (name,plist) = self.relationship.get_relationship( default_person, self.active_person) @@ -1538,7 +1540,7 @@ class Gramps: if person == None: return _("Unknown") else: - return GrampsCfg.get_nameof()(person) + return NameDisplay.displayer.display(person) def status_text(self,text): self.statusbar.set_status(text) @@ -1633,7 +1635,7 @@ class Gramps: def on_add_bookmark_activate(self,obj): if self.active_person: self.bookmarks.add(self.active_person.get_handle()) - name = GrampsCfg.get_nameof()(self.active_person) + name = NameDisplay.displayer.display(self.active_person) self.status_text(_("%s has been bookmarked") % name) gtk.timeout_add(5000,self.modify_statusbar) else: diff --git a/gramps2/src/plugins/Desbrowser.py b/gramps2/src/plugins/Desbrowser.py index bb5231bc9..4cc7e08ea 100644 --- a/gramps2/src/plugins/Desbrowser.py +++ b/gramps2/src/plugins/Desbrowser.py @@ -36,7 +36,7 @@ import os #------------------------------------------------------------------------ import Utils from gettext import gettext as _ -import GrampsCfg +import NameDisplay #------------------------------------------------------------------------ # @@ -119,7 +119,7 @@ class DesBrowse: def add_to_tree(self,parent_id,sib_id,person_handle): item_id = self.model.insert_after(parent_id,sib_id) person = self.db.get_person_from_handle(person_handle) - self.model.set(item_id,0,GrampsCfg.get_nameof()(person)) + self.model.set(item_id,0,NameDisplay.displayer.display(person)) self.model.set(item_id,1,person_handle) prev_id = None for family_handle in person.get_family_handle_list(): diff --git a/gramps2/src/plugins/Merge.py b/gramps2/src/plugins/Merge.py index 6aa39af5c..f887a6a5f 100644 --- a/gramps2/src/plugins/Merge.py +++ b/gramps2/src/plugins/Merge.py @@ -30,7 +30,7 @@ import RelLib import Utils import soundex -import GrampsCfg +import NameDisplay import ListModel import MergeData from gettext import gettext as _ @@ -617,7 +617,7 @@ class Merge: def name_of(p): if not p: return "" - return "%s (%s)" % ( GrampsCfg.get_nameof()(p),p.get_handle()) + return "%s (%s)" % (NameDisplay.displayer.display(p),p.get_handle()) def get_name_obj(person): if person: diff --git a/gramps2/src/plugins/RelCalc.py b/gramps2/src/plugins/RelCalc.py index b8cae7b50..7284056be 100644 --- a/gramps2/src/plugins/RelCalc.py +++ b/gramps2/src/plugins/RelCalc.py @@ -44,7 +44,7 @@ import gtk.glade import RelLib import Utils -import GrampsCfg +import NameDisplay import ListModel import Plugins from gettext import gettext as _ @@ -182,8 +182,8 @@ class RelCalc: commontext = "" text1 = self.glade.get_widget("text1").get_buffer() - p1 = GrampsCfg.get_nameof()(self.person) - p2 = GrampsCfg.get_nameof()(other_person) + p1 = NameDisplay.displayer.display(self.person) + p2 = NameDisplay.displayer.display(other_person) if rel_string == "": rstr = _("%(person)s and %(active_person)s are not related.") % {