* 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:
parent
13d5991528
commit
8390e985c7
@ -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>
|
||||
* src/GrampsCfg.py (build): Typo.
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import pickle
|
||||
import os
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -58,7 +59,7 @@ import Date
|
||||
import DateHandler
|
||||
import TransTable
|
||||
|
||||
from QuestionDialog import QuestionDialog, WarningDialog, ErrorDialog, SaveDialog
|
||||
from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog
|
||||
|
||||
from gettext import gettext as _
|
||||
|
||||
@ -79,6 +80,15 @@ pycode_tgts = [('url', 0, 0),
|
||||
('pattr', 0, 2),
|
||||
('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
|
||||
@ -86,6 +96,8 @@ pycode_tgts = [('url', 0, 0),
|
||||
#-------------------------------------------------------------------------
|
||||
class EditPerson:
|
||||
|
||||
use_patronymic = os.environ.get('LANG') in _use_patronymic
|
||||
|
||||
def __init__(self,parent,person,db,callback=None):
|
||||
"""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.gid = self.get_widget("gid")
|
||||
self.slist = self.get_widget("slist")
|
||||
|
||||
self.general_label = self.get_widget("general_label")
|
||||
self.names_label = self.get_widget("names_label")
|
||||
self.events_label = self.get_widget("events_label")
|
||||
@ -214,6 +225,12 @@ class EditPerson:
|
||||
self.lds_tab = self.get_widget("lds_tab")
|
||||
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_death = self.db.get_event_from_handle(person.get_death_handle())
|
||||
self.death = RelLib.Event(self.orig_death)
|
||||
@ -1118,8 +1135,11 @@ class EditPerson:
|
||||
changed = True
|
||||
if suffix != name.get_suffix():
|
||||
changed = True
|
||||
if prefix != name.get_surname_prefix():
|
||||
changed = True
|
||||
if self.use_patronymic:
|
||||
if prefix != name.get_patronymic():
|
||||
changed = True
|
||||
elif prefix != name.get_surname_prefix():
|
||||
changed = True
|
||||
if surname.upper() != name.get_surname().upper():
|
||||
changed = True
|
||||
if ntype != const.NameTypesMap.find_value(name.get_type()):
|
||||
@ -1479,8 +1499,12 @@ class EditPerson:
|
||||
if suffix != name.get_suffix():
|
||||
name.set_suffix(suffix)
|
||||
|
||||
if prefix != name.get_surname_prefix():
|
||||
name.set_surname_prefix(prefix)
|
||||
if self.use_patronymic:
|
||||
if prefix != name.get_patronymic():
|
||||
name.set_patronymic(prefix)
|
||||
else:
|
||||
if prefix != name.get_surname_prefix():
|
||||
name.set_surname_prefix(prefix)
|
||||
|
||||
if const.NameTypesMap.has_value(ntype):
|
||||
ntype = const.NameTypesMap.find_key(ntype)
|
||||
@ -1501,7 +1525,7 @@ class EditPerson:
|
||||
|
||||
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)
|
||||
|
||||
if nick != self.person.get_nick_name():
|
||||
@ -1655,7 +1679,10 @@ class EditPerson:
|
||||
self.pname.set_type(const.NameTypesMap.find_value(ntype))
|
||||
self.pname.set_suffix(unicode(self.suffix.get_text()))
|
||||
self.pname.set_surname(unicode(self.surname.get_text()))
|
||||
self.pname.set_surname_prefix(unicode(self.prefix.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_first_name(unicode(self.given.get_text()))
|
||||
self.pname.set_title(unicode(self.title.get_text()))
|
||||
|
||||
@ -1769,7 +1796,10 @@ class EditPerson:
|
||||
self.get_widget("activepersonTitle").set_text(name)
|
||||
self.get_widget("activepersonTitle").set_use_markup(gtk.TRUE)
|
||||
self.suffix.set_text(self.pname.get_suffix())
|
||||
self.prefix.set_text(self.pname.get_surname_prefix())
|
||||
if self.use_patronymic:
|
||||
self.prefix.set_text(self.pname.get_patronymic())
|
||||
else:
|
||||
self.prefix.set_text(self.pname.get_surname_prefix())
|
||||
|
||||
self.surname.set_text(self.pname.get_surname())
|
||||
self.given.set_text(self.pname.get_first_name())
|
||||
|
@ -1958,34 +1958,38 @@ class Name(DataObj):
|
||||
else:
|
||||
return "%s %s, %s" % (first, 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"""
|
||||
def __cmp__(self,other):
|
||||
"""
|
||||
compares to names to see if they are equal, return 0 if they
|
||||
are not
|
||||
"""
|
||||
if self.first_name != other.first_name:
|
||||
return 0
|
||||
return 1
|
||||
if self.surname != other.surname:
|
||||
return 0
|
||||
return 1
|
||||
if self.patronymic != other.patronymic:
|
||||
return 1
|
||||
if self.prefix != other.prefix:
|
||||
return 0
|
||||
return 1
|
||||
if self.suffix != other.suffix:
|
||||
return 0
|
||||
return 1
|
||||
if self.title != other.title:
|
||||
return 0
|
||||
return 1
|
||||
if self.type != other.type:
|
||||
return 0
|
||||
return 1
|
||||
if self.private != other.private:
|
||||
return 0
|
||||
return 1
|
||||
if self.get_note() != other.get_note():
|
||||
return 0
|
||||
return 1
|
||||
if len(self.get_source_references()) != len(other.get_source_references()):
|
||||
return 0
|
||||
return 1
|
||||
index = 0
|
||||
olist = other.get_source_references()
|
||||
for a in self.get_source_references():
|
||||
if not a.are_equal(olist[index]):
|
||||
return 0
|
||||
index = index + 1
|
||||
return 1
|
||||
return True
|
||||
index += 1
|
||||
return 0
|
||||
|
||||
class Url:
|
||||
"""Contains information related to internet Uniform Resource Locators,
|
||||
|
@ -8047,9 +8047,9 @@ Other</property>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label293">
|
||||
<widget class="GtkLabel" id="prefix_label">
|
||||
<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_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
|
Loading…
Reference in New Issue
Block a user