GEPS008: Re-structure date handler files

svn: r19651
This commit is contained in:
Nick Hall 2012-05-25 23:19:10 +00:00
parent 7d223409b5
commit 355bbd6d7b
117 changed files with 410 additions and 419 deletions

View File

@ -95,6 +95,7 @@ src/Makefile
src/cli/Makefile
src/cli/plug/Makefile
src/gen/Makefile
src/gen/datehandler/Makefile
src/gen/db/Makefile
src/gen/display/Makefile
src/gen/filters/Makefile
@ -154,7 +155,6 @@ src/plugins/webstuff/Makefile
src/plugins/webstuff/css/Makefile
src/plugins/webstuff/images/Makefile
src/plugins/webstuff/javascript/Makefile
src/DateHandler/Makefile
src/data/Makefile
src/glade/Makefile
src/images/Makefile

View File

@ -23,27 +23,6 @@ src/TreeTips.py
src/cli/__init__.py
src/cli/user.py
# DateHandler package
src/DateHandler/_Date_bg.py
src/DateHandler/_Date_cs.py
src/DateHandler/_Date_de.py
src/DateHandler/_DateDisplay.py
src/DateHandler/_Date_es.py
src/DateHandler/_Date_fi.py
src/DateHandler/_Date_fr.py
src/DateHandler/_DateHandler.py
src/DateHandler/_Date_lt.py
src/DateHandler/_Date_nb.py
src/DateHandler/_Date_nl.py
src/DateHandler/_Date_pl.py
src/DateHandler/_Date_pt.py
src/DateHandler/_DateParser.py
src/DateHandler/_Date_ru.py
src/DateHandler/_Date_sk.py
src/DateHandler/_Date_sv.py
src/DateHandler/_Date_zh.py
src/DateHandler/__init__.py
# gen
src/gen/user.py
@ -51,6 +30,27 @@ src/gen/user.py
src/gen/__init__.py
src/gen/updatecallback.py
# gen.datehandler package
src/gen/datehandler/_date_bg.py
src/gen/datehandler/_date_cs.py
src/gen/datehandler/_date_de.py
src/gen/datehandler/_datedisplay.py
src/gen/datehandler/_date_es.py
src/gen/datehandler/_date_fi.py
src/gen/datehandler/_date_fr.py
src/gen/datehandler/_datehandler.py
src/gen/datehandler/_date_lt.py
src/gen/datehandler/_date_nb.py
src/gen/datehandler/_date_nl.py
src/gen/datehandler/_date_pl.py
src/gen/datehandler/_date_pt.py
src/gen/datehandler/_dateparser.py
src/gen/datehandler/_date_ru.py
src/gen/datehandler/_date_sk.py
src/gen/datehandler/_date_sv.py
src/gen/datehandler/_date_zh.py
src/gen/datehandler/__init__.py
# gen db API
src/gen/db/__init__.py
src/gen/db/backup.py

View File

@ -63,7 +63,7 @@ import gtk
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
from gen.lib.date import Date, NextYear
import DateHandler
import gen.datehandler
import const
import GrampsDisplay
import ManagedWindow
@ -90,13 +90,13 @@ QUAL_TEXT = (
(Date.QUAL_CALCULATED, _('Calculated')) )
CAL_TO_MONTHS_NAMES = {
Date.CAL_GREGORIAN : DateHandler.displayer.short_months,
Date.CAL_JULIAN : DateHandler.displayer.short_months,
Date.CAL_HEBREW : DateHandler.displayer.hebrew,
Date.CAL_FRENCH : DateHandler.displayer.french,
Date.CAL_PERSIAN : DateHandler.displayer.persian,
Date.CAL_ISLAMIC : DateHandler.displayer.islamic,
Date.CAL_SWEDISH : DateHandler.displayer.swedish }
Date.CAL_GREGORIAN : gen.datehandler.displayer.short_months,
Date.CAL_JULIAN : gen.datehandler.displayer.short_months,
Date.CAL_HEBREW : gen.datehandler.displayer.hebrew,
Date.CAL_FRENCH : gen.datehandler.displayer.french,
Date.CAL_PERSIAN : gen.datehandler.displayer.persian,
Date.CAL_ISLAMIC : gen.datehandler.displayer.islamic,
Date.CAL_SWEDISH : gen.datehandler.displayer.swedish }
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_1' % const.URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Editing_Dates')
@ -133,14 +133,14 @@ class DateEdit(object):
self.text_obj.connect('content-changed', self.set_date)
self.button_obj.connect('clicked', self.invoke_date_editor)
self.text_obj.set_text(DateHandler.displayer.display(self.date_obj))
self.text_obj.set_text(gen.datehandler.displayer.display(self.date_obj))
self.text_obj.validate()
def set_date(self, widget):
"""
Parse date from text entry to date object
"""
date = DateHandler.parser.parse(unicode(self.text_obj.get_text()))
date = gen.datehandler.parser.parse(unicode(self.text_obj.get_text()))
self.date_obj.copy(date)
def validate(self, widget, data):
@ -171,7 +171,7 @@ class DateEdit(object):
if date_obj:
# first we set the text entry, that emits 'content-changed'
# signal thus the date object gets updated too
self.text_obj.set_text(DateHandler.displayer.display(date_obj))
self.text_obj.set_text(gen.datehandler.displayer.display(date_obj))
self.text_obj.validate()
#-------------------------------------------------------------------------

View File

@ -1,53 +0,0 @@
# This is the src/DateHandler level Makefile for Gramps
# $Id$
# We could use GNU make's ':=' syntax for nice wildcard use,
# but that is not necessarily portable.
# If not using GNU make, then list all .py files individually
pkgpython_PYTHON = \
_Date_bg.py\
_Date_ca.py\
_Date_cs.py\
_Date_da.py\
_Date_de.py\
_Date_es.py\
_Date_fi.py\
_Date_fr.py\
_Date_hr.py\
_Date_it.py\
_Date_lt.py\
_Date_nb.py\
_Date_nl.py\
_Date_pl.py\
_Date_pt.py\
_Date_ru.py\
_Date_sk.py\
_Date_sl.py\
_Date_sr.py\
_Date_sv.py\
_DateDisplay.py\
_DateParser.py\
_DateHandler.py\
_DateUtils.py\
__init__.py
pkgpyexecdir = @pkgpyexecdir@/DateHandler
pkgpythondir = $(datadir)/@PACKAGE@/DateHandler
# Clean up all the byte-compiled files
MOSTLYCLEANFILES = *pyc *pyo
GRAMPS_PY_MODPATH = ".."
docfiles=\
_DateDisplay.py\
_DateParser.py\
_DateHandler.py\
_DateUtils.py
docs:
export PYTHONPATH='..'; epydoc --graph=umlclasstree -o ../html --url http://gramps-project.org --name GRAMPS --html $(docfiles)
pycheck:
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
pychecker $(pkgpython_PYTHON));

View File

@ -4,7 +4,6 @@
SUBDIRS = \
cli \
data \
DateHandler \
docgen \
gen \
glade \

View File

@ -36,7 +36,7 @@ from gen.ggettext import sgettext as _
import const
import GrampsDisplay
import ManagedWindow
import DateHandler
import gen.datehandler
from Errors import MergeError
from Utils import confidence
@ -84,8 +84,8 @@ class MergeCitations(ManagedWindow.ManagedWindow):
entry1 = self.get_widget("date1")
entry2 = self.get_widget("date2")
entry1.set_text(DateHandler.get_date(self.citation1))
entry2.set_text(DateHandler.get_date(self.citation2))
entry1.set_text(gen.datehandler.get_date(self.citation1))
entry2.set_text(gen.datehandler.get_date(self.citation2))
if entry1.get_text() == entry2.get_text():
for widget_name in ('date1', 'date2', 'date_btn1',
'date_btn2'):

View File

