4345: TIME on eventdate
svn: r16186
This commit is contained in:
parent
e1c13eb4f0
commit
e471c4d08e
@ -1101,13 +1101,17 @@ class GedcomWriter(UpdateCallback):
|
||||
"""
|
||||
dateobj = event.get_date_object()
|
||||
self.__date(2, dateobj)
|
||||
if self.__datewritten:
|
||||
#write out TIME if present
|
||||
pass
|
||||
|
||||
place = None
|
||||
|
||||
times = [ attr.get_value() for attr in event.get_attribute_list()
|
||||
if int(attr.get_type()) == gen.lib.AttributeType.TIME ]
|
||||
|
||||
# Not legal, but inserted by PhpGedView
|
||||
if len(times) > 0 and dateobj:
|
||||
if len(times) > 0 and self.__datewritten:
|
||||
time = times[0]
|
||||
self.__writeln(3, 'TIME', time)
|
||||
|
||||
@ -1197,6 +1201,7 @@ class GedcomWriter(UpdateCallback):
|
||||
Write the 'DATE' GEDCOM token, along with the date in GEDCOM's
|
||||
expected format.
|
||||
"""
|
||||
self.__datewritten = True
|
||||
start = date.get_start_date()
|
||||
if start != gen.lib.Date.EMPTY:
|
||||
cal = date.get_calendar()
|
||||
@ -1217,6 +1222,8 @@ class GedcomWriter(UpdateCallback):
|
||||
self.__writeln(level, 'DATE', val)
|
||||
elif date.get_text():
|
||||
self.__writeln(level, 'DATE', date.get_text())
|
||||
else:
|
||||
self.__datewritten = False
|
||||
|
||||
def __person_name(self, name, attr_nick):
|
||||
"""
|
||||
|
@ -247,7 +247,6 @@ TOKEN_LONG = 122
|
||||
TOKEN_FACT = 123
|
||||
TOKEN_EMAIL = 124
|
||||
TOKEN_WWW = 125
|
||||
TOKEN__TIME = 126
|
||||
|
||||
TOKENS = {
|
||||
"HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI,
|
||||
@ -349,7 +348,6 @@ TOKENS = {
|
||||
"_PAREN" : TOKEN_IGNORE,"_PLACE" : TOKEN_IGNORE,
|
||||
"FACT" : TOKEN_FACT, "EMAIL" : TOKEN_EMAIL,
|
||||
"EMAI" : TOKEN_EMAIL, "WWW" : TOKEN_WWW,
|
||||
"_TIME" : TOKEN__TIME,
|
||||
}
|
||||
|
||||
ADOPT_NONE = 0
|
||||
@ -1922,8 +1920,7 @@ class GedcomParser(UpdateCallback):
|
||||
TOKEN__WTN : self.__event_witness,
|
||||
TOKEN_RELI : self.__ignore,
|
||||
# Not legal, but inserted by PhpGedView
|
||||
TOKEN_TIME : self.__event_time,
|
||||
TOKEN__TIME : self.__event_time,
|
||||
TOKEN_TIME : self.__event_time,
|
||||
TOKEN_ASSO : self.__ignore,
|
||||
TOKEN_IGNORE : self.__ignore,
|
||||
TOKEN_STAT : self.__ignore,
|
||||
@ -4537,10 +4534,12 @@ class GedcomParser(UpdateCallback):
|
||||
@param state: The current state
|
||||
@type state: CurrentState
|
||||
"""
|
||||
attr = gen.lib.Attribute()
|
||||
attr.set_type(gen.lib.AttributeType.TIME)
|
||||
attr.set_value(line.data)
|
||||
state.event.add_attribute(attr)
|
||||
if hasattr(state, 'event'):
|
||||
#read in time as attribute of event
|
||||
attr = gen.lib.Attribute()
|
||||
attr.set_type(gen.lib.AttributeType.TIME)
|
||||
attr.set_value(line.data)
|
||||
state.event.add_attribute(attr)
|
||||
|
||||
def __event_witness(self, line, state):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user