* src/GrampsDb/_ReadGedcom.py: RESN support

* src/GrampsDb/_WriteGedcom.py: RESN support
	* src/GrampsDb/_GedTokens.py: RESN support


svn: r7243
This commit is contained in:
Don Allingham 2006-08-23 03:53:17 +00:00
parent eba0cad3ab
commit 9915c3265c
4 changed files with 19 additions and 4 deletions

View File

@ -1,4 +1,7 @@
2006-08-22 Don Allingham <don@gramps-project.org> 2006-08-22 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: RESN support
* src/GrampsDb/_WriteGedcom.py: RESN support
* src/GrampsDb/_GedTokens.py: RESN support
* src/GrampsDb/_WriteGedcom.py: apply event type string conversion * src/GrampsDb/_WriteGedcom.py: apply event type string conversion
fix to family types fix to family types

View File

@ -130,6 +130,7 @@ TOKEN_BLOB = 110
TOKEN_CONL = 111 TOKEN_CONL = 111
TOKEN_AGE = 112 TOKEN_AGE = 112
TOKEN_AGNC = 113 TOKEN_AGNC = 113
TOKEN_RESN = 114
tokens = { tokens = {
"HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI, "HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI,
@ -221,5 +222,5 @@ tokens = {
"_SCBK" : TOKEN_IGNORE,"_TYPE" : TOKEN_IGNORE, "_SCBK" : TOKEN_IGNORE,"_TYPE" : TOKEN_IGNORE,
"_PRIM" : TOKEN_IGNORE,"_SSHOW" : TOKEN_IGNORE, "_PRIM" : TOKEN_IGNORE,"_SSHOW" : TOKEN_IGNORE,
"_PAREN" : TOKEN_IGNORE,"BLOB" : TOKEN_BLOB, "_PAREN" : TOKEN_IGNORE,"BLOB" : TOKEN_BLOB,
"CONL" : TOKEN_CONL, "CONL" : TOKEN_CONL, "RESN" : TOKEN_RESN,
} }

View File

@ -624,6 +624,7 @@ class GedcomParser(UpdateCallback):
TOKEN_EVEN : self.func_person_even, TOKEN_EVEN : self.func_person_even,
TOKEN_SOUR : self.func_person_sour, TOKEN_SOUR : self.func_person_sour,
TOKEN_REFN : self.func_person_refn, TOKEN_REFN : self.func_person_refn,
TOKEN_RESN : self.func_person_resn,
TOKEN_AFN : self.func_person_attr, TOKEN_AFN : self.func_person_attr,
TOKEN_RFN : self.func_person_attr, TOKEN_RFN : self.func_person_attr,
TOKEN__UID : self.func_person_attr, TOKEN__UID : self.func_person_attr,
@ -2949,6 +2950,11 @@ class GedcomParser(UpdateCallback):
attr.set_value(matches[2]) attr.set_value(matches[2])
state.person.add_attribute(attr) state.person.add_attribute(attr)
def func_person_resn(self,matches,state):
attr = RelLib.Attribute()
attr.set_type((RelLib.AttributeType.CUSTOM, 'RESN'))
state.person.add_attribute(attr)
def func_person_event(self,matches,state): def func_person_event(self,matches,state):
n = matches[3].strip() n = matches[3].strip()
if self.gedattr.has_key(n): if self.gedattr.has_key(n):

View File

@ -1023,11 +1023,16 @@ class GedcomWriter(UpdateCallback):
t = int(attr.get_type()) t = int(attr.get_type())
name = GedcomInfo.personalConstantAttributes.get(t) name = GedcomInfo.personalConstantAttributes.get(t)
key = str(attr.get_type())
value = self.cnvtxt(attr.get_value().strip()).replace('\r',' ') value = self.cnvtxt(attr.get_value().strip()).replace('\r',' ')
# if name in ["AFN", "RFN", "_UID"]: if key in ("AFN", "RFN", "_UID"):
# self.writeln("1 %s %s" % (name,value)) self.writeln("1 %s %s" % (name,value))
# continue continue
if key == "RESN":
self.writeln("1 RESN")
continue
if name and name.strip(): if name and name.strip():
self.writeln("1 %s %s" % (name,value)) self.writeln("1 %s %s" % (name,value))