@ -35,7 +35,7 @@ from gen.ggettext import sgettext as _
import const
import GrampsDisplay
import ManagedWindow
import DateHandler
import gen.datehandler
import Utils
from Errors import MergeError
@ -83,8 +83,8 @@ class MergeEvents(ManagedWindow.ManagedWindow):
entry1 = self.get_widget("date1")
entry2 = self.get_widget("date2")
entry1.set_text(DateHandler.get_date(self.ev1))
entry2.set_text(DateHandler.get_date(self.ev2))
entry1.set_text(gen.datehandler.get_date(self.ev1))
entry2.set_text(gen.datehandler.get_date(self.ev2))
if entry1.get_text() == entry2.get_text():
for widget_name in ('date1', 'date2', 'date_btn1', 'date_btn2'):
self.get_widget(widget_name).set_sensitive(False)

View File

@ -35,7 +35,7 @@ from gen.ggettext import sgettext as _
import const
import GrampsDisplay
import ManagedWindow
import DateHandler
import gen.datehandler
from Errors import MergeError
#-------------------------------------------------------------------------
@ -92,8 +92,8 @@ class MergeMediaObjects(ManagedWindow.ManagedWindow):
entry1 = self.get_widget("date1")
entry2 = self.get_widget("date2")
entry1.set_text(DateHandler.get_date(self.mo1))
entry2.set_text(DateHandler.get_date(self.mo2))
entry1.set_text(gen.datehandler.get_date(self.mo1))
entry2.set_text(gen.datehandler.get_date(self.mo2))
if entry1.get_text() == entry2.get_text():
for widget_name in ('date1', 'date2', 'date_btn1', 'date_btn2'):
self.get_widget(widget_name).set_sensitive(False)

View File

@ -44,7 +44,7 @@ from gen.plug.report import utils as ReportUtils
from gen.display.name import displayer as name_displayer
import const
import GrampsDisplay
import DateHandler
import gen.datehandler
from QuestionDialog import ErrorDialog
from Errors import MergeError
import ManagedWindow
@ -277,7 +277,7 @@ class MergePeople(ManagedWindow.ManagedWindow):
place = ""
if handle:
event = self.database.get_event_from_handle(handle)
date = DateHandler.get_date(event)
date = gen.datehandler.get_date(event)
place = self.place_name(event)
if date:
return ("%s, %s" % (date, place)) if place else date

View File

@ -47,7 +47,7 @@ from gtk.gdk import ACTION_COPY, BUTTON1_MASK, ACTION_MOVE
import const
import config
import gen.lib
import DateHandler
import gen.datehandler
import GrampsDisplay
import ManagedWindow
from gen.ggettext import sgettext as _
@ -294,7 +294,7 @@ class ScratchAddress(ScratchObjWrapper):
def refresh(self):
if self._obj:
self._title = DateHandler.get_date(self._obj)
self._title = gen.datehandler.get_date(self._obj)
self._value = "%s %s %s %s" % (self._obj.get_street(),
self._obj.get_city(),
self._obj.get_state(),

View File

@ -30,7 +30,7 @@ from __future__ import with_statement
from types import NoneType
import gen.lib
import DateHandler
import gen.datehandler
import Utils
import gen.utils
from gen.plug.report.utils import place_name
@ -260,7 +260,7 @@ class SimpleAccess(object):
event = self.dbase.get_event_from_handle(event_handle)
date_obj = event.get_date_object()
if date_obj:
return DateHandler.displayer.display(date_obj)
return gen.datehandler.displayer.display(date_obj)
return u''
def __event_date_obj(self, person, func):
@ -424,7 +424,7 @@ class SimpleAccess(object):
if events:
date_obj = events[0].get_date_object()
if date_obj:
return DateHandler.displayer.display(date_obj)
return gen.datehandler.displayer.display(date_obj)
return u''
def children(self, obj):
@ -633,7 +633,7 @@ class SimpleAccess(object):
@rtype: unicode
"""
if date_obj:
return DateHandler.displayer.display(date_obj)
return gen.datehandler.displayer.display(date_obj)
else:
return u''
@ -649,7 +649,7 @@ class SimpleAccess(object):
assert(isinstance(event, (gen.lib.Event, NoneType)))
date_obj = event.get_date_object()
if date_obj:
return DateHandler.displayer.display(date_obj)
return gen.datehandler.displayer.display(date_obj)
else:
return u''

View File

@ -36,7 +36,7 @@ import cPickle as pickle
import gen.lib
import Errors
import config
import DateHandler
import gen.datehandler
class SimpleTable(object):
"""
@ -393,7 +393,7 @@ class SimpleTable(object):
if (self.__link_col == col or link is None):
link = ('Note', item.handle)
elif isinstance(item, gen.lib.Date):
text = DateHandler.displayer.display(item)
text = gen.datehandler.displayer.display(item)
retval.append(text)
if item.get_valid():
if item.format:

View File

@ -65,7 +65,7 @@ from gen.ggettext import gettext as _
#
#-------------------------------------------------------------------------
import gen.lib
import DateHandler
import gen.datehandler
#-------------------------------------------------------------------------
#
@ -190,7 +190,7 @@ class PersonTip(object):
birth_ref = self._obj.get_birth_ref()
if birth_ref:
birth = self._db.get_event_from_handle(birth_ref.ref)
date_str = DateHandler.get_date(birth)
date_str = gen.datehandler.get_date(birth)
if date_str != "":
birth_str = escape(date_str)

View File

@ -51,7 +51,7 @@ import gen.lib
import Errors
from GrampsLocale import codeset
from Date import Date
import DateHandler
import gen.datehandler
from const import TEMP_DIR, USER_HOME, GRAMPS_UUID, IMAGE_DIR
import constfunc
@ -1580,7 +1580,7 @@ def format_time(secs):
"""
t = time.localtime(secs)
d = Date(t.tm_year, t.tm_mon, t.tm_mday)
return DateHandler.displayer.display(d) + time.strftime(' %X', t)
return gen.datehandler.displayer.display(d) + time.strftime(' %X', t)
#-------------------------------------------------------------------------
#

View File

@ -5,6 +5,7 @@
# If not using GNU make, then list all .py files individually
SUBDIRS = \
datehandler \
db \
display \
filters \

View File

@ -26,5 +26,5 @@ The gen module provides packages that are common to all gramps
interfaces (gui, cli and web).
"""
__all__ = [ "db", "display", "filters", "lib", "mime", "plug", "proxy",
"utils" ]
__all__ = [ "datehandler", "db", "display", "filters", "lib", "mime", "plug",
"proxy", "utils" ]

View File

@ -0,0 +1,53 @@
# This is the src/DateHandler level Makefile for Gramps
# $Id$
# We could use GNU make's ':=' syntax for nice wildcard use,
# but that is not necessarily portable.
# If not using GNU make, then list all .py files individually
pkgpython_PYTHON = \
_date_bg.py\
_date_ca.py\
_date_cs.py\
_date_da.py\
_date_de.py\
_date_es.py\
_date_fi.py\
_date_fr.py\
_date_hr.py\
_date_it.py\
_date_lt.py\
_date_nb.py\
_date_nl.py\
_date_pl.py\
_date_pt.py\
_date_ru.py\
_date_sk.py\
_date_sl.py\
_date_sr.py\
_date_sv.py\
_datedisplay.py\
_dateparser.py\
_datehandler.py\
_dateutils.py\
__init__.py
pkgpyexecdir = @pkgpyexecdir@/gen/datehandler
pkgpythondir = $(datadir)/@PACKAGE@/gen/datehandler
# Clean up all the byte-compiled files
MOSTLYCLEANFILES = *pyc *pyo
GRAMPS_PY_MODPATH = "../.."
docfiles=\
_datedisplay.py\
_dateparser.py\
_datehandler.py\
_dateutils.py
docs:
export PYTHONPATH='../..'; epydoc --graph=umlclasstree -o ../html --url http://gramps-project.org --name GRAMPS --html $(docfiles)
pycheck:
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
pychecker $(pkgpython_PYTHON));

