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