* 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
This commit is contained in:
Don Allingham 2005-01-01 04:27:15 +00:00
parent 1432e9e8cd
commit 63d7153857
31 changed files with 216 additions and 236 deletions

View File

@ -1,3 +1,36 @@
2004-12-31 Don Allingham <dallingham@users.sourceforge.net>
* 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 <shura@alex.neuro.umn.edu>
* src/RelLib.py (Family.set_mother_handle): Typo.
* src/Report.py: Use gen and pagebbg.

View File

@ -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)

View File

@ -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:

View File

@ -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

View File

@ -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)

View File

@ -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),

View File

@ -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 = '<span size="larger" weight="bold">%s</span>' % GrampsCfg.get_nameof()(self.person)
name = '<span size="larger" weight="bold">%s</span>' % 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())

View File

@ -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())))

View File

@ -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:

View File

@ -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 '

View File

@ -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
#-------------------------------------------------------------------------
#

View File

@ -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',

View File

@ -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)

View File

@ -69,6 +69,7 @@ gdir_PYTHON = \
Marriage.py\
MediaView.py\
MergeData.py\
NameDisplay.py\
NameEdit.py\
NoteEdit.py\
PaperMenu.py\

View File

@ -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)

View File

@ -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())
#-------------------------------------------------------------------------
#

View File

@ -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")

View File

@ -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('<b><i>%s</i></b>' % 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('<b><i>%s</i></b>' % GrampsCfg.get_nameof()(child))
label = gtk.Label('<b><i>%s</i></b>' % 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('<b><i>%s</i></b>' % GrampsCfg.get_nameof()(par))
label = gtk.Label('<b><i>%s</i></b>' % 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)

View File

@ -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]

View File

@ -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)

View File

@ -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'):

View File

@ -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('<b>%s</b>' % 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('<b>%s</b>' % val)

View File

@ -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

View File

@ -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):

View File

@ -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')

View File

@ -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])

View File

@ -18475,53 +18475,6 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="label" translatable="yes">_Name format:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="ypad">5</property>
<property name="mnemonic_widget">name_format</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="name_format">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget6">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label127">
<property name="visible">True</property>

View File

@ -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:

View File

@ -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():

View File

@ -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:

View File

@ -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.") % {