View File

@ -25,30 +25,30 @@ Class handling language-specific selection for date parser and displayer.
"""
# import prerequisites for localized handlers
from _DateHandler import (LANG, LANG_SHORT, LANG_TO_PARSER, LANG_TO_DISPLAY,
from _datehandler import (LANG, LANG_SHORT, LANG_TO_PARSER, LANG_TO_DISPLAY,
register_datehandler)
# Import all the localized handlers
import _Date_bg
import _Date_ca
import _Date_cs
import _Date_da
import _Date_de
import _Date_es
import _Date_fi
import _Date_fr
import _Date_hr
import _Date_it
import _Date_lt
import _Date_nb
import _Date_nl
import _Date_pl
import _Date_pt
import _Date_ru
import _Date_sk
import _Date_sl
import _Date_sr
import _Date_sv
import _date_bg
import _date_ca
import _date_cs
import _date_da
import _date_de
import _date_es
import _date_fi
import _date_fr
import _date_hr
import _date_it
import _date_lt
import _date_nb
import _date_nl
import _date_pl
import _date_pt
import _date_ru
import _date_sk
import _date_sl
import _date_sr
import _date_sv
# Initialize global parser
try:
@ -78,4 +78,4 @@ except:
# Import utility functions
from _DateUtils import *
from _dateutils import *

View File

@ -38,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -18,7 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# DateHandler/_Date_ca.py
# $Id$
#
@ -41,9 +40,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -18,7 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# DateHandler/_Date_cs.py
# $Id$
#
@ -39,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -18,7 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# DateHandler/_Date_da.py
# $Id$
#
@ -39,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -38,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -38,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -38,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -42,9 +42,9 @@ import re
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -18,7 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# DateHandler/_Date_hr.py
# $Id$
#
@ -41,9 +40,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -18,7 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# DateHandler/_Date_it.py
# $Id$
#
@ -41,9 +40,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -38,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -38,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -44,9 +44,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -18,7 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# DateHandler/_Date_pl.py
# $Id$
#
@ -42,9 +41,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -40,9 +40,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -38,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -38,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -18,7 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# DateHandler/_Date_sl.py
# $Id$
#
@ -41,9 +40,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -18,7 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# DateHandler/_Date_sr.py
# $Id$
#
@ -42,9 +41,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -38,9 +38,9 @@ import re
#
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -18,7 +18,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# DateHandler/_Date_zh.py
# $Id$
#
@ -41,9 +40,9 @@ import re
#-------------------------------------------------------------------------
from gen.lib import Date
from _DateParser import DateParser
from _DateDisplay import DateDisplay
from _DateHandler import register_datehandler
from _dateparser import DateParser
from _datedisplay import DateDisplay
from _datehandler import register_datehandler
#-------------------------------------------------------------------------
#

View File

@ -38,15 +38,15 @@ import os
#
#-------------------------------------------------------------------------
import logging
log = logging.getLogger(".DateHandler")
log = logging.getLogger(".gen.datehandler")
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from _DateParser import DateParser
from _DateDisplay import DateDisplay, DateDisplayEn
from _dateparser import DateParser
from _datedisplay import DateDisplay, DateDisplayEn
import constfunc
#-------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@ Class handling language-specific selection for date parser and displayer.
# GRAMPS modules
#
#-------------------------------------------------------------------------
from DateHandler import LANG_TO_DISPLAY, LANG, parser, displayer
from gen.datehandler import LANG_TO_DISPLAY, LANG, parser, displayer
#--------------------------------------------------------------
#

View File

@ -33,7 +33,7 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
from gen.filters.rules._rule import Rule
#-------------------------------------------------------------------------
@ -59,7 +59,7 @@ class HasCitationBase(Rule):
self.date = None
try:
if self.list[1]:
self.date = DateHandler.parser.parse(self.list[1])
self.date = gen.datehandler.parser.parse(self.list[1])
except:
pass

View File

@ -32,7 +32,7 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
from gen.lib import EventType
from gen.filters.rules import Rule
from Utils import get_participant_from_event
@ -64,7 +64,7 @@ class HasEventBase(Rule):
self.etype = None
try:
if self.list[1]:
self.date = DateHandler.parser.parse(self.list[1])
self.date = gen.datehandler.parser.parse(self.list[1])
except:
pass

View File

@ -32,7 +32,7 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
from gen.lib import EventType
from gen.filters.rules._rule import Rule
@ -63,7 +63,7 @@ class HasData(Rule):
self.event_type.set_from_xml_str(self.list[0])
if self.date:
self.date = DateHandler.parser.parse(self.date)
self.date = gen.datehandler.parser.parse(self.date)
def apply(self, db, event):
if self.event_type and event.get_type() != self.event_type:

View File

@ -32,7 +32,7 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
from gen.filters.rules._rule import Rule
#-------------------------------------------------------------------------
@ -57,7 +57,7 @@ class HasMedia(Rule):
self.date = None
try:
if self.list[3]:
self.date = DateHandler.parser.parse(self.list[3])
self.date = gen.datehandler.parser.parse(self.list[3])
except:
pass

View File

@ -32,7 +32,7 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
from gen.lib import EventType,EventRoleType
from gen.filters.rules._rule import Rule
@ -52,7 +52,7 @@ class HasBirth(Rule):
def __init__(self,list):
Rule.__init__(self,list)
if self.list[0]:
self.date = DateHandler.parser.parse(self.list[0])
self.date = gen.datehandler.parser.parse(self.list[0])
else:
self.date = None

View File

@ -32,7 +32,7 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
from gen.lib import EventType,EventRoleType
from gen.filters.rules._rule import Rule
@ -52,7 +52,7 @@ class HasDeath(Rule):
def __init__(self,list):
Rule.__init__(self,list)
if self.list[0]:
self.date = DateHandler.parser.parse(self.list[0])
self.date = gen.datehandler.parser.parse(self.list[0])
else:
self.date = None

View File

@ -32,7 +32,7 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
from gen.lib import EventType
from gen.filters.rules._rule import Rule
@ -57,7 +57,7 @@ class HasFamilyEvent(Rule):
self.date = None
try:
if self.list[1]:
self.date = DateHandler.parser.parse(self.list[1])
self.date = gen.datehandler.parser.parse(self.list[1])
except:
pass

View File

@ -34,7 +34,7 @@ from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
from Utils import probably_alive
from gen.filters.rules._rule import Rule
import DateHandler
import gen.datehandler
#-------------------------------------------------------------------------
# "People probably alive"
@ -49,7 +49,7 @@ class ProbablyAlive(Rule):
def prepare(self,db):
try:
self.current_date = DateHandler.parser.parse(unicode(self.list[0]))
self.current_date = gen.datehandler.parser.parse(unicode(self.list[0]))
except:
self.current_date = None

View File

@ -46,9 +46,9 @@ from test import test_util
test_util.path_append_parent()
import config
import DateHandler
from DateHandler import parser as _dp
from DateHandler import displayer as _dd
import gen.datehandler
from gen.datehandler import parser as _dp
from gen.datehandler import displayer as _dd
from gen.lib.date import Date, Span
gettext.textdomain("gramps")
@ -221,7 +221,7 @@ cal_str = [ "CAL_GREGORIAN", "CAL_JULIAN", "CAL_HEBREW", "CAL_FRENCH",
mod_str = ["MOD_NONE", "MOD_BEFORE", "MOD_AFTER", "MOD_ABOUT", "MOD_RANGE",
"MOD_SPAN", "MOD_TEXTONLY"]
qua_str = ["QUAL_NONE", "QUAL_ESTIMATED", "QUAL_CALCULATED"]
formats = DateHandler.get_date_formats()
formats = gen.datehandler.get_date_formats()
class Eval(unittest.TestCase):
def __init__(self, method_name, dateval, e1, e2, e3, format):
@ -247,12 +247,12 @@ def suite3():
suite = unittest.TestSuite()
count = 1
for testset in date_tests:
for format in range( len( DateHandler.get_date_formats())):
DateHandler.set_format(format)
for format in range( len( gen.datehandler.get_date_formats())):
gen.datehandler.set_format(format)
for dateval in date_tests[testset]:
if dateval.modifier != Date.MOD_TEXTONLY:
dateval.text = ("Comment. Format: %s" %
DateHandler.get_date_formats()[format])
gen.datehandler.get_date_formats()[format])
suite.addTest(
Eval("testset '%s' test_eval%04d" % (testset, count),
dateval,

View File

@ -30,7 +30,7 @@ from gen.plug.docgen import FontStyle, ParagraphStyle, FONT_SANS_SERIF
from gen.lib import NoteType, Citation
from gen.ggettext import gettext as _
from Utils import confidence
from DateHandler import displayer
from gen.datehandler import displayer
def add_endnote_styles(style_sheet):
"""

