2006-07-06 Alex Roitman <shura@gramps-project.org>

* src/ViewManager.py (ViewManager.post_load_newdb): Register
	custom formats after loading the db.
	* src/GrampsCfg.py: Switch to use new formats (still in progress).
	* src/GrampsDb/_GrampsDbBase.py (GrampsDbBase.__init__): Set up
	custom name formats list.
	* src/GrampsDb/_DbUtils.py (db_copy): Copy custom name formats.
	* src/GrampsDb/_ReadXML.py (start_format): Parse custom formats.
	* src/GrampsDb/_WriteXML.py (write_name_formats): Add method.
	* src/GrampsDb/_GrampsBSDDB.py (GrampsBSDDB._load_metadata) 
	(GrampsBSDDB._close_metadata): load and save name_formats.
	* src/Editors/_EditName.py (EditName._setup_fields): Use proper
	format lists.
	* src/NameDisplay.py: Support new name formats scheme.
	* src/RelLib/_Name.py (Name.DEFAULT_FORMATS): Add list of formats.



svn: r6999
This commit is contained in:
Alex Roitman
2006-07-06 17:46:46 +00:00
parent 1d03a4efb1
commit 154787c06c
11 changed files with 218 additions and 142 deletions

View File

@@ -24,6 +24,13 @@
Name class for GRAMPS
"""
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
@@ -48,11 +55,19 @@ class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
A person may have more that one name throughout his or her life.
"""
CUSTOM = -1 # user-built ordering
LNFN = 0 # last name first name [patronymic]
FNLN = 1 # first name last name
PTFN = 2 # patronymic first name
FN = 3 # first name
DEF = 0 # Default format (determined by gramps-wide prefs)
LNFN = 1 # last name first name [patronymic]
FNLN = 2 # first name last name
PTFN = 3 # patronymic first name
FN = 4 # first name
DEFAULT_FORMATS = [
(DEF, _("Default format (defined by GRAMPS preferences)"),''),
(LNFN, _("Family name, Given name Patronymic"),''),
(FNLN, _("Given name Family name"),''),
(PTFN, _("Patronymic, Given name"),''),
(FN, _("Given name"),'')
]
def __init__(self,source=None,data=None):
"""creates a new Name instance, copying from the source if provided"""
@@ -98,8 +113,8 @@ class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
self.patronymic = ""
self.sname = '@'
self.group_as = ""
self.sort_as = self.LNFN
self.display_as = self.LNFN
self.sort_as = self.DEF
self.display_as = self.DEF
self.call = ''
def serialize(self):