Use custom SrcAttributeType in GEDCOM import/export

This commit is contained in:
Nick Hall 2014-05-17 18:33:00 +01:00
parent 4aede124fa
commit 61ba0edd25
2 changed files with 5 additions and 5 deletions

View File

@ -1314,13 +1314,13 @@ class GedcomWriter(UpdateCallback):
even = None
for srcattr in citation.get_attribute_list():
if srcattr.type == SrcAttributeType.EVEN_CITED:
if str(srcattr.type) == "EVEN":
even = srcattr.value
self._writeln(level+1, "EVEN", even)
break
if even:
for srcattr in citation.get_attribute_list():
if srcattr.type == SrcAttributeType.EVEN_ROLE:
if str(srcattr.type) == "EVEN:ROLE":
self._writeln(level+2, "ROLE", srcattr.value)
break

View File

@ -5986,7 +5986,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.EVEN_CITED)
sattr.set_type("EVEN")
sattr.set_value(line.data)
state.citation.add_attribute(sattr)
sub_state = CurrentState(level=state.level+1)
@ -6005,7 +6005,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.EVEN_ROLE)
sattr.set_type("EVEN:ROLE")
sattr.set_value(line.data)
state.citation.add_attribute(sattr)
@ -6775,7 +6775,7 @@ class GedcomParser(UpdateCallback):
if self.use_def_src:
# feature request 2356: avoid genitive form
sattr = SrcAttribute()
sattr.set_type(SrcAttributeType.GEN_BY)
sattr.set_type(_("Generated By"))
sattr.set_value("%s %s" % (self.genby, self.genvers))
self.def_src.add_attribute(sattr)