* src/ReadXML.py: name enhancements
* src/WriteXML.py: name enhancements svn: r3596
This commit is contained in:
parent
af09a00cb9
commit
0115ebb09e
@ -2,6 +2,8 @@
|
||||
* src/data/tips.xml: Add more tips.
|
||||
|
||||
2004-10-03 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/ReadXML.py: name enhancements
|
||||
* src/WriteXML.py: name enhancements
|
||||
* src/Date.py: fix get_month_valid call
|
||||
* src/DateDisplay.py: pychecker fixes
|
||||
* src/EditPerson.py: pychecker fixes
|
||||
|
@ -1654,6 +1654,7 @@ class EditPerson:
|
||||
ntype = unicode(self.ntype_field.child.get_text())
|
||||
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()))
|
||||
self.pname.set_first_name(unicode(self.given.get_text()))
|
||||
self.pname.set_title(unicode(self.title.get_text()))
|
||||
|
@ -262,13 +262,14 @@ class PeopleView:
|
||||
def add_person(self,person):
|
||||
node = person.get_handle()
|
||||
top = person.get_primary_name().get_group_name()
|
||||
if len(self.person_model.sname_sub[top]) == 1:
|
||||
if not self.person_model.sname_sub.has_key(top) or \
|
||||
len(self.person_model.sname_sub[top]) == 1:
|
||||
path = self.person_model.on_get_path(top)
|
||||
node = self.person_model.get_iter(path)
|
||||
self.person_model.row_inserted(path,node)
|
||||
pnode = self.person_model.get_iter(path)
|
||||
self.person_model.row_inserted(path,pnode)
|
||||
path = self.person_model.on_get_path(node)
|
||||
node = self.person_model.get_iter(path)
|
||||
self.person_model.row_inserted(path,node)
|
||||
pnode = self.person_model.get_iter(path)
|
||||
self.person_model.row_inserted(path,pnode)
|
||||
|
||||
def delete_person(self,person):
|
||||
node = person.get_handle()
|
||||
|
@ -816,6 +816,10 @@ class GrampsParser:
|
||||
self.name = RelLib.Name()
|
||||
if attrs.has_key("type"):
|
||||
self.name.set_type(attrs["type"])
|
||||
if attrs.has_key("sort"):
|
||||
self.name.set_sort_as(int(attrs["sort"]))
|
||||
if attrs.has_key("display"):
|
||||
self.name.set_display_as(int(attrs["display"]))
|
||||
if attrs.has_key("conf"):
|
||||
self.name.set_confidence(int(attrs["conf"]))
|
||||
else:
|
||||
@ -826,6 +830,8 @@ class GrampsParser:
|
||||
def start_last(self,attrs):
|
||||
if attrs.has_key('prefix'):
|
||||
self.name.set_surname_prefix(attrs['prefix'])
|
||||
if attrs.has_key('group'):
|
||||
self.name.set_group_as(attrs['group'])
|
||||
|
||||
def start_note(self,attrs):
|
||||
self.in_note = 1
|
||||
|
@ -1949,6 +1949,11 @@ class Name(DataObj):
|
||||
self.first_name = name
|
||||
self.build_sort_name()
|
||||
|
||||
def set_patronymic(self,name):
|
||||
"""sets the patronymic name for the Name instance"""
|
||||
self.patronymic = name
|
||||
self.build_sort_name()
|
||||
|
||||
def set_surname(self,name):
|
||||
"""sets the surname (or last name) for the Name instance"""
|
||||
self.surname = name
|
||||
@ -1966,6 +1971,10 @@ class Name(DataObj):
|
||||
"""returns the given name for the Name instance"""
|
||||
return self.first_name
|
||||
|
||||
def get_patronymic(self):
|
||||
"""returns the patronymic name for the Name instance"""
|
||||
return self.patronymic
|
||||
|
||||
def get_surname(self):
|
||||
"""returns the surname (or last name) for the Name instance"""
|
||||
return self.surname
|
||||
|
@ -423,6 +423,13 @@ class XmlWriter:
|
||||
self.g.write(' <bookmark hlink="%s"/>\n' % person_handle)
|
||||
self.g.write(" </bookmarks>\n")
|
||||
|
||||
if len(self.db.name_group) > 0:
|
||||
self.g.write(' <groups>\n')
|
||||
for key in self.db.name_group.keys():
|
||||
self.g.write(' <group_map name="%s" group="%s"/>\n' %
|
||||
(key,self.db.name_group[key]))
|
||||
self.g.write(' </groups>\n')
|
||||
|
||||
self.g.write("</database>\n")
|
||||
|
||||
def fix(self,line):
|
||||
@ -581,10 +588,13 @@ class XmlWriter:
|
||||
def write_last(self,name,indent=1):
|
||||
p = name.get_surname_prefix()
|
||||
n = name.get_surname()
|
||||
g = name.get_group_as()
|
||||
self.g.write('%s<last' % (' '*indent))
|
||||
if p:
|
||||
self.g.write('%s<last prefix="%s">%s</last>\n' % (' '*indent,p,self.fix(n)))
|
||||
else:
|
||||
self.g.write('%s<last>%s</last>\n' % (' '*indent,self.fix(n)))
|
||||
self.g.write(' prefix="%s"' % p)
|
||||
if g:
|
||||
self.g.write(' group="%s"' % g)
|
||||
self.g.write('>%s</last>\n' % self.fix(n))
|
||||
|
||||
def write_line(self,label,value,indent=1):
|
||||
if value:
|
||||
@ -647,13 +657,20 @@ class XmlWriter:
|
||||
def dump_name(self,label,name,index=1):
|
||||
sp = " "*index
|
||||
name_type = name.get_type()
|
||||
self.g.write('%s<%s' % (sp,label))
|
||||
if name_type:
|
||||
self.g.write('%s<%s type="%s"%s>\n' % (sp,label,name_type,conf_priv(name)))
|
||||
else:
|
||||
self.g.write('%s<%s%s>\n' % (sp,label,conf_priv(name)))
|
||||
self.g.write(' type="%s"' % name_type)
|
||||
if name.get_privacy() != 0:
|
||||
self.g.write(' priv="%d"' % name.get_privacy())
|
||||
if name.get_sort_as() != 0:
|
||||
self.g.write(' sort="%d"' % name.get_sort_as())
|
||||
if name.get_display_as() != 0:
|
||||
self.g.write(' display="%d"' % name.get_display_as())
|
||||
self.g.write('>\n')
|
||||
self.write_line("first",name.get_first_name(),index+1)
|
||||
self.write_last(name,index+1)
|
||||
self.write_line("suffix",name.get_suffix(),index+1)
|
||||
self.write_line("patronymic",name.get_patronymic(),index+1)
|
||||
self.write_line("title",name.get_title(),index+1)
|
||||
if name.get_note() != "":
|
||||
self.write_note("note",name.get_note_object(),index+1)
|
||||
|
Loading…
Reference in New Issue
Block a user