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