* src/EditPerson.py: support for locale selected patronymic

names. Allow patronymic name to be substituted for prefix on
the display
* src/RelLib.py: add __cmp__ for Name
* src/gramps.glade: provide name for the prefix field


svn: r3611
This commit is contained in:
Don Allingham 2004-10-09 01:35:58 +00:00
parent 13d5991528
commit 8390e985c7
4 changed files with 67 additions and 26 deletions

View File

@ -1,3 +1,10 @@
2004-10-08 Don Allingham <dallingham@users.sourceforge.net>
* src/EditPerson.py: support for locale selected patronymic
names. Allow patronymic name to be substituted for prefix on
the display
* src/RelLib.py: add __cmp__ for Name
* src/gramps.glade: provide name for the prefix field
2004-10-08 Alex Roitman <shura@alex.neuro.umn.edu> 2004-10-08 Alex Roitman <shura@alex.neuro.umn.edu>
* src/GrampsCfg.py (build): Typo. * src/GrampsCfg.py (build): Typo.

View File

@ -26,6 +26,7 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import pickle import pickle
import os
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -58,7 +59,7 @@ import Date
import DateHandler import DateHandler
import TransTable import TransTable
from QuestionDialog import QuestionDialog, WarningDialog, ErrorDialog, SaveDialog from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog
from gettext import gettext as _ from gettext import gettext as _
@ -79,6 +80,15 @@ pycode_tgts = [('url', 0, 0),
('pattr', 0, 2), ('pattr', 0, 2),
('paddr', 0, 3)] ('paddr', 0, 3)]
_use_patronymic = [
"ru","RU","ru_RU","koi8r","ru_koi8r","russian","Russian",
"ru_RU.koi8r","ru_RU.KOI8-R","ru_RU.utf8","ru_RU.UTF8",
"ru_RU.utf-8","ru_RU.UTF-8","ru_RU.iso88595","ru_RU.iso8859-5",
"ru_RU.iso-8859-5"
]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# EditPerson class # EditPerson class
@ -86,6 +96,8 @@ pycode_tgts = [('url', 0, 0),
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class EditPerson: class EditPerson:
use_patronymic = os.environ.get('LANG') in _use_patronymic
def __init__(self,parent,person,db,callback=None): def __init__(self,parent,person,db,callback=None):
"""Creates an edit window. Associates a person with the window.""" """Creates an edit window. Associates a person with the window."""
@ -201,7 +213,6 @@ class EditPerson:
self.name_source = self.get_widget("name_source") self.name_source = self.get_widget("name_source")
self.gid = self.get_widget("gid") self.gid = self.get_widget("gid")
self.slist = self.get_widget("slist") self.slist = self.get_widget("slist")
self.general_label = self.get_widget("general_label") self.general_label = self.get_widget("general_label")
self.names_label = self.get_widget("names_label") self.names_label = self.get_widget("names_label")
self.events_label = self.get_widget("events_label") self.events_label = self.get_widget("events_label")
@ -214,6 +225,12 @@ class EditPerson:
self.lds_tab = self.get_widget("lds_tab") self.lds_tab = self.get_widget("lds_tab")
self.get_widget("changed").set_text(person.get_change_display()) self.get_widget("changed").set_text(person.get_change_display())
self.prefix_label = self.get_widget('prefix_label')
if self.use_patronymic:
self.prefix_label.set_text(_('Patronymic:'))
self.prefix_label.set_use_underline(True)
self.orig_birth = self.db.get_event_from_handle(person.get_birth_handle()) self.orig_birth = self.db.get_event_from_handle(person.get_birth_handle())
self.orig_death = self.db.get_event_from_handle(person.get_death_handle()) self.orig_death = self.db.get_event_from_handle(person.get_death_handle())
self.death = RelLib.Event(self.orig_death) self.death = RelLib.Event(self.orig_death)
@ -1118,7 +1135,10 @@ class EditPerson:
changed = True changed = True
if suffix != name.get_suffix(): if suffix != name.get_suffix():
changed = True changed = True
if prefix != name.get_surname_prefix(): if self.use_patronymic:
if prefix != name.get_patronymic():
changed = True
elif prefix != name.get_surname_prefix():
changed = True changed = True
if surname.upper() != name.get_surname().upper(): if surname.upper() != name.get_surname().upper():
changed = True changed = True
@ -1479,6 +1499,10 @@ class EditPerson:
if suffix != name.get_suffix(): if suffix != name.get_suffix():
name.set_suffix(suffix) name.set_suffix(suffix)
if self.use_patronymic:
if prefix != name.get_patronymic():
name.set_patronymic(prefix)
else:
if prefix != name.get_surname_prefix(): if prefix != name.get_surname_prefix():
name.set_surname_prefix(prefix) name.set_surname_prefix(prefix)
@ -1501,7 +1525,7 @@ class EditPerson:
name.set_source_reference_list(self.pname.get_source_references()) name.set_source_reference_list(self.pname.get_source_references())
if not name.are_equal(self.person.get_primary_name()): if name != self.person.get_primary_name():
self.person.set_primary_name(name) self.person.set_primary_name(name)
if nick != self.person.get_nick_name(): if nick != self.person.get_nick_name():
@ -1655,6 +1679,9 @@ class EditPerson:
self.pname.set_type(const.NameTypesMap.find_value(ntype)) self.pname.set_type(const.NameTypesMap.find_value(ntype))
self.pname.set_suffix(unicode(self.suffix.get_text())) self.pname.set_suffix(unicode(self.suffix.get_text()))
self.pname.set_surname(unicode(self.surname.get_text())) self.pname.set_surname(unicode(self.surname.get_text()))
if self.use_patronymic:
self.pname.set_patronymic(unicode(self.prefix.get_text()))
else:
self.pname.set_surname_prefix(unicode(self.prefix.get_text())) self.pname.set_surname_prefix(unicode(self.prefix.get_text()))
self.pname.set_first_name(unicode(self.given.get_text())) self.pname.set_first_name(unicode(self.given.get_text()))
self.pname.set_title(unicode(self.title.get_text())) self.pname.set_title(unicode(self.title.get_text()))
@ -1769,6 +1796,9 @@ class EditPerson:
self.get_widget("activepersonTitle").set_text(name) self.get_widget("activepersonTitle").set_text(name)
self.get_widget("activepersonTitle").set_use_markup(gtk.TRUE) self.get_widget("activepersonTitle").set_use_markup(gtk.TRUE)
self.suffix.set_text(self.pname.get_suffix()) self.suffix.set_text(self.pname.get_suffix())
if self.use_patronymic:
self.prefix.set_text(self.pname.get_patronymic())
else:
self.prefix.set_text(self.pname.get_surname_prefix()) self.prefix.set_text(self.pname.get_surname_prefix())
self.surname.set_text(self.pname.get_surname()) self.surname.set_text(self.pname.get_surname())

View File

@ -1958,34 +1958,38 @@ class Name(DataObj):
else: else:
return "%s %s, %s" % (first, self.surname.upper(), self.suffix) return "%s %s, %s" % (first, self.surname.upper(), self.suffix)
def are_equal(self,other): def __cmp__(self,other):
"""compares to names to see if they are equal, return 0 if they """
are not""" compares to names to see if they are equal, return 0 if they
are not
"""
if self.first_name != other.first_name: if self.first_name != other.first_name:
return 0 return 1
if self.surname != other.surname: if self.surname != other.surname:
return 0 return 1
if self.patronymic != other.patronymic:
return 1
if self.prefix != other.prefix: if self.prefix != other.prefix:
return 0 return 1
if self.suffix != other.suffix: if self.suffix != other.suffix:
return 0 return 1
if self.title != other.title: if self.title != other.title:
return 0 return 1
if self.type != other.type: if self.type != other.type:
return 0 return 1
if self.private != other.private: if self.private != other.private:
return 0 return 1
if self.get_note() != other.get_note(): if self.get_note() != other.get_note():
return 0 return 1
if len(self.get_source_references()) != len(other.get_source_references()): if len(self.get_source_references()) != len(other.get_source_references()):
return 0 return 1
index = 0 index = 0
olist = other.get_source_references() olist = other.get_source_references()
for a in self.get_source_references(): for a in self.get_source_references():
if not a.are_equal(olist[index]): if not a.are_equal(olist[index]):
return True
index += 1
return 0 return 0
index = index + 1
return 1
class Url: class Url:
"""Contains information related to internet Uniform Resource Locators, """Contains information related to internet Uniform Resource Locators,

View File

@ -8047,9 +8047,9 @@ Other</property>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="label293"> <widget class="GtkLabel" id="prefix_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Family prefi_x:</property> <property name="label" translatable="yes">Famil_y prefix:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="use_markup">False</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property> <property name="justify">GTK_JUSTIFY_CENTER</property>