2008-01-25 Douglas S. Blank <dblank@cs.brynmawr.edu>

* src/GrampsDbUtils/_WriteGedcom.py (GedcomWriter.__date): 
	applied quality patch (with fixes) from issue #1210



svn: r9934
This commit is contained in:
Doug Blank 2008-01-25 21:47:38 +00:00
parent bd01643099
commit 062da0f9ac
2 changed files with 26 additions and 12 deletions

View File

@ -1,3 +1,7 @@
2008-01-25 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/GrampsDbUtils/_WriteGedcom.py (GedcomWriter.__date):
applied quality patch (with fixes) from issue #1210
2008-01-24 Brian Matherly <brian@gramps-project.org> 2008-01-24 Brian Matherly <brian@gramps-project.org>
* src/plugins/KinshipReport.py: Include count for each category. * src/plugins/KinshipReport.py: Include count for each category.

View File

@ -79,11 +79,17 @@ CALENDAR_MAP = {
} }
DATE_MODIFIER = { DATE_MODIFIER = {
gen.lib.Date.MOD_ABOUT : "ABT", gen.lib.Date.MOD_ABOUT : "ABT",
gen.lib.Date.MOD_BEFORE : "BEF", gen.lib.Date.MOD_BEFORE : "BEF",
gen.lib.Date.MOD_AFTER : "AFT", 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 = { LDS_ORD_NAME = {
gen.lib.LdsOrd.BAPTISM : 'BAPL', gen.lib.LdsOrd.BAPTISM : 'BAPL',
gen.lib.LdsOrd.ENDOWMENT : 'ENDL', gen.lib.LdsOrd.ENDOWMENT : 'ENDL',
@ -175,7 +181,7 @@ def sort_handles_by_id(handle_list, handle_to_object):
# make_date # 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 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) retval = "%s %s" % (prefix, retval)
if DATE_MODIFIER.has_key(mode): 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 return retval
@ -1202,16 +1211,17 @@ class GedcomWriter(BasicUtils.UpdateCallback):
if start != gen.lib.Date.EMPTY: if start != gen.lib.Date.EMPTY:
cal = date.get_calendar() cal = date.get_calendar()
mod = date.get_modifier() 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" % ( val = "FROM %s TO %s" % (
make_date(start, cal, mod), make_date(start, cal, mod, quality),
make_date(date.get_stop_date(), cal, mod)) make_date(date.get_stop_date(), cal, mod, quality))
elif date.get_modifier() == gen.lib.Date.MOD_RANGE: elif mod == RelLib.Date.MOD_RANGE:
val = "BET %s AND %s" % ( val = "BET %s AND %s" % (
make_date(start, cal, mod), make_date(start, cal, mod, quality),
make_date(date.get_stop_date(), cal, mod)) make_date(date.get_stop_date(), cal, mod, quality))
else: else:
val = make_date(start, cal, mod) val = make_date(start, cal, mod, quality)
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())