0008355: Gramps can't [GEDCOM] import estim. date period exported by

itself

Changed output format to DATE EST FROM TO and DATE CALC FROM TO. Also
changed in Narrative Web (which uses the same functions).
This commit is contained in:
kulath 2015-03-31 10:48:44 +01:00
parent 672bffe620
commit f022597545
2 changed files with 25 additions and 13 deletions

View File

@ -1170,16 +1170,22 @@ class GedcomWriter(UpdateCallback):
cal = date.get_calendar() cal = date.get_calendar()
mod = date.get_modifier() mod = date.get_modifier()
quality = date.get_quality() quality = date.get_quality()
if quality in libgedcom.DATE_QUALITY:
qual_text = libgedcom.DATE_QUALITY[quality] + " "
else:
qual_text = ""
if mod == Date.MOD_SPAN: if mod == Date.MOD_SPAN:
val = "FROM %s TO %s" % ( val = "%sFROM %s TO %s" % (
libgedcom.make_gedcom_date(start, cal, mod, quality), qual_text,
libgedcom.make_gedcom_date(start, cal, mod, None),
libgedcom.make_gedcom_date(date.get_stop_date(), libgedcom.make_gedcom_date(date.get_stop_date(),
cal, mod, quality)) cal, mod, None))
elif mod == Date.MOD_RANGE: elif mod == Date.MOD_RANGE:
val = "BET %s AND %s" % ( val = "%sBET %s AND %s" % (
libgedcom.make_gedcom_date(start, cal, mod, quality), qual_text,
libgedcom.make_gedcom_date(start, cal, mod, None),
libgedcom.make_gedcom_date(date.get_stop_date(), libgedcom.make_gedcom_date(date.get_stop_date(),
cal, mod, quality)) cal, mod, None))
else: else:
val = libgedcom.make_gedcom_date(start, cal, mod, quality) val = libgedcom.make_gedcom_date(start, cal, mod, quality)
self._writeln(level, 'DATE', val) self._writeln(level, 'DATE', val)

View File

@ -142,7 +142,7 @@ from gramps.plugins.lib.libhtml import Html, xml_lang
# import styled notes from src/plugins/lib/libhtmlbackend.py # import styled notes from src/plugins/lib/libhtmlbackend.py
from gramps.plugins.lib.libhtmlbackend import HtmlBackend, process_spaces from gramps.plugins.lib.libhtmlbackend import HtmlBackend, process_spaces
from gramps.plugins.lib.libgedcom import make_gedcom_date from gramps.plugins.lib.libgedcom import make_gedcom_date, DATE_QUALITY
from gramps.gen.utils.place import conv_lat_lon from gramps.gen.utils.place import conv_lat_lon
from gramps.gui.pluginmanager import GuiPluginManager from gramps.gui.pluginmanager import GuiPluginManager
@ -517,14 +517,20 @@ def format_date(date):
cal = date.get_calendar() cal = date.get_calendar()
mod = date.get_modifier() mod = date.get_modifier()
quality = date.get_quality() quality = date.get_quality()
if quality in libgedcom.DATE_QUALITY:
qual_text = libgedcom.DATE_QUALITY[quality] + " "
else:
qual_text = ""
if mod == Date.MOD_SPAN: if mod == Date.MOD_SPAN:
val = "FROM %s TO %s" % ( val = "%sFROM %s TO %s" % (
make_gedcom_date(start, cal, mod, quality), qual_text,
make_gedcom_date(date.get_stop_date(), cal, mod, quality)) make_gedcom_date(start, cal, mod, None),
make_gedcom_date(date.get_stop_date(), cal, mod, None))
elif mod == Date.MOD_RANGE: elif mod == Date.MOD_RANGE:
val = "BET %s AND %s" % ( val = "%sBET %s AND %s" % (
make_gedcom_date(start, cal, mod, quality), qual_text,
make_gedcom_date(date.get_stop_date(), cal, mod, quality)) make_gedcom_date(start, cal, mod, None),
make_gedcom_date(date.get_stop_date(), cal, mod, None))
else: else:
val = make_gedcom_date(start, cal, mod, quality) val = make_gedcom_date(start, cal, mod, quality)
return val return val