View File

@ -41,7 +41,7 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#------------------------------------------------------------------------
import DateHandler
import gen.datehandler
from Utils import media_path_full
from gen.plug.docgen import IndexMark, INDEX_TYPE_ALP
@ -190,12 +190,12 @@ def get_person_mark(db, person):
birth_ref = person.get_birth_ref()
if birth_ref:
birthEvt = db.get_event_from_handle(birth_ref.ref)
birth = DateHandler.get_date(birthEvt)
birth = gen.datehandler.get_date(birthEvt)
death_ref = person.get_death_ref()
if death_ref:
deathEvt = db.get_event_from_handle(death_ref.ref)
death = DateHandler.get_date(deathEvt)
death = gen.datehandler.get_date(deathEvt)
if birth == death == " ":
key = name

View File

@ -48,7 +48,7 @@ import gobject
#-------------------------------------------------------------------------
import config
import const
import DateHandler
import gen.datehandler
from gen.display.name import displayer as _nd
from gen.display.name import NameDisplayError
import Utils
@ -890,7 +890,7 @@ class GrampsPreferences(ConfigureDialog):
# Date format:
obox = gtk.combo_box_new_text()
formats = DateHandler.get_date_formats()
formats = gen.datehandler.get_date_formats()
map(obox.append_text, formats)
active = config.get('preferences.date-format')
if active >= len(formats):

View File

