* src/Calendar.py: removed

* src/Gregorian.py: removed
* src/Hebrew.py: removed
* src/Julian.py: removed
* src/calendars/Islamic.py: removed
* src/calendars/Persian.py: removed
* src/calendars/Makefile.am: removed
* src/Date.py: New, simpler date structure
* src/DateHandler.py: Start of a class to abstract and select
parser and display functions based off locale
* src/DateParser.py: base date parsing class (US English)
* src/DateDisplay.py: base date display class (US English)
* src/DateEdit.py: handle new date method
* src/EditPerson.py: handle new date method
* src/EventEdit.py: handle new date method
* src/GrampsCfg.py: removed redundant options due to new date class
* src/StartupDialog.py: removed redundant options due to new date class
* src/Makefile.am: handle file changes
* src/Sort.py: handle new date method
* src/ReadGedcom.py: handle new date method
* src/ReadXML.py: handle new date method
* src/WriteGedcom.py: handle new date method
* src/WriteXML.py: handle new date method
* src/RelLib.py: handle new date method
* src/gramps_main.py: handle new date method
* src/gramps.glade: handle new date method


svn: r3546
This commit is contained in:
Don Allingham
2004-09-17 03:30:04 +00:00
parent 46b32a5619
commit 33f604cb11
27 changed files with 1827 additions and 2285 deletions

View File

@@ -49,9 +49,10 @@ import gtk
#
#-------------------------------------------------------------------------
import const
import Calendar
import Gregorian
import RelLib
import Date
from gettext import gettext as _
from QuestionDialog import ErrorDialog
@@ -590,31 +591,48 @@ class XmlWriter:
if value:
self.g.write('%s<%s>%s</%s>\n' % (' '*indent,label,self.fix(value),label))
def get_iso_date(self,date):
if date[2] == 0:
y = "????"
else:
y = "%04d" % date[2]
if date[1] == 0:
if date[0] == 0:
m = ""
else:
m = "-??"
else:
m = "-%02d" % (date[1])
if date[0] == 0:
d = ''
else:
d = "-%02d" % date[0]
return "%s%s%s" % (y,m,d)
def write_date(self,date,indent=1):
sp = ' '*indent
if date.is_empty():
return
name = date.get_calendar().NAME
if name != Gregorian.Gregorian.NAME:
calstr = ' cformat="%s"' % name
cal= date.get_calendar()
if cal != Date.CAL_GREGORIAN:
calstr = ' cformat="%s"' % Date.Date.calendar_names[cal]
else:
calstr = ''
if date.is_range():
d1 = date.get_start_date().get_iso_date()
d2 = date.get_stop_date().get_iso_date()
mode = date.get_modifier()
if date.is_compound():
d1 = self.get_iso_date(date.get_start_date())
d2 = self.get_iso_date(date.get_stop_date())
self.g.write('%s<daterange start="%s" stop="%s"%s/>\n' % (sp,d1,d2,calstr))
elif date.is_valid():
d1 = date.get_start_date()
mode = d1.get_mode_val()
dstr = d1.get_iso_date()
elif mode != Date.MOD_TEXTONLY:
dstr = self.get_iso_date(date.get_start_date())
if mode == Calendar.BEFORE:
if mode == Date.MOD_BEFORE:
pref = ' type="before"'
elif mode == Calendar.AFTER:
elif mode == Date.MOD_AFTER:
pref = ' type="after"'
elif mode == Calendar.ABOUT:
elif mode == Date.MOD_ABOUT:
pref = ' type="about"'
else:
pref = ""