From dac9f47bd4154c799b6d5b06ecb0f95276e8b156 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 13 Apr 2006 05:26:19 +0000 Subject: [PATCH] * src/NameDisplay.py: Add constants to number name components. * src/PeopleModel.py: Correct constants. svn: r6324 --- gramps2/ChangeLog | 4 ++++ gramps2/src/NameDisplay.py | 48 ++++++++++++++++++++++++++------------ gramps2/src/PeopleModel.py | 10 ++++---- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 2288147dd..a410d078b 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2006-04-12 Alex Roitman + * src/NameDisplay.py: Add constants to number name components. + * src/PeopleModel.py: Correct constants. + 2006-04-12 Brian Matherly * src/plugins/GraphViz.py: Add graph preview based on mime (Bug 1449796) diff --git a/gramps2/src/NameDisplay.py b/gramps2/src/NameDisplay.py index 39834de0c..2e5cc116a 100644 --- a/gramps2/src/NameDisplay.py +++ b/gramps2/src/NameDisplay.py @@ -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() diff --git a/gramps2/src/PeopleModel.py b/gramps2/src/PeopleModel.py index 9cbfbe2f9..940f9ada4 100644 --- a/gramps2/src/PeopleModel.py +++ b/gramps2/src/PeopleModel.py @@ -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()