@ -36,7 +36,7 @@ import gtk
# GRAMPS classes
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
#-------------------------------------------------------------------------
#
@ -56,7 +56,7 @@ class AddressModel(gtk.ListStore):
self.db = dbase
for obj in obj_list:
self.append(row=[
DateHandler.get_date(obj),
gen.datehandler.get_date(obj),
obj.street,
obj.locality,
obj.city,

View File

@ -33,7 +33,7 @@ import cgi
# GRAMPS classes
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
from gen.display.name import displayer as name_displayer
import Utils
import gen.lib
@ -74,9 +74,9 @@ class ChildModel(gtk.ListStore):
birth = get_birth_or_fallback(self.db, data)
if birth:
if birth.get_type() == gen.lib.EventType.BIRTH:
return DateHandler.get_date(birth)
return gen.datehandler.get_date(birth)
else:
return '<i>%s</i>' % cgi.escape(DateHandler.get_date(birth))
return '<i>%s</i>' % cgi.escape(gen.datehandler.get_date(birth))
else:
return u""
@ -97,9 +97,9 @@ class ChildModel(gtk.ListStore):
death = get_death_or_fallback(self.db, data)
if death:
if death.get_type() == gen.lib.EventType.DEATH:
return DateHandler.get_date(death)
return gen.datehandler.get_date(death)
else:
return '<i>%s</i>' % cgi.escape(DateHandler.get_date(death))
return '<i>%s</i>' % cgi.escape(gen.datehandler.get_date(death))
else:
return u""

View File

@ -42,7 +42,7 @@ import cgi
# GRAMPS classes
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
import config
#-------------------------------------------------------------------------
@ -122,8 +122,8 @@ class EventRefModel(gtk.TreeStore):
def column_date(self, event_ref):
event = self.db.get_event_from_handle(event_ref.ref)
retval = DateHandler.get_date(event)
if not DateHandler.get_date_valid(event):
retval = gen.datehandler.get_date(event)
if not gen.datehandler.get_date_valid(event):
return invalid_date_format % cgi.escape(retval)
else:
return retval

View File

@ -38,7 +38,7 @@ import gtk
# GRAMPS classes
#
#-------------------------------------------------------------------------
import DateHandler
import gen.datehandler
import LdsUtils
#-------------------------------------------------------------------------
@ -57,7 +57,7 @@ class LdsModel(gtk.ListStore):
for lds_ord in lds_list:
self.append(row=[
lds_ord.type2str(),
DateHandler.get_date(lds_ord),
gen.datehandler.get_date(lds_ord),
lds_ord.status2str(),
LdsUtils.TEMPLES.name(lds_ord.get_temple()),
self.column_place(lds_ord),

View File

@ -66,7 +66,7 @@ from gen.display.name import displayer as name_displayer
import gen.lib
from gen.db import DbTxn
import Errors
import DateHandler
import gen.datehandler
from glade import Glade
from editprimary import EditPrimary
@ -875,12 +875,12 @@ class EditFamily(EditPrimary):
if name_obj:
name_obj.set_text(name)
if birth:
birth_str = DateHandler.displayer.display(birth.get_date_object())
birth_str = gen.datehandler.displayer.display(birth.get_date_object())
else:
birth_str = ""
birth_obj.set_text(birth_str)
if death:
death_str = DateHandler.displayer.display(death.get_date_object())
death_str = gen.datehandler.displayer.display(death.get_date_object())
else:
death_str = ""
death_obj.set_text(death_str)

View File

@ -41,7 +41,7 @@ import gtk
#
#-------------------------------------------------------------------------
import ManagedWindow
import DateHandler
import gen.datehandler
from gen.display.name import displayer as name_displayer
import config
import GrampsDisplay
@ -61,8 +61,8 @@ class EditPrimary(ManagedWindow.ManagedWindow, DbGUIElement):
Associate a person with the window.
"""
self.dp = DateHandler.parser
self.dd = DateHandler.displayer
self.dp = gen.datehandler.parser
self.dd = gen.datehandler.displayer
self.name_displayer = name_displayer
self.obj = obj
self.dbstate = state

View File

@ -43,7 +43,7 @@ import gtk
#-------------------------------------------------------------------------
from gui import widgets
import gen.lib
import DateHandler
import gen.datehandler
from gui.filters import build_filter_model
from gui.filters.sidebar import SidebarFilter
from gen.filters import GenericFilter, rules
@ -122,8 +122,8 @@ class PersonSidebarFilter(SidebarFilter):
exdate2.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_BEFORE,
gen.lib.Date.CAL_GREGORIAN, (0, 0, 1850, False))
msg1 = DateHandler.displayer.display(exdate1)
msg2 = DateHandler.displayer.display(exdate2)
msg1 = gen.datehandler.displayer.display(exdate1)
msg2 = gen.datehandler.displayer.display(exdate2)
self.add_text_entry(_('Name'), self.filter_name)
self.add_text_entry(_('ID'), self.filter_id)

View File

@ -41,7 +41,7 @@ LOG = logging.getLogger(".citation")
#-------------------------------------------------------------------------
import const
import ToolTips
import DateHandler
import gen.datehandler
import gen.lib
from Utils import confidence, format_time
import config
@ -85,10 +85,10 @@ class CitationBaseModel(object):
if data[COLUMN_DATE]:
citation = gen.lib.Citation()
citation.unserialize(data)
date_str = DateHandler.get_date(citation)
date_str = gen.datehandler.get_date(citation)
if date_str != "":
retval = cgi.escape(date_str)
if not DateHandler.get_date_valid(citation):
if not gen.datehandler.get_date_valid(citation):
return INVALID_DATE_FORMAT % retval
else:
return retval
@ -99,7 +99,7 @@ class CitationBaseModel(object):
citation = gen.lib.Citation()
citation.unserialize(data)
retval = "%09d" % citation.get_date_object().get_sort_value()
if not DateHandler.get_date_valid(citation):
if not gen.datehandler.get_date_valid(citation):
return INVALID_DATE_FORMAT % retval
else:
return retval

View File

@ -41,7 +41,7 @@ import gtk
#
#-------------------------------------------------------------------------
import ToolTips
import DateHandler
import gen.datehandler
import gen.lib
import Utils
import config
@ -135,10 +135,10 @@ class EventModel(FlatBaseModel):
if data[COLUMN_DATE]:
event = gen.lib.Event()
event.unserialize(data)
date_str = DateHandler.get_date(event)
date_str = gen.datehandler.get_date(event)
if date_str != "":
retval = cgi.escape(date_str)
if not DateHandler.get_date_valid(event):
if not gen.datehandler.get_date_valid(event):
return INVALID_DATE_FORMAT % retval
else:
return retval
@ -149,7 +149,7 @@ class EventModel(FlatBaseModel):
event = gen.lib.Event()
event.unserialize(data)
retval = "%09d" % event.get_date_object().get_sort_value()
if not DateHandler.get_date_valid(event):
if not gen.datehandler.get_date_valid(event):
return INVALID_DATE_FORMAT % retval
else:
return retval

View File

@ -44,7 +44,7 @@ import gtk
import const
import ToolTips
import Utils
import DateHandler
import gen.datehandler
from gen.display.name import displayer as name_displayer
import gen.lib
from gen.lib import EventRoleType
@ -151,11 +151,11 @@ class FamilyModel(FlatBaseModel):
event = get_marriage_or_fallback(self.db, family, "<i>%s</i>")
if event:
if event.date.format:
return event.date.format % DateHandler.displayer.display(event.date)
elif not DateHandler.get_date_valid(event):
return invalid_date_format % DateHandler.displayer.display(event.date)
return event.date.format % gen.datehandler.displayer.display(event.date)
elif not gen.datehandler.get_date_valid(event):
return invalid_date_format % gen.datehandler.displayer.display(event.date)
else:
return "%s" % DateHandler.displayer.display(event.date)
return "%s" % gen.datehandler.displayer.display(event.date)
else:
return u''

View File

@ -45,7 +45,7 @@ import gtk
import const
import ToolTips
import Utils
import DateHandler
import gen.datehandler
import gen.lib
from gui.views.treemodels.flatbasemodel import FlatBaseModel
@ -134,7 +134,7 @@ class MediaModel(FlatBaseModel):
if data[9]:
date = gen.lib.Date()
date.unserialize(data[9])
return unicode(DateHandler.displayer.display(date))
return unicode(gen.datehandler.displayer.display(date))
return u''
def sort_date(self,data):

View File

@ -59,7 +59,7 @@ _LOG = logging.getLogger(".")
import const
from gen.lib import Name, EventRef, EventType, EventRoleType
from gen.display.name import displayer as name_displayer
import DateHandler
import gen.datehandler
import ToolTips
import Utils
from Lru import LRU
@ -269,10 +269,10 @@ class PeopleBaseModel(object):
if sort_mode:
retval = "%09d" % birth.get_date_object().get_sort_value()
else:
date_str = DateHandler.get_date(birth)
date_str = gen.datehandler.get_date(birth)
if date_str != "":
retval = cgi.escape(date_str)
if not DateHandler.get_date_valid(birth):
if not gen.datehandler.get_date_valid(birth):
return invalid_date_format % retval
else:
return retval
@ -284,7 +284,7 @@ class PeopleBaseModel(object):
er.unserialize(event_ref)
event = self.db.get_event_from_handle(er.ref)
etype = event.get_type()
date_str = DateHandler.get_date(event)
date_str = gen.datehandler.get_date(event)
if (etype in [EventType.BAPTISM, EventType.CHRISTEN]
and er.get_role() == EventRoleType.PRIMARY
and date_str != ""):
@ -292,7 +292,7 @@ class PeopleBaseModel(object):
retval = "%09d" % event.get_date_object().get_sort_value()
else:
retval = u"<i>%s</i>" % cgi.escape(date_str)
if not DateHandler.get_date_valid(event):
if not gen.datehandler.get_date_valid(event):
return invalid_date_format % retval
else:
return retval
@ -324,10 +324,10 @@ class PeopleBaseModel(object):
if sort_mode:
retval = "%09d" % event.get_date_object().get_sort_value()
else:
date_str = DateHandler.get_date(event)
date_str = gen.datehandler.get_date(event)
if date_str != "":
retval = cgi.escape(date_str)
if not DateHandler.get_date_valid(event):
if not gen.datehandler.get_date_valid(event):
return invalid_date_format % retval
else:
return retval
@ -339,7 +339,7 @@ class PeopleBaseModel(object):
er.unserialize(event_ref)
event = self.db.get_event_from_handle(er.ref)
etype = event.get_type()
date_str = DateHandler.get_date(event)
date_str = gen.datehandler.get_date(event)
if (etype in [EventType.BURIAL,
EventType.CREMATION,
EventType.CAUSE_DEATH]
@ -349,7 +349,7 @@ class PeopleBaseModel(object):
retval = "%09d" % event.get_date_object().get_sort_value()
else:
retval = "<i>%s</i>" % cgi.escape(date_str)
if not DateHandler.get_date_valid(event):
if not gen.datehandler.get_date_valid(event):
return invalid_date_format % retval
else:
return retval

View File

@ -1705,7 +1705,7 @@ class ValidatableMaskedEntry(MaskedEntry):
def main(args):
from DateHandler import parser
from gen.datehandler import parser
def on_validate(widget, text):
myDate = parser.parse(text)

View File

@ -49,7 +49,7 @@ from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
from Utils import probably_alive
from DateHandler import displayer as _dd
from gen.datehandler import displayer as _dd
import GrampsLocale
import gen.lib

View File

@ -53,7 +53,7 @@ from gen.plug.menu import BooleanOption, NumberOption, EnumeratedListOption, \
from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
import DateHandler
import gen.datehandler
#------------------------------------------------------------------------
#
@ -190,7 +190,7 @@ def draw_legend(doc, start_x, start_y, data, title, label_style):
start_y += size * 1.3
_t = time.localtime(time.time())
_TODAY = DateHandler.parser.parse("%04d-%02d-%02d" % _t[:3])
_TODAY = gen.datehandler.parser.parse("%04d-%02d-%02d" % _t[:3])
def estimate_age(db, person, end_handle=None, start_handle=None, today=_TODAY):
"""
@ -408,7 +408,7 @@ class Extract(object):
if date:
month = date.get_month()
if month:
return [DateHandler.displayer.long_months[month]]
return [gen.datehandler.displayer.long_months[month]]
return [_("Date(s) missing")]
def get_place(self, event):

View File

@ -53,7 +53,7 @@ import gen.lib
from gen.lib.eventroletype import EventRoleType
from ExportOptions import WriterOptionBox
import Utils
import DateHandler
import gen.datehandler
from glade import Glade
#-------------------------------------------------------------------------
@ -520,4 +520,4 @@ class CSVWriter(object):
return True
def format_date(self, date):
return DateHandler.get_date(date)
return gen.datehandler.get_date(date)

View File

@ -36,7 +36,7 @@ on a particular date.
#------------------------------------------------------------------------
from gen.plug import Gramplet
from gen.ggettext import sgettext as _
import DateHandler
import gen.datehandler
from QuickReports import run_quick_report_by_name
#------------------------------------------------------------------------
@ -94,7 +94,7 @@ class AgeOnDateGramplet(Gramplet):
and then handed to the quick report.
"""
text = self.entry.get_text()
date = DateHandler.parser.parse(text)
date = gen.datehandler.parser.parse(text)
run_quick_report_by_name(self.gui.dbstate,
self.gui.uistate,
'ageondate',

View File

@ -25,7 +25,7 @@ from gen.plug import Gramplet
from gen.ggettext import gettext as _
from gen.display.name import displayer as name_displayer
from gen.utils import get_birth_or_fallback, get_death_or_fallback
import DateHandler
import gen.datehandler
import Errors
import gtk
@ -48,7 +48,7 @@ class Children(Gramplet):
event_place = ''
event_sort = '%012d' % 0
if event:
event_date = DateHandler.get_date(event)
event_date = gen.datehandler.get_date(event)
event_sort = '%012d' % event.get_date_object().get_sort_value()
handle = event.get_place_handle()
if handle:

View File

@ -40,7 +40,7 @@ from gen.ggettext import gettext as _
from gen.plug import Gramplet
from gen.plug.report import utils as ReportUtils
from gen.display.name import displayer as name_displayer
import DateHandler
import gen.datehandler
from gen.utils import get_birth_or_fallback, get_death_or_fallback
class DescendantGramplet(Gramplet):
@ -79,10 +79,10 @@ class DescendantGramplet(Gramplet):
death = get_death_or_fallback(self.dbstate.db, person)
if birth:
birth_date = DateHandler.get_date(birth)
birth_date = gen.datehandler.get_date(birth)
if death:
death_date = DateHandler.get_date(death)
death_date = gen.datehandler.get_date(death)
if birth or death:
self.append_text(' (')

View File

@ -51,8 +51,8 @@ import GrampsDisplay
from gen.ggettext import gettext as _
from DateHandler import displayer as _dd
from DateHandler import parser as _dp
from gen.datehandler import displayer as _dd
from gen.datehandler import parser as _dp
from gen.plug import Gramplet

View File

@ -24,7 +24,7 @@ from ListModel import ListModel, NOSORT
from gen.plug import Gramplet
from gen.ggettext import gettext as _
from gen.display.name import displayer as name_displayer
import DateHandler
import gen.datehandler
import Errors
import gtk
@ -60,7 +60,7 @@ class Events(Gramplet):
Add an event to the model.
"""
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
event_date = DateHandler.get_date(event)
event_date = gen.datehandler.get_date(event)
event_sort = '%012d' % event.get_date_object().get_sort_value()
place = ''
handle = event.get_place_handle()

View File

@ -36,7 +36,7 @@ from gen.plug import Gramplet
from gen.ggettext import sgettext as _
from gen.ggettext import ngettext
from gen.display.name import displayer as name_displayer
import DateHandler
import gen.datehandler
import gen
from gen.utils import get_birth_or_fallback, get_death_or_fallback
@ -196,25 +196,25 @@ class PedigreeGramplet(Gramplet):
def info_string(self, person):
birth = get_birth_or_fallback(self.dbstate.db, person)
if birth and birth.get_type() != gen.lib.EventType.BIRTH:
sdate = DateHandler.get_date(birth)
sdate = gen.datehandler.get_date(birth)
if sdate:
bdate = "<i>%s</i>" % cgi.escape(sdate)
else:
bdate = ""
elif birth:
bdate = cgi.escape(DateHandler.get_date(birth))
bdate = cgi.escape(gen.datehandler.get_date(birth))
else:
bdate = ""
death = get_death_or_fallback(self.dbstate.db, person)
if death and death.get_type() != gen.lib.EventType.DEATH:
sdate = DateHandler.get_date(death)
sdate = gen.datehandler.get_date(death)
if sdate:
ddate = "<i>%s</i>" % cgi.escape(sdate)
else:
ddate = ""
elif death:
ddate = cgi.escape(DateHandler.get_date(death))
ddate = cgi.escape(gen.datehandler.get_date(death))
else:
ddate = ""

View File

@ -24,7 +24,7 @@ from gen.plug import Gramplet
from gui.widgets import Photo
from gen.display.name import displayer as name_displayer
from gen.ggettext import gettext as _
import DateHandler
import gen.datehandler
import Utils
import gtk
import pango
@ -204,7 +204,7 @@ class PersonDetails(Gramplet):
"""
Format the event for display.
"""
date = DateHandler.get_date(event)
date = gen.datehandler.get_date(event)
handle = event.get_place_handle()
if handle:
place = self.dbstate.db.get_place_from_handle(handle).get_title()

View File

@ -24,7 +24,7 @@ from gui.editors import EditEvent
from ListModel import ListModel, NOSORT
from gen.plug import Gramplet
from gen.ggettext import gettext as _
import DateHandler
import gen.datehandler
import Errors
import gtk
@ -101,7 +101,7 @@ class PersonResidence(Gramplet):
"""
Add a residence event to the model.
"""
date = DateHandler.get_date(event)
date = gen.datehandler.get_date(event)
place = ''
handle = event.get_place_handle()
if handle:

View File

@ -33,7 +33,7 @@ import posixpath
from gen.plug import Gramplet
from gen.ggettext import sgettext as _
from Utils import media_path_full
import DateHandler
import gen.datehandler
import gen
#------------------------------------------------------------------------
@ -121,7 +121,7 @@ class StatsGramplet(Gramplet):
birth_ref = person.get_birth_ref()
if birth_ref:
birth = database.get_event_from_handle(birth_ref.ref)
if not DateHandler.get_date(birth):
if not gen.datehandler.get_date(birth):
missing_bday += 1
else:
missing_bday += 1

View File

@ -53,7 +53,7 @@ log = logging.getLogger(".FamilyLines")
import gen.lib
import Utils
import ThumbNails
from DateHandler import displayer as _dd
from gen.datehandler import displayer as _dd
from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions

View File

@ -45,7 +45,7 @@ from gen.plug.menu import (PersonOption, BooleanOption, NumberOption,
from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
import DateHandler
import gen.datehandler
from gen.utils import get_birth_or_fallback, get_death_or_fallback
#------------------------------------------------------------------------
@ -175,13 +175,13 @@ class HourGlassReport(Report):
birth_evt = get_birth_or_fallback(self.__db, person)
if birth_evt:
birth = DateHandler.get_date(birth_evt)
birth = gen.datehandler.get_date(birth_evt)
else:
birth = ""
death_evt = get_death_or_fallback(self.__db, person)
if death_evt:
death = DateHandler.get_date(death_evt)
death = gen.datehandler.get_date(death_evt)
else:
death = ""
@ -198,7 +198,7 @@ class HourGlassReport(Report):
label = ""
marriage = ReportUtils.find_marriage(self.__db, family)
if marriage:
label = DateHandler.get_date(marriage)
label = gen.datehandler.get_date(marriage)
color = ""
fill = ""
style = "solid"

View File

@ -53,7 +53,7 @@ from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
from gen.display.name import displayer as name_displayer
import DateHandler
import gen.datehandler
import gen.lib
import Utils
import ThumbNails
@ -442,7 +442,7 @@ class RelGraphReport(Report):
if self.just_years:
return '%i' % event.get_date_object().get_year()
else:
return DateHandler.get_date(event)
return gen.datehandler.get_date(event)
elif self.use_place:
place_handle = event.get_place_handle()
place = self.database.get_place_from_handle(place_handle)

View File

@ -52,7 +52,7 @@ from gen.ggettext import ngettext
import gen.lib
from gen.db import DbTxn
from gen.plug.utils import OpenFileOrStdin
from DateHandler import parser as _dp
from gen.datehandler import parser as _dp
from Utils import gender as gender_map
from Utils import create_id
from gui.utils import ProgressMeter

View File

@ -49,7 +49,7 @@ from gen.db import DbTxn
from gen.db.write import CLASS_TO_KEY_MAP
from Errors import GrampsImportError
import Utils
import DateHandler
import gen.datehandler
from gen.display.name import displayer as name_displayer
from gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY,
MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY, NOTE_KEY,
@ -450,7 +450,7 @@ class GrampsParser(UpdateCallback):
self.gid2nid = {}
self.childref_map = {}
self.change = change
self.dp = DateHandler.parser
self.dp = gen.datehandler.parser
self.info = ImportInfo()
self.all_abs = True
self.db = database
@ -2567,9 +2567,9 @@ class GrampsParser(UpdateCallback):
def stop_date(self, tag):
if tag:
if self.address:
DateHandler.set_date(self.address, tag)
gen.datehandler.set_date(self.address, tag)
else:
DateHandler.set_date(self.event, tag)
gen.datehandler.set_date(self.event, tag)
def stop_first(self, tag):
self.name.set_first_name(tag)

View File

@ -38,7 +38,7 @@ from cgi import escape
#
#-------------------------------------------------------------------------
import gen.lib
import DateHandler
import gen.datehandler
from gen.display.name import displayer as name_displayer
from gen.utils import get_birth_or_fallback, get_death_or_fallback, get_marriage_or_fallback
@ -74,17 +74,17 @@ class FormattingHelper(object):
marriage = get_marriage_or_fallback(self.dbstate.db, family)
if marriage and use_markup and marriage.get_type() != gen.lib.EventType.MARRIAGE:
mdate = "<i>%s %s</i>" % (marriage.get_type().get_abbreviation(),
escape(DateHandler.get_date(marriage)))
escape(gen.datehandler.get_date(marriage)))
mplace = "<i>%s</i>" % escape(self.get_place_name(marriage.get_place_handle()))
name = "<i>%s</i>" % str(marriage.get_type())
elif marriage and use_markup:
mdate = "%s %s" % (marriage.get_type().get_abbreviation(),
escape(DateHandler.get_date(marriage)))
escape(gen.datehandler.get_date(marriage)))
mplace = escape(self.get_place_name(marriage.get_place_handle()))
name = str(marriage.get_type())
elif marriage:
mdate = "%s %s" % (marriage.get_type().get_abbreviation(),
DateHandler.get_date(marriage))
gen.datehandler.get_date(marriage))
mplace = self.get_place_name(marriage.get_place_handle())
name = str(marriage.get_type())
else:
@ -150,14 +150,14 @@ class FormattingHelper(object):
birth = get_birth_or_fallback(self.dbstate.db, person)
if birth and use_markup and birth.get_type() != \
gen.lib.EventType.BIRTH:
bdate = "<i>%s</i>" % escape(DateHandler.get_date(birth))
bdate = "<i>%s</i>" % escape(gen.datehandler.get_date(birth))
bplace = "<i>%s</i>" % escape(self.get_place_name(
birth.get_place_handle()))
elif birth and use_markup:
bdate = escape(DateHandler.get_date(birth))
bdate = escape(gen.datehandler.get_date(birth))
bplace = escape(self.get_place_name(birth.get_place_handle()))
elif birth:
bdate = DateHandler.get_date(birth)
bdate = gen.datehandler.get_date(birth)
bplace = self.get_place_name(birth.get_place_handle())
else:
bdate = ""
@ -165,14 +165,14 @@ class FormattingHelper(object):
death = get_death_or_fallback(self.dbstate.db, person)
if death and use_markup and death.get_type() != \
gen.lib.EventType.DEATH:
ddate = "<i>%s</i>" % escape(DateHandler.get_date(death))
ddate = "<i>%s</i>" % escape(gen.datehandler.get_date(death))
dplace = "<i>%s</i>" % escape(self.get_place_name(
death.get_place_handle()))
elif death and use_markup:
ddate = escape(DateHandler.get_date(death))
ddate = escape(gen.datehandler.get_date(death))
dplace = escape(self.get_place_name(death.get_place_handle()))
elif death:
ddate = DateHandler.get_date(death)
ddate = gen.datehandler.get_date(death)
dplace = self.get_place_name(death.get_place_handle())
else:
ddate = ""

View File

@ -120,7 +120,7 @@ from gen.updatecallback import UpdateCallback
import gen.mime
import LdsUtils
import Utils
from DateHandler._DateParser import DateParser
from gen.datehandler._DateParser import DateParser
from gen.db.dbconst import EVENT_KEY
from QuestionDialog import WarningDialog
from gen.lib.const import IDENTICAL, DIFFERENT

View File

@ -27,7 +27,7 @@ from gen.ggettext import gettext as _
from PlaceUtils import conv_lat_lon
from fractions import Fraction
import gen.lib
import DateHandler
import gen.datehandler
import datetime
import gtk
import pyexiv2
@ -48,7 +48,7 @@ def format_datetime(exif_dt):
return _('Invalid format')
date_part = gen.lib.Date()
date_part.set_yr_mon_day(exif_dt.year, exif_dt.month, exif_dt.day)
date_str = DateHandler.displayer.display(date_part)
date_str = gen.datehandler.displayer.display(date_part)
time_str = _('%(hr)02d:%(min)02d:%(sec)02d') % {'hr': exif_dt.hour,
'min': exif_dt.minute,
'sec': exif_dt.second}

View File

@ -38,7 +38,7 @@ Mary Smith was born on 3/28/1923.
#
#------------------------------------------------------------------------
from gen.display.name import displayer as name_displayer
import DateHandler
import gen.datehandler
import gen.lib
from gen.utils import get_birth_or_fallback, get_death_or_fallback
@ -192,7 +192,7 @@ class DateFormat(GenericFormat):
return None
def _default_format(self, date):
return DateHandler.displayer.display(date)
return gen.datehandler.displayer.display(date)
def __count_chars(self, char, max_amount):
""" count the year/month/day codes """
@ -249,9 +249,9 @@ class DateFormat(GenericFormat):
tmp = "0" + month
return tmp[-2:]
elif count == 3: #found 'mmm'
return DateHandler.displayer.short_months[int(month)]
return gen.datehandler.displayer.short_months[int(month)]
else: #found 'mmmm'
return DateHandler.displayer.long_months[int(month)]
return gen.datehandler.displayer.long_months[int(month)]
def month_up():
return month("M").upper()

View File

@ -38,7 +38,7 @@ _ = gettext.gettext
#
#------------------------------------------------------------------------
import TransUtils
import DateHandler
import gen.datehandler
import config
from gen.lib.grampstype import GrampsType
@ -138,7 +138,7 @@ class Translator:
"""
if lang == Translator.DEFAULT_TRANSLATION_STR:
self.__trans = None
self.__dd = DateHandler.displayer
self.__dd = gen.datehandler.displayer
else:
# fallback=True will cause the translator to use English if
# lang = "en" or if something goes wrong.
@ -146,10 +146,10 @@ class Translator:
languages=[lang],
fallback=True)
val = config.get('preferences.date-format')
if lang in DateHandler.LANG_TO_DISPLAY:
self.__dd = DateHandler.LANG_TO_DISPLAY[lang](val)
if lang in gen.datehandler.LANG_TO_DISPLAY:
self.__dd = gen.datehandler.LANG_TO_DISPLAY[lang](val)
else:
self.__dd = DateHandler.displayer
self.__dd = gen.datehandler.displayer
def gettext(self, message):
"""

View File

@ -30,7 +30,7 @@ Display references for any object
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from Utils import probably_alive
from gen.ggettext import gettext as _
import DateHandler
import gen.datehandler
import gen.lib
import config
@ -48,10 +48,10 @@ def run(database, document, date):
# display the title
if date.get_day_valid():
sdoc.title(_("People probably alive and their ages the %s") %
DateHandler.displayer.display(date))
gen.datehandler.displayer.display(date))
else:
sdoc.title(_("People probably alive and their ages on %s") %
DateHandler.displayer.display(date))
gen.datehandler.displayer.display(date))
stab.columns(_("Person"), _("Age")) # Actual Date makes column unicode
matches = 0
for person in sdb.all_people():

