* src/RelLib.py : support for capitalized name formats
* src/EditPerson.py: eliminate capitilzing names, instead rely on the display formats * src/Utils.py: new display formats for names * src/GrampsCfg.py: eliminate name only option in status line, add support for capitalized name formats * src/preferences.glade : eliminate name only option in status line, drop capitalize in favor of expanded name format svn: r2238
This commit is contained in:
parent
52839e9ba0
commit
fee585d80c
@ -921,9 +921,6 @@ class EditPerson:
|
||||
original record"""
|
||||
|
||||
surname = unicode(self.surname_field.get_text())
|
||||
if GrampsCfg.capitalize:
|
||||
surname = surname.upper()
|
||||
|
||||
self.birth.setDate(self.bdate.get_text())
|
||||
self.death.setDate(self.ddate.get_text())
|
||||
|
||||
@ -949,10 +946,6 @@ class EditPerson:
|
||||
changed = 1
|
||||
if prefix != name.getSurnamePrefix():
|
||||
changed = 1
|
||||
if GrampsCfg.capitalize:
|
||||
if surname != name.getSurname():
|
||||
changed = 1
|
||||
else:
|
||||
if surname.upper() != name.getSurname().upper():
|
||||
changed = 1
|
||||
if ntype != const.InverseNameTypesMap[name.getType()]:
|
||||
@ -1316,11 +1309,6 @@ class EditPerson:
|
||||
if ntype != name.getType():
|
||||
name.setType(ntype)
|
||||
|
||||
if GrampsCfg.capitalize:
|
||||
if surname.upper() != name.getSurname().upper():
|
||||
name.setSurname(surname.upper())
|
||||
self.db.addSurname(surname.upper())
|
||||
else:
|
||||
if surname != name.getSurname():
|
||||
name.setSurname(surname)
|
||||
self.db.addSurname(surname)
|
||||
|
@ -89,6 +89,8 @@ _date_entry_list = [
|
||||
_name_format_list = [
|
||||
(_("Firstname Surname"), Utils.normal_name),
|
||||
(_("Surname, Firstname"), Utils.phonebook_name),
|
||||
(_("Firstname SURNAME"), Utils.upper_name),
|
||||
(_("SURNAME, Firstname"), Utils.phonebook_upper_name),
|
||||
]
|
||||
|
||||
panellist = [
|
||||
@ -129,6 +131,8 @@ vc_comment = 0
|
||||
uncompress = 0
|
||||
lastfile = None
|
||||
nameof = Utils.normal_name
|
||||
display_name = Utils.normal_name
|
||||
display_surname = lambda x : x.getSurname()
|
||||
status_bar = 1
|
||||
toolbar = 2
|
||||
calendar = 0
|
||||
@ -144,7 +148,6 @@ index_visible = 0
|
||||
mediaref = 1
|
||||
globalprop = 1
|
||||
localprop = 1
|
||||
capitalize = 0
|
||||
defaultview = 0
|
||||
familyview = 0
|
||||
|
||||
@ -199,6 +202,8 @@ def loadConfig(call):
|
||||
global index_visible
|
||||
global lastfile
|
||||
global nameof
|
||||
global display_name
|
||||
global display_surname
|
||||
global _name_format
|
||||
global _callback
|
||||
global paper_preference
|
||||
@ -213,7 +218,7 @@ def loadConfig(call):
|
||||
global mediaref
|
||||
global globalprop
|
||||
global localprop
|
||||
global capitalize
|
||||
# global capitalize
|
||||
global defaultview
|
||||
global familyview
|
||||
|
||||
@ -229,7 +234,7 @@ def loadConfig(call):
|
||||
vc_comment = get_bool("/apps/gramps/use-comment")
|
||||
uncompress = get_bool("/apps/gramps/dont-compress-xml")
|
||||
id_edit = get_bool("/apps/gramps/id-edit")
|
||||
capitalize = get_bool("/apps/gramps/capitalize")
|
||||
# capitalize = get_bool("/apps/gramps/capitalize")
|
||||
index_visible = get_bool("/apps/gramps/index-visible")
|
||||
status_bar = get_int("/apps/gramps/statusbar")
|
||||
toolbar = get_int("/apps/gramps/toolbar",2)
|
||||
@ -296,10 +301,14 @@ def loadConfig(call):
|
||||
Calendar.set_format_code(dateFormat)
|
||||
Calendar.Calendar.ENTRYCODE = dateEntry
|
||||
|
||||
if _name_format == 0:
|
||||
nameof = Utils.normal_name
|
||||
nameof = _name_format_list[_name_format][1]
|
||||
|
||||
if _name_format%2:
|
||||
display_name = Utils.phonebook_name
|
||||
display_surname = lambda x : x.getSurname()
|
||||
else:
|
||||
nameof = Utils.phonebook_name
|
||||
display_name = Utils.phonebook_upper_name
|
||||
display_surname = lambda x : x.getUpperSurname()
|
||||
|
||||
make_path(os.path.expanduser("~/.gramps"))
|
||||
make_path(os.path.expanduser("~/.gramps/filters"))
|
||||
@ -554,7 +563,7 @@ class GrampsPreferences:
|
||||
auto = self.top.get_widget("autoload")
|
||||
asave_int = self.top.get_widget("autosave_interval")
|
||||
idedit = self.top.get_widget("gid_edit")
|
||||
cap = self.top.get_widget('capitalize')
|
||||
# cap = self.top.get_widget('capitalize')
|
||||
index_vis = self.top.get_widget("show_child_id")
|
||||
lds = self.top.get_widget("uselds")
|
||||
ac = self.top.get_widget("autocomp")
|
||||
@ -582,7 +591,7 @@ class GrampsPreferences:
|
||||
vcom.set_active(vc_comment)
|
||||
compress.set_active(uncompress)
|
||||
idedit.set_active(id_edit)
|
||||
cap.set_active(capitalize)
|
||||
# cap.set_active(capitalize)
|
||||
index_vis.set_active(index_visible)
|
||||
|
||||
self.top.get_widget("iprefix").set_text(iprefix)
|
||||
@ -813,7 +822,7 @@ class GrampsPreferences:
|
||||
global vc_comment
|
||||
global uncompress
|
||||
global id_edit
|
||||
global capitalize
|
||||
# global capitalize
|
||||
global index_visible
|
||||
global status_bar
|
||||
global toolbar
|
||||
@ -840,7 +849,7 @@ class GrampsPreferences:
|
||||
vc_comment = self.top.get_widget("vc_comment").get_active()
|
||||
uncompress = self.top.get_widget("uncompress").get_active()
|
||||
id_edit = self.top.get_widget("gid_edit").get_active()
|
||||
capitalize = self.top.get_widget('capitalize').get_active()
|
||||
# capitalize = self.top.get_widget('capitalize').get_active()
|
||||
|
||||
index_visible = self.top.get_widget("show_child_id").get_active()
|
||||
paper_obj = self.top.get_widget("paper_size").get_menu().get_active()
|
||||
@ -912,7 +921,7 @@ class GrampsPreferences:
|
||||
set_bool("/apps/gramps/use-comment",vc_comment)
|
||||
set_bool("/apps/gramps/dont-compress-xml",uncompress)
|
||||
set_bool("/apps/gramps/id-edit",id_edit)
|
||||
set_bool("/apps/gramps/capitalize",capitalize)
|
||||
# set_bool("/apps/gramps/capitalize",capitalize)
|
||||
set_bool("/apps/gramps/index-visible",index_visible)
|
||||
set_int("/apps/gramps/statusbar",status_bar)
|
||||
set_int("/apps/gramps/toolbar",toolbar)
|
||||
|
@ -38,6 +38,7 @@ import os
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Date import Date, SingleDate, compare_dates, not_too_old
|
||||
import GrampsCfg
|
||||
import sort
|
||||
import const
|
||||
|
||||
@ -878,6 +879,10 @@ class Name(DataObj):
|
||||
"""returns the surname (or last name) for the Name instance"""
|
||||
return self.Surname
|
||||
|
||||
def getUpperSurname(self):
|
||||
"""returns the surname (or last name) for the Name instance"""
|
||||
return self.Surname.upper()
|
||||
|
||||
def getSuffix(self):
|
||||
"""returns the suffix for the Name instance"""
|
||||
return self.Suffix
|
||||
@ -905,6 +910,21 @@ class Name(DataObj):
|
||||
else:
|
||||
return "%s, %s" % (self.Surname, self.FirstName)
|
||||
|
||||
def getUpperName(self):
|
||||
"""returns a name string built from the components of the Name
|
||||
instance, in the form of Surname, Firstname"""
|
||||
|
||||
if self.Suffix:
|
||||
if self.Prefix:
|
||||
return "%s %s, %s %s" % (self.Prefix.upper(), self.Surname.upper(), self.FirstName, self.Suffix)
|
||||
else:
|
||||
return "%s, %s %s" % (self.Surname.upper(), self.FirstName, self.Suffix)
|
||||
else:
|
||||
if self.Prefix:
|
||||
return "%s %s, %s" % (self.Prefix.upper(), self.Surname.upper(), self.FirstName)
|
||||
else:
|
||||
return "%s, %s" % (self.Surname.upper(), self.FirstName)
|
||||
|
||||
def getRegularName(self):
|
||||
"""returns a name string built from the components of the Name
|
||||
instance, in the form of Firstname Surname"""
|
||||
@ -919,6 +939,20 @@ class Name(DataObj):
|
||||
else:
|
||||
return "%s %s, %s" % (self.FirstName, self.Surname, self.Suffix)
|
||||
|
||||
def getRegularUpperName(self):
|
||||
"""returns a name string built from the components of the Name
|
||||
instance, in the form of Firstname Surname"""
|
||||
if (self.Suffix == ""):
|
||||
if self.Prefix:
|
||||
return "%s %s %s" % (self.FirstName, self.Prefix.upper(), self.Surname.upper())
|
||||
else:
|
||||
return "%s %s" % (self.FirstName, self.Surname.upper())
|
||||
else:
|
||||
if self.Prefix:
|
||||
return "%s %s %s, %s" % (self.FirstName, self.Prefix.upper(), self.Surname.upper(), self.Suffix)
|
||||
else:
|
||||
return "%s %s, %s" % (self.FirstName, self.Surname.upper(), self.Suffix)
|
||||
|
||||
def are_equal(self,other):
|
||||
"""compares to names to see if they are equal, return 0 if they
|
||||
are not"""
|
||||
@ -1044,11 +1078,11 @@ class Person(Persistent):
|
||||
gender = const.unknown
|
||||
bday = self.getBirth().getDateObj()
|
||||
dday = self.getDeath().getDateObj()
|
||||
return [ self.getPrimaryName().getName(),self.id,gender,
|
||||
return [ GrampsCfg.display_name(self),self.id,gender,
|
||||
bday.getQuoteDate(), dday.getQuoteDate(),
|
||||
sort.build_sort_name(self.getPrimaryName()),
|
||||
sort.build_sort_date(bday),sort.build_sort_date(dday),
|
||||
self.getPrimaryName().getSurname()]
|
||||
GrampsCfg.display_surname(self.PrimaryName)]
|
||||
|
||||
def setPrimaryName(self,name):
|
||||
"""sets the primary name of the Person to the specified
|
||||
|
39
src/Utils.py
39
src/Utils.py
@ -136,6 +136,24 @@ def phonebook_name(person):
|
||||
else:
|
||||
return u''
|
||||
|
||||
def phonebook_upper_name(person):
|
||||
if person:
|
||||
return person.getPrimaryName().getUpperName()
|
||||
else:
|
||||
return u''
|
||||
|
||||
def normal_name(person):
|
||||
if person:
|
||||
return person.getPrimaryName().getRegularName()
|
||||
else:
|
||||
return u''
|
||||
|
||||
def upper_name(person):
|
||||
if person:
|
||||
return person.getPrimaryName().getRegularUpperName()
|
||||
else:
|
||||
return u''
|
||||
|
||||
def family_name(family):
|
||||
"""Builds a name for the family from the parents names"""
|
||||
father = family.getFather()
|
||||
@ -150,17 +168,20 @@ def family_name(family):
|
||||
name = mother.getPrimaryName().getName()
|
||||
return name
|
||||
|
||||
def phonebook_from_name(name,alt):
|
||||
if alt:
|
||||
return "%s *" % name.getName()
|
||||
def family_upper_name(family):
|
||||
"""Builds a name for the family from the parents names"""
|
||||
father = family.getFather()
|
||||
mother = family.getMother()
|
||||
if father and mother:
|
||||
fname = father.getPrimaryName().getUpperName()
|
||||
mname = mother.getPrimaryName().getUpperName()
|
||||
name = _("%s and %s") % (fname,mname)
|
||||
elif father:
|
||||
name = father.getPrimaryName().getUpperName()
|
||||
else:
|
||||
return name.getName()
|
||||
name = mother.getPrimaryName().getUpperName()
|
||||
return name
|
||||
|
||||
def normal_name(person):
|
||||
if person:
|
||||
return person.getPrimaryName().getRegularName()
|
||||
else:
|
||||
return u''
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -225,7 +225,7 @@
|
||||
<widget class="GtkTable" id="table11">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">6</property>
|
||||
<property name="n_rows">5</property>
|
||||
<property name="n_columns">4</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
@ -252,8 +252,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -274,8 +274,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -301,8 +301,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -325,8 +325,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -384,29 +384,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="capitalize">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Capitalize family names</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
Loading…
Reference in New Issue
Block a user