From 062da0f9ac4953a881891fc51bd4ae7ec53f6f8b Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 25 Jan 2008 21:47:38 +0000 Subject: [PATCH] 2008-01-25 Douglas S. Blank * src/GrampsDbUtils/_WriteGedcom.py (GedcomWriter.__date): applied quality patch (with fixes) from issue #1210 svn: r9934 --- ChangeLog | 4 ++++ src/GrampsDbUtils/_WriteGedcom.py | 34 ++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 88d121950..187216465 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-01-25 Douglas S. Blank + * src/GrampsDbUtils/_WriteGedcom.py (GedcomWriter.__date): + applied quality patch (with fixes) from issue #1210 + 2008-01-24 Brian Matherly * src/plugins/KinshipReport.py: Include count for each category. diff --git a/src/GrampsDbUtils/_WriteGedcom.py b/src/GrampsDbUtils/_WriteGedcom.py index 8b17a387e..a3c82b6c4 100644 --- a/src/GrampsDbUtils/_WriteGedcom.py +++ b/src/GrampsDbUtils/_WriteGedcom.py @@ -79,11 +79,17 @@ CALENDAR_MAP = { } DATE_MODIFIER = { - gen.lib.Date.MOD_ABOUT : "ABT", - gen.lib.Date.MOD_BEFORE : "BEF", - gen.lib.Date.MOD_AFTER : "AFT", + gen.lib.Date.MOD_ABOUT : "ABT", + gen.lib.Date.MOD_BEFORE : "BEF", + gen.lib.Date.MOD_AFTER : "AFT", + #RelLib.Date.MOD_INTERPRETED : "INT", } +DATE_QUALITY = { + RelLib.Date.QUAL_CALCULATED : "CAL", + RelLib.Date.QUAL_ESTIMATED : "EST", +} + LDS_ORD_NAME = { gen.lib.LdsOrd.BAPTISM : 'BAPL', gen.lib.LdsOrd.ENDOWMENT : 'ENDL', @@ -175,7 +181,7 @@ def sort_handles_by_id(handle_list, handle_to_object): # make_date # #------------------------------------------------------------------------- -def make_date(subdate, calendar, mode): +def make_date(subdate, calendar, mode, quality): """ Converts a GRAMPS date structure into a GEDCOM compatible date """ @@ -200,7 +206,10 @@ def make_date(subdate, calendar, mode): retval = "%s %s" % (prefix, retval) if DATE_MODIFIER.has_key(mode): - retval = "%s %s" % (DATE_MODIFIER[mode], retval) + retval = "%s %s" % (DATE_MODIFIER[mode], retval) + + if DATE_QUALITY.has_key(quality): + retval = "%s %s" % (DATE_QUALITY[quality], retval) return retval @@ -1202,16 +1211,17 @@ class GedcomWriter(BasicUtils.UpdateCallback): if start != gen.lib.Date.EMPTY: cal = date.get_calendar() mod = date.get_modifier() - if date.get_modifier() == gen.lib.Date.MOD_SPAN: + quality = date.get_quality() + if mod == RelLib.Date.MOD_SPAN: val = "FROM %s TO %s" % ( - make_date(start, cal, mod), - make_date(date.get_stop_date(), cal, mod)) - elif date.get_modifier() == gen.lib.Date.MOD_RANGE: + make_date(start, cal, mod, quality), + make_date(date.get_stop_date(), cal, mod, quality)) + elif mod == RelLib.Date.MOD_RANGE: val = "BET %s AND %s" % ( - make_date(start, cal, mod), - make_date(date.get_stop_date(), cal, mod)) + make_date(start, cal, mod, quality), + make_date(date.get_stop_date(), cal, mod, quality)) else: - val = make_date(start, cal, mod) + val = make_date(start, cal, mod, quality) self.__writeln(level, 'DATE', val) elif date.get_text(): self.__writeln(level, 'DATE', date.get_text())