* src/NameDisplay.py: Add constants to number name components.

* src/PeopleModel.py: Correct constants.


svn: r6324
This commit is contained in:
Alex Roitman 2006-04-13 05:26:19 +00:00
parent 310fb17f01
commit f0d9aed4c1
3 changed files with 42 additions and 20 deletions

View File

@ -1,3 +1,7 @@
2006-04-12 Alex Roitman <shura@gramps-project.org>
* src/NameDisplay.py: Add constants to number name components.
* src/PeopleModel.py: Correct constants.
2006-04-12 Brian Matherly <pez4brian@users.sourceforge.net>
* src/plugins/GraphViz.py: Add graph preview based on mime (Bug 1449796)

View File

@ -31,6 +31,23 @@ Class handling language-specific displaying of names.
#-------------------------------------------------------------------------
from RelLib import Name
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_FIRSTNAME = 4
_SURNAME = 5
_SUFFIX = 6
_TITLE = 7
_TYPE = 8
_PREFIX = 9
_PATRONYM = 10
_SNAME = 11
_GROUP = 12
_SORT = 13
_DISPLAY = 14
#-------------------------------------------------------------------------
#
# NameDisplay class
@ -99,7 +116,7 @@ class NameDisplay:
return name.first_name
def _empty_raw(self,raw_data):
return raw_data[2]
return raw_data[_FIRSTNAME]
def _ptfn(self,name):
"""
@ -135,10 +152,10 @@ class NameDisplay:
SurnamePrefix Patronymic SurnameSuffix, FirstName
"""
first = raw_data[2]
suffix = raw_data[4]
prefix = raw_data[7]
patronymic = raw_data[8]
first = raw_data[_FIRSTNAME]
suffix = raw_data[_SUFFIX]
prefix = raw_data[_PREFIX]
patronymic = raw_data[_PATRONYM]
if self.force_upper:
last = patronymic.upper()
@ -191,11 +208,11 @@ class NameDisplay:
FirstName Patronymic SurnamePrefix Surname SurnameSuffix
"""
first = raw_data[2]
surname = raw_data[3]
suffix = raw_data[4]
prefix = raw_data[7]
patronymic = raw_data[8]
first = raw_data[_FIRSTNAME]
surname = raw_data[_SURNAME]
suffix = raw_data[_SUFFIX]
prefix = raw_data[_PREFIX]
patronymic = raw_data[_PATRONYM]
if patronymic:
first = "%s %s" % (first, patronymic)
@ -242,15 +259,16 @@ class NameDisplay:
SurnamePrefix Surname, FirstName Patronymic SurnameSuffix
"""
if self.force_upper:
last = raw_data[3].upper()
last = raw_data[_SURNAME].upper()
else:
last = raw_data[3]
last = raw_data[_SURNAME]
if last:
last += ","
return " ".join([x for x in [raw_data[7], last, raw_data[2],
raw_data[8], raw_data[4]]])
return " ".join([x for x in
[raw_data[_PREFIX], last, raw_data[_FIRSTNAME],
raw_data[_PATRONYM], raw_data[_SUFFIX]]])
def sorted_name(self,name):
"""
@ -277,7 +295,7 @@ class NameDisplay:
@returns: Returns the L{Name} string representation
@rtype: str
"""
return self.raw_fn_array[raw_data[11]](raw_data)
return self.raw_fn_array[raw_data[_SORT]](raw_data)
def display_given(self,person):
name = person.get_primary_name()

View File

@ -25,7 +25,7 @@ TreeModel for the GRAMPS Person tree.
"""
__author__ = "Donald N. Allingham"
__revision__ = "$Revision:$"
__revision__ = "$Revision$"
#-------------------------------------------------------------------------
#
@ -91,8 +91,8 @@ _DEATH_COL = 6
_BIRTH_COL = 7
_EVENT_COL = 8
_FAMILY_COL = 9
_CHANGE_COL = 19
_MARKER_COL = 20
_CHANGE_COL = 18
_MARKER_COL = 19
#-------------------------------------------------------------------------
#
@ -181,9 +181,9 @@ class PeopleModel(gtk.GenericTreeModel):
name_data = d[_NAME_COL]
self.sortnames[handle] = nsn(name_data)
try:
self.temp_sname_sub[name_data[3]].append(handle)
self.temp_sname_sub[name_data[5]].append(handle)
except:
self.temp_sname_sub[name_data[3]] = [handle]
self.temp_sname_sub[name_data[5]] = [handle]
node = cursor.next()
cursor.close()