nickname/call name changes
svn: r6555
This commit is contained in:
parent
508a42d6f4
commit
19236f8c67
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2006-05-05 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsDb/_ReadGedcom.py: nickname changes
|
||||
* src/GrampsDb/_ReadXML.py: nickname changes
|
||||
* src/GrampsDb/_WriteGedcom.py: nickname changes
|
||||
* src/GrampsDb/_WriteXML.py: nickname changes
|
||||
* src/Editors/_EditPerson.py: nickname/call name changes
|
||||
* src/Editors/_EditName.py: nickname/call name changes
|
||||
* src/RelLib/_AttributeType.py: nickname changes
|
||||
* src/RelLib/_Name.py: call name changes
|
||||
* src/RelLib/_Person.py: nickname changes
|
||||
* src/MergePeople.py: nickname elimination
|
||||
|
||||
2006-05-05 Alex Roitman <shura@gramps-project.org>
|
||||
* src/DisplayTabs/_MediaBackRefList.py: Import model.
|
||||
|
||||
|
@ -114,20 +114,34 @@ class EditName(EditSecondary):
|
||||
self.db.readonly)
|
||||
|
||||
self.given_field = MonitoredEntry(
|
||||
self.top.get_widget("alt_given"), self.obj.set_first_name,
|
||||
self.obj.get_first_name, self.db.readonly)
|
||||
self.top.get_widget("alt_given"),
|
||||
self.obj.set_first_name,
|
||||
self.obj.get_first_name,
|
||||
self.db.readonly)
|
||||
|
||||
self.call_field = MonitoredEntry(
|
||||
self.top.get_widget("call"),
|
||||
self.obj.set_call_name,
|
||||
self.obj.get_call_name,
|
||||
self.db.readonly)
|
||||
|
||||
self.title_field = MonitoredEntry(
|
||||
self.top.get_widget("alt_title"), self.obj.set_title,
|
||||
self.obj.get_title, self.db.readonly)
|
||||
self.top.get_widget("alt_title"),
|
||||
self.obj.set_title,
|
||||
self.obj.get_title,
|
||||
self.db.readonly)
|
||||
|
||||
self.suffix_field = MonitoredEntry(
|
||||
self.top.get_widget("alt_suffix"), self.obj.set_suffix,
|
||||
self.obj.get_suffix, self.db.readonly)
|
||||
self.top.get_widget("alt_suffix"),
|
||||
self.obj.set_suffix,
|
||||
self.obj.get_suffix,
|
||||
self.db.readonly)
|
||||
|
||||
self.patronymic_field = MonitoredEntry(
|
||||
self.top.get_widget("patronymic"), self.obj.set_patronymic,
|
||||
self.obj.get_patronymic, self.db.readonly)
|
||||
self.top.get_widget("patronymic"),
|
||||
self.obj.set_patronymic,
|
||||
self.obj.get_patronymic,
|
||||
self.db.readonly)
|
||||
|
||||
self.surname_field = MonitoredEntry(
|
||||
self.top.get_widget("alt_surname"),
|
||||
@ -137,8 +151,10 @@ class EditName(EditSecondary):
|
||||
changed=self.update_group_as)
|
||||
|
||||
self.prefix_field = MonitoredEntry(
|
||||
self.top.get_widget("alt_prefix"), self.obj.set_surname_prefix,
|
||||
self.obj.get_surname_prefix, self.db.readonly)
|
||||
self.top.get_widget("alt_prefix"),
|
||||
self.obj.set_surname_prefix,
|
||||
self.obj.get_surname_prefix,
|
||||
self.db.readonly)
|
||||
|
||||
self.date = MonitoredDate(
|
||||
self.top.get_widget("date"),
|
||||
|
@ -207,6 +207,12 @@ class EditPerson(EditPrimary):
|
||||
self.pname.get_suffix,
|
||||
self.db.readonly)
|
||||
|
||||
self.call = GrampsWidgets.MonitoredEntry(
|
||||
self.top.get_widget("call"),
|
||||
self.pname.set_call_name,
|
||||
self.pname.get_call_name,
|
||||
self.db.readonly)
|
||||
|
||||
self.given = GrampsWidgets.MonitoredEntry(
|
||||
self.top.get_widget("given_name"),
|
||||
self.pname.set_first_name,
|
||||
@ -559,7 +565,7 @@ class EditPerson(EditPrimary):
|
||||
any changes.
|
||||
"""
|
||||
for obj in (self.suffix, self.prefix, self.given, self.title,
|
||||
self.ntype_field, self.surname_field):
|
||||
self.ntype_field, self.surname_field, self.call):
|
||||
obj.update()
|
||||
|
||||
def load_person_image(self):
|
||||
|
@ -2379,13 +2379,19 @@ class GedcomParser:
|
||||
state.name.set_suffix(matches[2])
|
||||
|
||||
def func_name_nick(self,matches,state):
|
||||
state.person.set_nick_name(matches[2])
|
||||
attr = RelLib.Attribute()
|
||||
attr.set_type(RelLib.AttributeType.NICKNAME)
|
||||
attr.set_value(matches[2])
|
||||
state.person.add_attribute(attr)
|
||||
|
||||
def func_name_aka(self,matches,state):
|
||||
lname = matches[2].split()
|
||||
l = len(lname)
|
||||
if l == 1:
|
||||
state.person.set_nick_name(matches[2])
|
||||
attr = RelLib.Attribute()
|
||||
attr.set_type(RelLib.AttributeType.NICKNAME)
|
||||
attr.set_value(matches[2])
|
||||
state.person.add_attribute(attr)
|
||||
else:
|
||||
name = RelLib.Name()
|
||||
name.set_surname(lname[-1])
|
||||
|
@ -1601,7 +1601,10 @@ class GrampsParser:
|
||||
|
||||
def stop_nick(self,tag):
|
||||
if self.person:
|
||||
self.person.set_nick_name(tag)
|
||||
attr = RelLib.Attribute()
|
||||
attr.set_type(RelLib.AttributeType.NICKNAME)
|
||||
attr.set_value(tag)
|
||||
self.person.add_attribute(attr)
|
||||
|
||||
def stop_note(self,tag):
|
||||
self.in_note = 0
|
||||
|
@ -885,13 +885,14 @@ class GedcomWriter:
|
||||
restricted = self.restrict and Utils.probably_alive (person,self.db)
|
||||
self.prefn(person)
|
||||
primaryname = person.get_primary_name ()
|
||||
nickname = ""
|
||||
if restricted and self.living:
|
||||
primaryname = RelLib.Name (primaryname)
|
||||
primaryname.set_first_name ("Living")
|
||||
nickname = ""
|
||||
#nickname = ""
|
||||
else:
|
||||
primaryname = person.get_primary_name ()
|
||||
nickname = person.get_nick_name ()
|
||||
#nickname = person.get_nick_name ()
|
||||
|
||||
if restricted and self.exclnotes:
|
||||
primaryname = RelLib.Name (primaryname)
|
||||
|
@ -397,7 +397,6 @@ class XmlWriter:
|
||||
for name in person.get_alternate_names():
|
||||
self.dump_name(name,True,index+1)
|
||||
|
||||
self.write_line("nick",person.get_nick_name(),index+1)
|
||||
self.dump_event_ref(person.birth_ref,index+1)
|
||||
self.dump_event_ref(person.death_ref,index+1)
|
||||
for event_ref in person.get_event_ref_list():
|
||||
|
@ -456,11 +456,6 @@ class MergePeople:
|
||||
The other person's name is stored as an alternate name if it is
|
||||
not entirely identical to the destination person's primary name.
|
||||
|
||||
In the current implementation, If only one person has a
|
||||
nickname, it is assigned as the merged person's nickname. If
|
||||
both people have nicknames, then the nickname of the second
|
||||
person is lost.
|
||||
|
||||
Remaining alternate names are then added to the merged
|
||||
person's alternate names.
|
||||
"""
|
||||
@ -471,11 +466,6 @@ class MergePeople:
|
||||
if not p2_name.is_equal(p1_name):
|
||||
new.add_alternate_name(p2_name)
|
||||
|
||||
if self.p1.get_nick_name() == "":
|
||||
new.set_nick_name(self.p2.get_nick_name())
|
||||
else:
|
||||
new.set_nick_name(self.p1.get_nick_name())
|
||||
|
||||
for name in self.p1.get_alternate_names():
|
||||
new.add_alternate_name(name)
|
||||
for name in self.p2.get_alternate_names():
|
||||
|
@ -33,6 +33,7 @@ class AttributeType(GrampsType):
|
||||
NATIONAL = 4
|
||||
NUM_CHILD = 5
|
||||
SSN = 6
|
||||
NICKNAME = 7
|
||||
|
||||
_CUSTOM = CUSTOM
|
||||
_DEFAULT = ID
|
||||
@ -47,6 +48,7 @@ class AttributeType(GrampsType):
|
||||
(NUM_CHILD , _("Number of Children"), "Number of Children"),
|
||||
(SSN , _("Social Security Number"), "Social Security Number"),
|
||||
(NUM_CHILD , _("Number of Children"), "Number of Children"),
|
||||
(NICKNAME , _("Nickname"), "Nickname"),
|
||||
]
|
||||
|
||||
_I2SMAP = init_map(_DATAMAP, 0, 1)
|
||||
|
@ -68,7 +68,7 @@ class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
||||
(privacy,source_list,note,date,
|
||||
self.first_name,self.surname,self.suffix,self.title,
|
||||
name_type,self.prefix,self.patronymic,self.sname,
|
||||
self.group_as,self.sort_as,self.display_as) = data
|
||||
self.group_as,self.sort_as,self.display_as,self.call) = data
|
||||
self.type = NameType(name_type)
|
||||
PrivacyBase.unserialize(self,privacy)
|
||||
SourceBase.unserialize(self,source_list)
|
||||
@ -90,6 +90,7 @@ class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
||||
self.group_as = source.group_as
|
||||
self.sort_as = source.sort_as
|
||||
self.display_as = source.display_as
|
||||
self.call = source.call
|
||||
else:
|
||||
PrivacyBase.__init__(self,source)
|
||||
SourceBase.__init__(self,source)
|
||||
@ -106,6 +107,7 @@ class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
||||
self.group_as = ""
|
||||
self.sort_as = self.DEF
|
||||
self.display_as = self.DEF
|
||||
self.call = ''
|
||||
|
||||
def serialize(self):
|
||||
return (PrivacyBase.serialize(self),
|
||||
@ -114,13 +116,13 @@ class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
||||
DateBase.serialize(self),
|
||||
self.first_name,self.surname,self.suffix,self.title,
|
||||
self.type.serialize(),self.prefix,self.patronymic,self.sname,
|
||||
self.group_as,self.sort_as,self.display_as)
|
||||
self.group_as,self.sort_as,self.display_as,self.call)
|
||||
|
||||
def unserialize(self,data):
|
||||
(privacy,source_list,note,date,
|
||||
self.first_name,self.surname,self.suffix,self.title,
|
||||
name_type,self.prefix,self.patronymic,self.sname,
|
||||
self.group_as,self.sort_as,self.display_as) = data
|
||||
self.group_as,self.sort_as,self.display_as,self.call) = data
|
||||
self.type.unserialize(name_type)
|
||||
PrivacyBase.unserialize(self,privacy)
|
||||
SourceBase.unserialize(self,source_list)
|
||||
@ -136,7 +138,7 @@ class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
||||
@rtype: list
|
||||
"""
|
||||
return [self.first_name,self.surname,self.suffix,self.title,
|
||||
str(self.type),self.prefix,self.patronymic]
|
||||
str(self.type),self.prefix,self.patronymic, self.call]
|
||||
|
||||
def get_text_data_child_list(self):
|
||||
"""
|
||||
@ -218,6 +220,20 @@ class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
||||
"""
|
||||
return self.display_as
|
||||
|
||||
def get_call_name(self):
|
||||
"""
|
||||
Returns the call name. The call name's exact definition is not predetermined,
|
||||
and may be locale specific.
|
||||
"""
|
||||
return self.call
|
||||
|
||||
def set_call_name(self,val):
|
||||
"""
|
||||
Returns the call name. The call name's exact definition is not predetermined,
|
||||
and may be locale specific.
|
||||
"""
|
||||
self.call = val
|
||||
|
||||
def get_surname_prefix(self):
|
||||
"""
|
||||
Returns the prefix (or article) of a surname. The prefix is not
|
||||
|
@ -49,6 +49,7 @@ from _EventRef import EventRef
|
||||
from _LdsOrd import LdsOrd
|
||||
from _PersonRef import PersonRef
|
||||
from _MarkerType import MarkerType
|
||||
from _AttributeType import AttributeType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -102,7 +103,6 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
self.event_ref_list = []
|
||||
self.family_list = []
|
||||
self.parent_family_list = []
|
||||
self.nickname = ""
|
||||
self.alternate_names = []
|
||||
self.person_ref_list = []
|
||||
self.gender = Person.UNKNOWN
|
||||
@ -147,23 +147,22 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
self.gender, # 2
|
||||
self.primary_name.serialize(), # 3
|
||||
[name.serialize() for name in self.alternate_names], # 4
|
||||
unicode(self.nickname), # 5
|
||||
death_ref, # 6
|
||||
birth_ref, # 7
|
||||
[er.serialize() for er in self.event_ref_list], # 8
|
||||
self.family_list, # 9
|
||||
self.parent_family_list, # 10
|
||||
MediaBase.serialize(self), # 11
|
||||
AddressBase.serialize(self), # 12
|
||||
AttributeBase.serialize(self), # 13
|
||||
UrlBase.serialize(self), # 14
|
||||
LdsOrdBase.serialize(self), # 15
|
||||
SourceBase.serialize(self), # 16
|
||||
NoteBase.serialize(self), # 17
|
||||
self.change, # 18
|
||||
self.marker.serialize(), # 19
|
||||
self.private, # 20
|
||||
[pr.serialize() for pr in self.person_ref_list] # 21
|
||||
death_ref, # 5
|
||||
birth_ref, # 6
|
||||
[er.serialize() for er in self.event_ref_list], # 7
|
||||
self.family_list, # 8
|
||||
self.parent_family_list, # 9
|
||||
MediaBase.serialize(self), # 10
|
||||
AddressBase.serialize(self), # 11
|
||||
AttributeBase.serialize(self), # 12
|
||||
UrlBase.serialize(self), # 13
|
||||
LdsOrdBase.serialize(self), # 14
|
||||
SourceBase.serialize(self), # 15
|
||||
NoteBase.serialize(self), # 16
|
||||
self.change, # 17
|
||||
self.marker.serialize(), # 18
|
||||
self.private, # 19
|
||||
[pr.serialize() for pr in self.person_ref_list] # 20
|
||||
)
|
||||
|
||||
def unserialize(self, data):
|
||||
@ -181,23 +180,22 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
self.gender, # 2
|
||||
primary_name, # 3
|
||||
alternate_names, # 4
|
||||
self.nickname, # 5
|
||||
death_ref, # 6
|
||||
birth_ref, # 7
|
||||
event_ref_list, # 8
|
||||
self.family_list, # 9
|
||||
self.parent_family_list, # 10
|
||||
media_list, # 11
|
||||
address_list, # 12
|
||||
attribute_list, # 13
|
||||
urls, # 14
|
||||
lds_ord_list, # 15
|
||||
source_list, # 16
|
||||
note, # 17
|
||||
self.change, # 18
|
||||
marker, # 19
|
||||
self.private, # 20
|
||||
person_ref_list, # 21
|
||||
death_ref, # 5
|
||||
birth_ref, # 6
|
||||
event_ref_list, # 7
|
||||
self.family_list, # 8
|
||||
self.parent_family_list, # 9
|
||||
media_list, # 10
|
||||
address_list, # 11
|
||||
attribute_list, # 12
|
||||
urls, # 13
|
||||
lds_ord_list, # 14
|
||||
source_list, # 15
|
||||
note, # 16
|
||||
self.change, # 17
|
||||
marker, # 18
|
||||
self.private, # 19
|
||||
person_ref_list, # 20
|
||||
) = data
|
||||
|
||||
self.marker.unserialize(marker)
|
||||
@ -299,7 +297,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
@return: Returns the list of all textual attributes of the object.
|
||||
@rtype: list
|
||||
"""
|
||||
return [self.nickname, self.gramps_id]
|
||||
return [self.gramps_id]
|
||||
|
||||
def get_text_data_child_list(self):
|
||||
"""
|
||||
@ -402,23 +400,13 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
||||
"""
|
||||
self.alternate_names.append(name)
|
||||
|
||||
def set_nick_name(self, name):
|
||||
"""
|
||||
Sets the nickname field for the Person
|
||||
|
||||
@param name: Nickname to be assigned
|
||||
@type name: str
|
||||
"""
|
||||
self.nickname = name
|
||||
|
||||
def get_nick_name(self) :
|
||||
"""
|
||||
Returns the nickname for the Person
|
||||
|
||||
@returns: Returns the nickname associated with the Person
|
||||
@rtype str
|
||||
"""
|
||||
return self.nickname
|
||||
def get_nick_name(self):
|
||||
nicks = [ attr for attr in self.attribute_list \
|
||||
if int(attr.type) == AttributeType.NICKNAME ]
|
||||
if len(nicks) == 0:
|
||||
return u''
|
||||
else:
|
||||
return nicks[0].get_value()
|
||||
|
||||
def set_gender(self, gender) :
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user