View File

@ -31,7 +31,7 @@ from Simple import SimpleAccess, SimpleDoc, SimpleTable
from Utils import media_path_full
from QuickReports import run_quick_report_by_name_direct
from gen.lib import Person
import DateHandler
import gen.datehandler
import posixpath
from collections import defaultdict
@ -303,7 +303,7 @@ def run(database, document, filter_name, *args, **kwargs):
birth_ref = person.get_birth_ref()
if birth_ref:
birth = database.get_event_from_handle(birth_ref.ref)
if not DateHandler.get_date(birth):
if not gen.datehandler.get_date(birth):
stab.row(person, _("birth event but no date"))
matches += 1
else:

View File

@ -51,7 +51,7 @@ from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
from Utils import probably_alive
import GrampsLocale
from DateHandler import displayer as _dd
from gen.datehandler import displayer as _dd
import libholiday

View File

@ -51,7 +51,7 @@ from Errors import ReportError
from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
import DateHandler
import gen.datehandler
import Sort
from gen.utils import (get_birth_or_fallback, get_death_or_fallback,
get_marriage_or_fallback, get_divorce_or_fallback)
@ -157,7 +157,7 @@ class Printinfo():
def __date_place(self,event):
if event:
date = DateHandler.get_date(event)
date = gen.datehandler.get_date(event)
place_handle = event.get_place_handle()
if place_handle:
place = self.database.get_place_from_handle(

View File

@ -54,7 +54,7 @@ from gen.plug.report import endnotes
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
import DateHandler
import gen.datehandler
from libnarrate import Narrator
import TransUtils

View File

@ -58,7 +58,7 @@ from gen.plug.report import endnotes
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
import DateHandler
import gen.datehandler
from libnarrate import Narrator
import TransUtils

View File

@ -45,7 +45,7 @@ from gen.plug.menu import (PersonOption, EnumeratedListOption)
from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
import DateHandler
import gen.datehandler
#------------------------------------------------------------------------
#
@ -190,13 +190,13 @@ class EndOfLineReport(Report):
birth_ref = person.get_birth_ref()
if birth_ref:
event = self.database.get_event_from_handle(birth_ref.ref)
birth_date = DateHandler.get_date( event )
birth_date = gen.datehandler.get_date( event )
death_date = ""
death_ref = person.get_death_ref()
if death_ref:
event = self.database.get_event_from_handle(death_ref.ref)
death_date = DateHandler.get_date( event )
death_date = gen.datehandler.get_date( event )
dates = _(" (%(birth_date)s - %(death_date)s)") % {
'birth_date' : birth_date,
'death_date' : death_date }

View File

@ -45,7 +45,7 @@ from gen.plug.report import MenuReportOptions
from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle, TableStyle,
TableCellStyle, FONT_SANS_SERIF, FONT_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
import DateHandler
import gen.datehandler
from gen.ggettext import sgettext as _
from gen.display.name import displayer as global_name_display
@ -111,7 +111,7 @@ class FamilyGroup(Report):
date = ""
descr = ""
if event:
date = DateHandler.get_date(event)
date = gen.datehandler.get_date(event)
place_handle = event.get_place_handle()
place = ReportUtils.place_name(self.database,place_handle)
descr = event.get_description()
@ -175,12 +175,12 @@ class FamilyGroup(Report):
birth = " "
if birth_ref:
event = self.database.get_event_from_handle(birth_ref.ref)
birth = DateHandler.get_date( event )
birth = gen.datehandler.get_date( event )
death_ref = father.get_death_ref()
death = " "
if death_ref:
event = self.database.get_event_from_handle(death_ref.ref)
death = DateHandler.get_date( event )
death = gen.datehandler.get_date( event )
if birth_ref or death_ref:
father_name = "%s (%s - %s)" % (father_name,birth,death)
mother_handle = family.get_mother_handle()
@ -192,12 +192,12 @@ class FamilyGroup(Report):
birth = " "
if birth_ref:
event = self.database.get_event_from_handle(birth_ref.ref)
birth = DateHandler.get_date( event )
birth = gen.datehandler.get_date( event )
death_ref = mother.get_death_ref()
death = " "
if death_ref:
event = self.database.get_event_from_handle(death_ref.ref)
death = DateHandler.get_date( event )
death = gen.datehandler.get_date( event )
if birth_ref or death_ref:
mother_name = "%s (%s - %s)" % (mother_name,birth,death)
@ -316,7 +316,7 @@ class FamilyGroup(Report):
addrlist = person.get_address_list()[:]
for addr in addrlist:
location = ReportUtils.get_address_str(addr)
date = DateHandler.get_date( addr )
date = gen.datehandler.get_date( addr )
self.doc.start_row()
self.doc.start_cell("FGR-TextContents")
@ -393,7 +393,7 @@ class FamilyGroup(Report):
date = ""
place = ""
if event:
date = DateHandler.get_date(event)
date = gen.datehandler.get_date(event)
place_handle = event.get_place_handle()
if place_handle:
place = self.database.get_place_from_handle(place_handle).get_title()
@ -529,12 +529,12 @@ class FamilyGroup(Report):
birth_ref = spouse.get_birth_ref()
if birth_ref:
event = self.database.get_event_from_handle(birth_ref.ref)
birth = DateHandler.get_date(event)
birth = gen.datehandler.get_date(event)
death = " "
death_ref = spouse.get_death_ref()
if death_ref:
event = self.database.get_event_from_handle(death_ref.ref)
death = DateHandler.get_date(event)
death = gen.datehandler.get_date(event)
if birth_ref or death_ref:
spouse_name = "%s (%s - %s)" % (spouse_name,birth,death)
mark = ReportUtils.get_person_mark(self.database,spouse)

View File

@ -44,7 +44,7 @@ from gen.lib import EventRoleType, EventType, Person, NoteType
from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle, TableStyle,
TableCellStyle, FONT_SANS_SERIF, INDEX_TYPE_TOC,
PARA_ALIGN_CENTER)
import DateHandler
import gen.datehandler
from gen.plug.menu import (BooleanOption, FilterOption, PersonOption,
BooleanListOption, EnumeratedListOption)
from gen.plug.report import Report
@ -199,7 +199,7 @@ class IndivCompleteReport(Report):
role = event_ref.get_role()
description = event.get_description()
date = DateHandler.get_date(event)
date = gen.datehandler.get_date(event)
place = ''
place_handle = event.get_place_handle()
if place_handle:
@ -385,7 +385,7 @@ class IndivCompleteReport(Report):
for addr in alist:
text = ReportUtils.get_address_str(addr)
date = DateHandler.get_date(addr)
date = gen.datehandler.get_date(addr)
endnotes = ""
if self.use_srcs:
endnotes = Endnotes.cite_source(self.bibli, self.database, addr)

View File

@ -48,7 +48,7 @@ from gen.plug.menu import (NumberOption, BooleanOption, PersonOption,
from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
import DateHandler
import gen.datehandler
from gen.utils import get_birth_or_fallback, get_death_or_fallback
#------------------------------------------------------------------------
@ -302,12 +302,12 @@ class KinshipReport(Report):
birth_date = ""
birth = get_birth_or_fallback(self.database, person)
if birth:
birth_date = DateHandler.get_date(birth)
birth_date = gen.datehandler.get_date(birth)
death_date = ""
death = get_death_or_fallback(self.database, person)
if death:
death_date = DateHandler.get_date(death)
death_date = gen.datehandler.get_date(death)
dates = _(" (%(birth_date)s - %(death_date)s)") % {
'birth_date' : birth_date,
'death_date' : death_date }

Some files were not shown because too many files have changed in this diff Show More