diff --git a/gramps/gui/clipboard.py b/gramps/gui/clipboard.py
index 00ca79f83..f5138bdec 100644
--- a/gramps/gui/clipboard.py
+++ b/gramps/gui/clipboard.py
@@ -49,7 +49,7 @@ from gi.repository import GdkPixbuf
from gen.const import IMAGE_DIR, URL_MANUAL_PAGE
from gen.config import config
import gen.lib
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gui.display import display_help
from gui.managedwindow import ManagedWindow
from gen.ggettext import sgettext as _
@@ -297,7 +297,7 @@ class ClipAddress(ClipObjWrapper):
def refresh(self):
if self._obj:
- self._title = gen.datehandler.get_date(self._obj)
+ self._title = get_date(self._obj)
self._value = "%s %s %s %s" % (self._obj.get_street(),
self._obj.get_city(),
self._obj.get_state(),
diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py
index 59bf92c07..8d36682aa 100644
--- a/gramps/gui/configure.py
+++ b/gramps/gui/configure.py
@@ -49,7 +49,7 @@ from gi.repository import Gtk
#-------------------------------------------------------------------------
from gen.config import config
from gen.const import HOME_DIR
-import gen.datehandler
+from gramps.gen.datehandler import get_date_formats
from gen.display.name import displayer as _nd
from gen.display.name import NameDisplayError
from gen.utils.file import get_unicode_path_from_file_chooser
@@ -946,7 +946,7 @@ class GrampsPreferences(ConfigureDialog):
# Date format:
obox = Gtk.ComboBoxText()
- formats = gen.datehandler.get_date_formats()
+ formats = get_date_formats()
map(obox.append_text, formats)
active = config.get('preferences.date-format')
if active >= len(formats):
diff --git a/gramps/gui/editors/displaytabs/addressmodel.py b/gramps/gui/editors/displaytabs/addressmodel.py
index 80906f11f..493b1e45d 100644
--- a/gramps/gui/editors/displaytabs/addressmodel.py
+++ b/gramps/gui/editors/displaytabs/addressmodel.py
@@ -36,7 +36,7 @@ from gi.repository import Gtk
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.datehandler
+from gramps.gen.datehandler import get_date
#-------------------------------------------------------------------------
#
@@ -56,7 +56,7 @@ class AddressModel(Gtk.ListStore):
self.db = dbase
for obj in obj_list:
self.append(row=[
- gen.datehandler.get_date(obj),
+ get_date(obj),
obj.street,
obj.locality,
obj.city,
diff --git a/gramps/gui/editors/displaytabs/childmodel.py b/gramps/gui/editors/displaytabs/childmodel.py
index 0d8957fde..865b23f47 100644
--- a/gramps/gui/editors/displaytabs/childmodel.py
+++ b/gramps/gui/editors/displaytabs/childmodel.py
@@ -33,7 +33,7 @@ import cgi
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.display.name import displayer as name_displayer
from gen.utils.string import gender as gender_map
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 gen.datehandler.get_date(birth)
+ return get_date(birth)
else:
- return '%s' % cgi.escape(gen.datehandler.get_date(birth))
+ return '%s' % cgi.escape(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 gen.datehandler.get_date(death)
+ return get_date(death)
else:
- return '%s' % cgi.escape(gen.datehandler.get_date(death))
+ return '%s' % cgi.escape(get_date(death))
else:
return u""
diff --git a/gramps/gui/editors/displaytabs/eventrefmodel.py b/gramps/gui/editors/displaytabs/eventrefmodel.py
index e86dcb2b5..028e67759 100644
--- a/gramps/gui/editors/displaytabs/eventrefmodel.py
+++ b/gramps/gui/editors/displaytabs/eventrefmodel.py
@@ -47,7 +47,7 @@ import cgi
#
#-------------------------------------------------------------------------
from gui.widgets.undoablebuffer import UndoableBuffer
-import gen.datehandler
+from gramps.gen.datehandler import get_date, get_date_valid
from gen.config import config
#-------------------------------------------------------------------------
@@ -134,8 +134,8 @@ class EventRefModel(Gtk.TreeStore):
def column_date(self, event_ref):
event = self.db.get_event_from_handle(event_ref.ref)
- retval = gen.datehandler.get_date(event)
- if not gen.datehandler.get_date_valid(event):
+ retval = get_date(event)
+ if not get_date_valid(event):
return invalid_date_format % cgi.escape(retval)
else:
return retval
diff --git a/gramps/gui/editors/displaytabs/ldsmodel.py b/gramps/gui/editors/displaytabs/ldsmodel.py
index 834a516fc..9198751c1 100644
--- a/gramps/gui/editors/displaytabs/ldsmodel.py
+++ b/gramps/gui/editors/displaytabs/ldsmodel.py
@@ -38,7 +38,7 @@ from gi.repository import Gtk
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.utils.lds import TEMPLES
#-------------------------------------------------------------------------
@@ -57,7 +57,7 @@ class LdsModel(Gtk.ListStore):
for lds_ord in lds_list:
self.append(row=[
lds_ord.type2str(),
- gen.datehandler.get_date(lds_ord),
+ get_date(lds_ord),
lds_ord.status2str(),
TEMPLES.name(lds_ord.get_temple()),
self.column_place(lds_ord),
diff --git a/gramps/gui/editors/editdate.py b/gramps/gui/editors/editdate.py
index 11d627563..967e1ed7a 100644
--- a/gramps/gui/editors/editdate.py
+++ b/gramps/gui/editors/editdate.py
@@ -63,7 +63,7 @@ from gi.repository import Gtk
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
from gen.lib.date import Date
-import gen.datehandler
+from gramps.gen.datehandler import displayer
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
@@ -89,13 +89,13 @@ QUAL_TEXT = (
(Date.QUAL_CALCULATED, _('Calculated')) )
CAL_TO_MONTHS_NAMES = {
- 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 }
+ Date.CAL_GREGORIAN : displayer.short_months,
+ Date.CAL_JULIAN : displayer.short_months,
+ Date.CAL_HEBREW : displayer.hebrew,
+ Date.CAL_FRENCH : displayer.french,
+ Date.CAL_PERSIAN : displayer.persian,
+ Date.CAL_ISLAMIC : displayer.islamic,
+ Date.CAL_SWEDISH : displayer.swedish }
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_1' % URL_MANUAL_PAGE
WIKI_HELP_SEC = _('manual|Editing_Dates')
diff --git a/gramps/gui/editors/editfamily.py b/gramps/gui/editors/editfamily.py
index 6cdc63e17..8d7d460a9 100644
--- a/gramps/gui/editors/editfamily.py
+++ b/gramps/gui/editors/editfamily.py
@@ -65,7 +65,7 @@ from gen.display.name import displayer as name_displayer
import gen.lib
from gen.db import DbTxn
from gen.errors import WindowActiveError
-import gen.datehandler
+from gramps.gen.datehandler import displayer
from gui.glade import Glade
from editprimary import EditPrimary
@@ -909,12 +909,12 @@ class EditFamily(EditPrimary):
if name_obj:
name_obj.set_text(name)
if birth:
- birth_str = gen.datehandler.displayer.display(birth.get_date_object())
+ birth_str = displayer.display(birth.get_date_object())
else:
birth_str = ""
birth_obj.set_text(birth_str)
if death:
- death_str = gen.datehandler.displayer.display(death.get_date_object())
+ death_str = displayer.display(death.get_date_object())
else:
death_str = ""
death_obj.set_text(death_str)
diff --git a/gramps/gui/editors/editprimary.py b/gramps/gui/editors/editprimary.py
index 5adc36c25..905b6099b 100644
--- a/gramps/gui/editors/editprimary.py
+++ b/gramps/gui/editors/editprimary.py
@@ -41,7 +41,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
from gui.managedwindow import ManagedWindow
-import gen.datehandler
+from gramps.gen.datehandler import displayer, parser
from gen.display.name import displayer as name_displayer
from gen.config import config
from gramps.gui.utils import is_right_click
@@ -62,8 +62,8 @@ class EditPrimary(ManagedWindow, DbGUIElement):
Associate a person with the window.
"""
- self.dp = gen.datehandler.parser
- self.dd = gen.datehandler.displayer
+ self.dp = parser
+ self.dd = displayer
self.name_displayer = name_displayer
self.obj = obj
self.dbstate = state
diff --git a/gramps/gui/filters/sidebar/_personsidebarfilter.py b/gramps/gui/filters/sidebar/_personsidebarfilter.py
index 468de4c76..74e70998e 100644
--- a/gramps/gui/filters/sidebar/_personsidebarfilter.py
+++ b/gramps/gui/filters/sidebar/_personsidebarfilter.py
@@ -43,7 +43,7 @@ from gi.repository import Gtk
#-------------------------------------------------------------------------
from gui import widgets
import gen.lib
-import gen.datehandler
+from gramps.gen.datehandler import displayer
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 = gen.datehandler.displayer.display(exdate1)
- msg2 = gen.datehandler.displayer.display(exdate2)
+ msg1 = displayer.display(exdate1)
+ msg2 = displayer.display(exdate2)
self.add_text_entry(_('Name'), self.filter_name)
self.add_text_entry(_('ID'), self.filter_id)
diff --git a/gramps/gui/merge/mergecitation.py b/gramps/gui/merge/mergecitation.py
index 2b983dbd3..0bb17daf3 100644
--- a/gramps/gui/merge/mergecitation.py
+++ b/gramps/gui/merge/mergecitation.py
@@ -34,7 +34,7 @@ from gen.ggettext import sgettext as _
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.utils.string import confidence
from gen.merge import MergeCitationQuery
@@ -82,8 +82,8 @@ class MergeCitation(ManagedWindow):
entry1 = self.get_widget("date1")
entry2 = self.get_widget("date2")
- entry1.set_text(gen.datehandler.get_date(self.citation1))
- entry2.set_text(gen.datehandler.get_date(self.citation2))
+ entry1.set_text(get_date(self.citation1))
+ entry2.set_text(get_date(self.citation2))
if entry1.get_text() == entry2.get_text():
for widget_name in ('date1', 'date2', 'date_btn1',
'date_btn2'):
diff --git a/gramps/gui/merge/mergeevent.py b/gramps/gui/merge/mergeevent.py
index 11003b01d..27b454a1a 100644
--- a/gramps/gui/merge/mergeevent.py
+++ b/gramps/gui/merge/mergeevent.py
@@ -33,7 +33,7 @@ from gen.ggettext import sgettext as _
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.utils.db import get_participant_from_event
from gen.merge import MergeEventQuery
@@ -81,8 +81,8 @@ class MergeEvent(ManagedWindow):
entry1 = self.get_widget("date1")
entry2 = self.get_widget("date2")
- entry1.set_text(gen.datehandler.get_date(self.ev1))
- entry2.set_text(gen.datehandler.get_date(self.ev2))
+ entry1.set_text(get_date(self.ev1))
+ entry2.set_text(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)
diff --git a/gramps/gui/merge/mergemedia.py b/gramps/gui/merge/mergemedia.py
index 92f821705..57a6461ee 100644
--- a/gramps/gui/merge/mergemedia.py
+++ b/gramps/gui/merge/mergemedia.py
@@ -33,7 +33,7 @@ from gen.ggettext import sgettext as _
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
from gui.managedwindow import ManagedWindow
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.merge import MergeMediaQuery
#-------------------------------------------------------------------------
@@ -90,8 +90,8 @@ class MergeMedia(ManagedWindow):
entry1 = self.get_widget("date1")
entry2 = self.get_widget("date2")
- entry1.set_text(gen.datehandler.get_date(self.mo1))
- entry2.set_text(gen.datehandler.get_date(self.mo2))
+ entry1.set_text(get_date(self.mo1))
+ entry2.set_text(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)
diff --git a/gramps/gui/merge/mergeperson.py b/gramps/gui/merge/mergeperson.py
index 5a04fc078..54d52c327 100644
--- a/gramps/gui/merge/mergeperson.py
+++ b/gramps/gui/merge/mergeperson.py
@@ -43,7 +43,7 @@ from gen.plug.report import utils as ReportUtils
from gen.display.name import displayer as name_displayer
from gen.const import URL_MANUAL_PAGE
from gui.display import display_help
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.errors import MergeError
from gui.dialog import ErrorDialog
from gui.managedwindow import ManagedWindow
@@ -282,7 +282,7 @@ class MergePerson(ManagedWindow):
place = ""
if handle:
event = self.database.get_event_from_handle(handle)
- date = gen.datehandler.get_date(event)
+ date = get_date(event)
place = self.place_name(event)
if date:
return ("%s, %s" % (date, place)) if place else date
diff --git a/gramps/gui/views/treemodels/citationbasemodel.py b/gramps/gui/views/treemodels/citationbasemodel.py
index 5a8a84b14..04ca58b16 100644
--- a/gramps/gui/views/treemodels/citationbasemodel.py
+++ b/gramps/gui/views/treemodels/citationbasemodel.py
@@ -39,7 +39,7 @@ LOG = logging.getLogger(".citation")
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.datehandler
+from gramps.gen.datehandler import format_time, get_date, get_date_valid
import gen.lib
from gen.utils.string import confidence
from gen.config import config
@@ -83,10 +83,10 @@ class CitationBaseModel(object):
if data[COLUMN_DATE]:
citation = gen.lib.Citation()
citation.unserialize(data)
- date_str = gen.datehandler.get_date(citation)
+ date_str = get_date(citation)
if date_str != "":
retval = cgi.escape(date_str)
- if not gen.datehandler.get_date_valid(citation):
+ if not get_date_valid(citation):
return INVALID_DATE_FORMAT % retval
else:
return retval
@@ -97,7 +97,7 @@ class CitationBaseModel(object):
citation = gen.lib.Citation()
citation.unserialize(data)
retval = "%09d" % citation.get_date_object().get_sort_value()
- if not gen.datehandler.get_date_valid(citation):
+ if not get_date_valid(citation):
return INVALID_DATE_FORMAT % retval
else:
return retval
@@ -116,7 +116,7 @@ class CitationBaseModel(object):
return unicode(data[COLUMN_HANDLE])
def citation_change(self, data):
- return gen.datehandler.format_time(data[COLUMN_CHANGE])
+ return format_time(data[COLUMN_CHANGE])
def citation_sort_change(self, data):
return "%012x" % data[COLUMN_CHANGE]
@@ -168,7 +168,7 @@ class CitationBaseModel(object):
source_handle = data[COLUMN_SOURCE]
try:
source = self.db.get_source_from_handle(source_handle)
- return gen.datehandler.format_time(source.change)
+ return format_time(source.change)
except:
return u''
@@ -196,7 +196,7 @@ class CitationBaseModel(object):
return unicode(data[COLUMN2_PUBINFO])
def source_src_chan(self, data):
- return gen.datehandler.format_time(data[COLUMN2_CHANGE])
+ return format_time(data[COLUMN2_CHANGE])
def source_sort2_change(self, data):
return "%012x" % data[COLUMN2_CHANGE]
diff --git a/gramps/gui/views/treemodels/eventmodel.py b/gramps/gui/views/treemodels/eventmodel.py
index 41e2b8801..1583577c6 100644
--- a/gramps/gui/views/treemodels/eventmodel.py
+++ b/gramps/gui/views/treemodels/eventmodel.py
@@ -40,7 +40,7 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.datehandler
+from gramps.gen.datehandler import format_time, get_date, get_date_valid
import gen.lib
from gen.utils.db import get_participant_from_event
from gen.config import config
@@ -134,10 +134,10 @@ class EventModel(FlatBaseModel):
if data[COLUMN_DATE]:
event = gen.lib.Event()
event.unserialize(data)
- date_str = gen.datehandler.get_date(event)
+ date_str = get_date(event)
if date_str != "":
retval = cgi.escape(date_str)
- if not gen.datehandler.get_date_valid(event):
+ if not get_date_valid(event):
return INVALID_DATE_FORMAT % retval
else:
return retval
@@ -148,7 +148,7 @@ class EventModel(FlatBaseModel):
event = gen.lib.Event()
event.unserialize(data)
retval = "%09d" % event.get_date_object().get_sort_value()
- if not gen.datehandler.get_date_valid(event):
+ if not get_date_valid(event):
return INVALID_DATE_FORMAT % retval
else:
return retval
@@ -162,7 +162,7 @@ class EventModel(FlatBaseModel):
return "%012x" % data[COLUMN_CHANGE]
def column_change(self,data):
- return gen.datehandler.format_time(data[COLUMN_CHANGE])
+ return format_time(data[COLUMN_CHANGE])
def column_tooltip(self,data):
return u'Event tooltip'
diff --git a/gramps/gui/views/treemodels/familymodel.py b/gramps/gui/views/treemodels/familymodel.py
index 7d27e5388..23335d32d 100644
--- a/gramps/gui/views/treemodels/familymodel.py
+++ b/gramps/gui/views/treemodels/familymodel.py
@@ -41,7 +41,7 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.datehandler
+from gramps.gen.datehandler import displayer, format_time, get_date_valid
from gen.display.name import displayer as name_displayer
from gen.lib import EventRoleType, FamilyRelType
from gui.views.treemodels.flatbasemodel import FlatBaseModel
@@ -147,11 +147,11 @@ class FamilyModel(FlatBaseModel):
event = get_marriage_or_fallback(self.db, family, "%s")
if event:
if event.date.format:
- 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)
+ return event.date.format % displayer.display(event.date)
+ elif not get_date_valid(event):
+ return invalid_date_format % displayer.display(event.date)
else:
- return "%s" % gen.datehandler.displayer.display(event.date)
+ return "%s" % displayer.display(event.date)
else:
return u''
@@ -170,7 +170,7 @@ class FamilyModel(FlatBaseModel):
return "%012x" % data[12]
def column_change(self, data):
- return gen.datehandler.format_time(data[12])
+ return format_time(data[12])
def column_tooltip(self, data):
return u'Family tooltip'
diff --git a/gramps/gui/views/treemodels/mediamodel.py b/gramps/gui/views/treemodels/mediamodel.py
index 4c8c2e42e..77f3d5afc 100644
--- a/gramps/gui/views/treemodels/mediamodel.py
+++ b/gramps/gui/views/treemodels/mediamodel.py
@@ -42,7 +42,7 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.datehandler
+from gramps.gen.datehandler import displayer, format_time
import gen.lib
from gui.views.treemodels.flatbasemodel import FlatBaseModel
@@ -131,7 +131,7 @@ class MediaModel(FlatBaseModel):
if data[9]:
date = gen.lib.Date()
date.unserialize(data[9])
- return unicode(gen.datehandler.displayer.display(date))
+ return unicode(displayer.display(date))
return u''
def sort_date(self,data):
@@ -150,7 +150,7 @@ class MediaModel(FlatBaseModel):
return "%012x" % data[8]
def column_change(self,data):
- return gen.datehandler.format_time(data[8])
+ return format_time(data[8])
def column_tooltip(self,data):
return u'Media tooltip'
diff --git a/gramps/gui/views/treemodels/notemodel.py b/gramps/gui/views/treemodels/notemodel.py
index 472017c39..0f9e0d171 100644
--- a/gramps/gui/views/treemodels/notemodel.py
+++ b/gramps/gui/views/treemodels/notemodel.py
@@ -41,7 +41,7 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.datehandler
+from gramps.gen.datehandler import format_time
from gui.views.treemodels.flatbasemodel import FlatBaseModel
from gen.lib import (Note, NoteType, StyledText)
@@ -129,7 +129,7 @@ class NoteModel(FlatBaseModel):
return "%012x" % data[Note.POS_CHANGE]
def column_change(self,data):
- return gen.datehandler.format_time(data[Note.POS_CHANGE])
+ return format_time(data[Note.POS_CHANGE])
def get_tag_name(self, tag_handle):
"""
diff --git a/gramps/gui/views/treemodels/peoplemodel.py b/gramps/gui/views/treemodels/peoplemodel.py
index d50a3fdba..ce5c9e044 100644
--- a/gramps/gui/views/treemodels/peoplemodel.py
+++ b/gramps/gui/views/treemodels/peoplemodel.py
@@ -58,7 +58,7 @@ _LOG = logging.getLogger(".")
#-------------------------------------------------------------------------
from gen.lib import Name, EventRef, EventType, EventRoleType
from gen.display.name import displayer as name_displayer
-import gen.datehandler
+from gramps.gen.datehandler import format_time, get_date, get_date_valid
from lru import LRU
from gui.views.treemodels.flatbasemodel import FlatBaseModel
from gui.views.treemodels.treebasemodel import TreeBaseModel
@@ -243,7 +243,7 @@ class PeopleBaseModel(object):
return "%012x" % data[COLUMN_CHANGE]
def column_change(self, data):
- return gen.datehandler.format_time(data[COLUMN_CHANGE])
+ return format_time(data[COLUMN_CHANGE])
def column_gender(self, data):
return PeopleBaseModel._GENDER[data[COLUMN_GENDER]]
@@ -273,10 +273,10 @@ class PeopleBaseModel(object):
if sort_mode:
retval = "%09d" % birth.get_date_object().get_sort_value()
else:
- date_str = gen.datehandler.get_date(birth)
+ date_str = get_date(birth)
if date_str != "":
retval = cgi.escape(date_str)
- if not gen.datehandler.get_date_valid(birth):
+ if not get_date_valid(birth):
return invalid_date_format % retval
else:
return retval
@@ -288,7 +288,7 @@ class PeopleBaseModel(object):
er.unserialize(event_ref)
event = self.db.get_event_from_handle(er.ref)
etype = event.get_type()
- date_str = gen.datehandler.get_date(event)
+ date_str = get_date(event)
if (etype in [EventType.BAPTISM, EventType.CHRISTEN]
and er.get_role() == EventRoleType.PRIMARY
and date_str != ""):
@@ -296,7 +296,7 @@ class PeopleBaseModel(object):
retval = "%09d" % event.get_date_object().get_sort_value()
else:
retval = "%s" % cgi.escape(date_str)
- if not gen.datehandler.get_date_valid(event):
+ if not get_date_valid(event):
return invalid_date_format % retval
else:
return retval
@@ -328,10 +328,10 @@ class PeopleBaseModel(object):
if sort_mode:
retval = "%09d" % event.get_date_object().get_sort_value()
else:
- date_str = gen.datehandler.get_date(event)
+ date_str = get_date(event)
if date_str != "":
retval = cgi.escape(date_str)
- if not gen.datehandler.get_date_valid(event):
+ if not get_date_valid(event):
return invalid_date_format % retval
else:
return retval
@@ -343,7 +343,7 @@ class PeopleBaseModel(object):
er.unserialize(event_ref)
event = self.db.get_event_from_handle(er.ref)
etype = event.get_type()
- date_str = gen.datehandler.get_date(event)
+ date_str = get_date(event)
if (etype in [EventType.BURIAL,
EventType.CREMATION,
EventType.CAUSE_DEATH]
@@ -353,7 +353,7 @@ class PeopleBaseModel(object):
retval = "%09d" % event.get_date_object().get_sort_value()
else:
retval = "%s" % cgi.escape(date_str)
- if not gen.datehandler.get_date_valid(event):
+ if not get_date_valid(event):
return invalid_date_format % retval
else:
return retval
diff --git a/gramps/gui/views/treemodels/placemodel.py b/gramps/gui/views/treemodels/placemodel.py
index 148dee75b..5b4f25102 100644
--- a/gramps/gui/views/treemodels/placemodel.py
+++ b/gramps/gui/views/treemodels/placemodel.py
@@ -46,7 +46,7 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.datehandler
+from gramps.gen.datehandler import format_time
from gen.utils.place import conv_lat_lon
from gui.views.treemodels.flatbasemodel import FlatBaseModel
from gui.views.treemodels.treebasemodel import TreeBaseModel
@@ -222,7 +222,7 @@ class PlaceBaseModel(object):
return "%012x" % data[11]
def column_change(self, data):
- return gen.datehandler.format_time(data[11])
+ return format_time(data[11])
def column_tooltip(self, data):
return u'Place tooltip'
diff --git a/gramps/gui/views/treemodels/repomodel.py b/gramps/gui/views/treemodels/repomodel.py
index ef338352d..7bc73403a 100644
--- a/gramps/gui/views/treemodels/repomodel.py
+++ b/gramps/gui/views/treemodels/repomodel.py
@@ -40,7 +40,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
import gen.lib
-import gen.datehandler
+from gramps.gen.datehandler import format_time
from gui.views.treemodels.flatbasemodel import FlatBaseModel
#-------------------------------------------------------------------------
@@ -231,4 +231,4 @@ class RepositoryModel(FlatBaseModel):
return "%012x" % data[7]
def column_change(self,data):
- return gen.datehandler.format_time(data[7])
+ return format_time(data[7])
diff --git a/gramps/gui/views/treemodels/sourcemodel.py b/gramps/gui/views/treemodels/sourcemodel.py
index 4558d0dc4..66fc26d7c 100644
--- a/gramps/gui/views/treemodels/sourcemodel.py
+++ b/gramps/gui/views/treemodels/sourcemodel.py
@@ -39,7 +39,7 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.datehandler
+from gramps.gen.datehandler import format_time
from gui.views.treemodels.flatbasemodel import FlatBaseModel
#-------------------------------------------------------------------------
@@ -107,7 +107,7 @@ class SourceModel(FlatBaseModel):
return unicode(data[4])
def column_change(self,data):
- return gen.datehandler.format_time(data[8])
+ return format_time(data[8])
def sort_change(self,data):
return "%012x" % data[8]
diff --git a/gramps/gui/widgets/monitoredwidgets.py b/gramps/gui/widgets/monitoredwidgets.py
index 8bb477c34..d45cb3586 100644
--- a/gramps/gui/widgets/monitoredwidgets.py
+++ b/gramps/gui/widgets/monitoredwidgets.py
@@ -53,7 +53,7 @@ from gi.repository import Pango
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
from gui.autocomp import StandardCustomSelector, fill_entry
-import gen.datehandler
+from gramps.gen.datehandler import displayer, parser
from gen.lib.date import Date, NextYear
from gen.errors import ValidationError
@@ -621,7 +621,7 @@ class MonitoredDate(object):
self.text_obj.connect('content-changed', self.set_date)
self.button_obj.connect('clicked', self.invoke_date_editor)
- self.text_obj.set_text(gen.datehandler.displayer.display(self.date_obj))
+ self.text_obj.set_text(displayer.display(self.date_obj))
self.text_obj.validate()
self.text_obj.set_editable(not readonly)
@@ -631,7 +631,7 @@ class MonitoredDate(object):
"""
Parse date from text entry to date object
"""
- date = gen.datehandler.parser.parse(unicode(self.text_obj.get_text()))
+ date = parser.parse(unicode(self.text_obj.get_text()))
self.date_obj.copy(date)
def validate(self, widget, data):
@@ -663,7 +663,7 @@ class MonitoredDate(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(gen.datehandler.displayer.display(date_obj))
+ self.text_obj.set_text(displayer.display(date_obj))
self.text_obj.validate()
#-------------------------------------------------------------------------
diff --git a/gramps/plugins/drawreport/statisticschart.py b/gramps/plugins/drawreport/statisticschart.py
index 73b3d7220..2b7eb478e 100644
--- a/gramps/plugins/drawreport/statisticschart.py
+++ b/gramps/plugins/drawreport/statisticschart.py
@@ -55,7 +55,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 gen.datehandler
+from gramps.gen.datehandler import displayer, parser
#------------------------------------------------------------------------
#
@@ -192,7 +192,7 @@ def draw_legend(doc, start_x, start_y, data, title, label_style):
start_y += size * 1.3
_t = time.localtime(time.time())
-_TODAY = gen.datehandler.parser.parse("%04d-%02d-%02d" % _t[:3])
+_TODAY = parser.parse("%04d-%02d-%02d" % _t[:3])
def estimate_age(db, person, end_handle=None, start_handle=None, today=_TODAY):
"""
@@ -410,7 +410,7 @@ class Extract(object):
if date:
month = date.get_month()
if month:
- return [gen.datehandler.displayer.long_months[month]]
+ return [displayer.long_months[month]]
return [_("Date(s) missing")]
def get_place(self, event):
diff --git a/gramps/plugins/export/exportcsv.py b/gramps/plugins/export/exportcsv.py
index ab66a108a..ab3f3a425 100644
--- a/gramps/plugins/export/exportcsv.py
+++ b/gramps/plugins/export/exportcsv.py
@@ -53,7 +53,7 @@ import gen.lib
from gen.lib.eventroletype import EventRoleType
from gui.plug.export import WriterOptionBox
from gen.utils.string import gender as gender_map
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gui.glade import Glade
#-------------------------------------------------------------------------
@@ -519,4 +519,4 @@ class CSVWriter(object):
return True
def format_date(self, date):
- return gen.datehandler.get_date(date)
+ return get_date(date)
diff --git a/gramps/plugins/gramplet/ageondategramplet.py b/gramps/plugins/gramplet/ageondategramplet.py
index 6ec702adf..4b089fea4 100644
--- a/gramps/plugins/gramplet/ageondategramplet.py
+++ b/gramps/plugins/gramplet/ageondategramplet.py
@@ -36,7 +36,7 @@ on a particular date.
#------------------------------------------------------------------------
from gen.plug import Gramplet
from gen.ggettext import sgettext as _
-import gen.datehandler
+from gramps.gen.datehandler import parser
from gui.plug.quick 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 = gen.datehandler.parser.parse(text)
+ date = parser.parse(text)
run_quick_report_by_name(self.gui.dbstate,
self.gui.uistate,
'ageondate',
diff --git a/gramps/plugins/gramplet/children.py b/gramps/plugins/gramplet/children.py
index 71dbda435..876bab7e6 100644
--- a/gramps/plugins/gramplet/children.py
+++ b/gramps/plugins/gramplet/children.py
@@ -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.db import get_birth_or_fallback, get_death_or_fallback
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.errors import WindowActiveError
from gi.repository import Gtk
@@ -48,7 +48,7 @@ class Children(Gramplet):
event_place = ''
event_sort = '%012d' % 0
if event:
- event_date = gen.datehandler.get_date(event)
+ event_date = get_date(event)
event_sort = '%012d' % event.get_date_object().get_sort_value()
handle = event.get_place_handle()
if handle:
diff --git a/gramps/plugins/gramplet/descendgramplet.py b/gramps/plugins/gramplet/descendgramplet.py
index 591c07246..7f64084ec 100644
--- a/gramps/plugins/gramplet/descendgramplet.py
+++ b/gramps/plugins/gramplet/descendgramplet.py
@@ -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 gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.utils.db 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 = gen.datehandler.get_date(birth)
+ birth_date = get_date(birth)
if death:
- death_date = gen.datehandler.get_date(death)
+ death_date = get_date(death)
if birth or death:
self.append_text(' (')
diff --git a/gramps/plugins/gramplet/events.py b/gramps/plugins/gramplet/events.py
index d1204b113..07715fef3 100644
--- a/gramps/plugins/gramplet/events.py
+++ b/gramps/plugins/gramplet/events.py
@@ -24,7 +24,7 @@ from gui.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 gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.utils.db import get_birth_or_fallback, get_marriage_or_fallback
from gen.errors import WindowActiveError
from gi.repository import Gtk
@@ -66,7 +66,7 @@ class Events(Gramplet):
Add an event to the model.
"""
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
- event_date = gen.datehandler.get_date(event)
+ event_date = get_date(event)
event_sort = '%012d' % event.get_date_object().get_sort_value()
person_age = self.column_age(event)
person_age_sort = self.column_sort_age(event)
diff --git a/gramps/plugins/gramplet/pedigreegramplet.py b/gramps/plugins/gramplet/pedigreegramplet.py
index b0b8113bc..929293c6b 100644
--- a/gramps/plugins/gramplet/pedigreegramplet.py
+++ b/gramps/plugins/gramplet/pedigreegramplet.py
@@ -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 gen.datehandler
+from gramps.gen.datehandler import get_date
import gen
from gen.utils.db 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 = gen.datehandler.get_date(birth)
+ sdate = get_date(birth)
if sdate:
bdate = "%s" % cgi.escape(sdate)
else:
bdate = ""
elif birth:
- bdate = cgi.escape(gen.datehandler.get_date(birth))
+ bdate = cgi.escape(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 = gen.datehandler.get_date(death)
+ sdate = get_date(death)
if sdate:
ddate = "%s" % cgi.escape(sdate)
else:
ddate = ""
elif death:
- ddate = cgi.escape(gen.datehandler.get_date(death))
+ ddate = cgi.escape(get_date(death))
else:
ddate = ""
diff --git a/gramps/plugins/gramplet/persondetails.py b/gramps/plugins/gramplet/persondetails.py
index 989d69e8e..96ec64f7f 100644
--- a/gramps/plugins/gramplet/persondetails.py
+++ b/gramps/plugins/gramplet/persondetails.py
@@ -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 gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.utils.file import media_path_full
from gi.repository import Gtk
from gi.repository import Pango
@@ -204,7 +204,7 @@ class PersonDetails(Gramplet):
"""
Format the event for display.
"""
- date = gen.datehandler.get_date(event)
+ date = get_date(event)
handle = event.get_place_handle()
if handle:
place = self.dbstate.db.get_place_from_handle(handle).get_title()
diff --git a/gramps/plugins/gramplet/personresidence.py b/gramps/plugins/gramplet/personresidence.py
index 61e6b9549..0af14b19e 100644
--- a/gramps/plugins/gramplet/personresidence.py
+++ b/gramps/plugins/gramplet/personresidence.py
@@ -24,7 +24,7 @@ from gui.editors import EditEvent
from gui.listmodel import ListModel, NOSORT
from gen.plug import Gramplet
from gen.ggettext import gettext as _
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.errors import WindowActiveError
from gi.repository import Gtk
@@ -101,7 +101,7 @@ class PersonResidence(Gramplet):
"""
Add a residence event to the model.
"""
- date = gen.datehandler.get_date(event)
+ date = get_date(event)
place = ''
handle = event.get_place_handle()
if handle:
diff --git a/gramps/plugins/gramplet/statsgramplet.py b/gramps/plugins/gramplet/statsgramplet.py
index eb3ffbdff..8f20f9dda 100644
--- a/gramps/plugins/gramplet/statsgramplet.py
+++ b/gramps/plugins/gramplet/statsgramplet.py
@@ -33,7 +33,7 @@ import posixpath
from gen.plug import Gramplet
from gen.ggettext import sgettext as _
from gen.utils.file import media_path_full
-import gen.datehandler
+from gramps.gen.datehandler import get_date
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 gen.datehandler.get_date(birth):
+ if not get_date(birth):
missing_bday += 1
else:
missing_bday += 1
diff --git a/gramps/plugins/graph/gvhourglass.py b/gramps/plugins/graph/gvhourglass.py
index cb72abdd5..072d0af81 100644
--- a/gramps/plugins/graph/gvhourglass.py
+++ b/gramps/plugins/graph/gvhourglass.py
@@ -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 gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.utils.db 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 = gen.datehandler.get_date(birth_evt)
+ birth = get_date(birth_evt)
else:
birth = ""
death_evt = get_death_or_fallback(self.__db, person)
if death_evt:
- death = gen.datehandler.get_date(death_evt)
+ death = get_date(death_evt)
else:
death = ""
@@ -198,7 +198,7 @@ class HourGlassReport(Report):
label = ""
marriage = ReportUtils.find_marriage(self.__db, family)
if marriage:
- label = gen.datehandler.get_date(marriage)
+ label = get_date(marriage)
color = ""
fill = ""
style = "solid"
diff --git a/gramps/plugins/graph/gvrelgraph.py b/gramps/plugins/graph/gvrelgraph.py
index 3435ae266..84f20e1f8 100644
--- a/gramps/plugins/graph/gvrelgraph.py
+++ b/gramps/plugins/graph/gvrelgraph.py
@@ -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 gen.datehandler
+from gramps.gen.datehandler import get_date
import gen.lib
from gen.utils.file import media_path_full, find_file
from gui.thumbnails import get_thumbnail_path
@@ -442,7 +442,7 @@ class RelGraphReport(Report):
if self.just_years:
return '%i' % event.get_date_object().get_year()
else:
- return gen.datehandler.get_date(event)
+ return get_date(event)
elif self.use_place:
place_handle = event.get_place_handle()
place = self.database.get_place_from_handle(place_handle)
diff --git a/gramps/plugins/import/importxml.py b/gramps/plugins/import/importxml.py
index 7cd3e2971..9510f45cc 100644
--- a/gramps/plugins/import/importxml.py
+++ b/gramps/plugins/import/importxml.py
@@ -51,7 +51,7 @@ from gen.errors import GrampsImportError
from gen.utils.id import create_id
from gen.utils.db import family_name
from gen.utils.unknown import make_unknown, create_explanation_note
-import gen.datehandler
+from gramps.gen.datehandler import parser, set_date
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,
@@ -464,7 +464,7 @@ class GrampsParser(UpdateCallback):
self.gid2nid = {}
self.childref_map = {}
self.change = change
- self.dp = gen.datehandler.parser
+ self.dp = parser
self.info = ImportInfo()
self.all_abs = True
self.db = database
@@ -2589,9 +2589,9 @@ class GrampsParser(UpdateCallback):
def stop_date(self, tag):
if tag:
if self.address:
- gen.datehandler.set_date(self.address, tag)
+ set_date(self.address, tag)
else:
- gen.datehandler.set_date(self.event, tag)
+ set_date(self.event, tag)
def stop_first(self, tag):
self.name.set_first_name(tag)
diff --git a/gramps/plugins/lib/libmetadata.py b/gramps/plugins/lib/libmetadata.py
index 06c51d137..307d62791 100644
--- a/gramps/plugins/lib/libmetadata.py
+++ b/gramps/plugins/lib/libmetadata.py
@@ -40,7 +40,7 @@ from gen.ggettext import gettext as _
from gen.utils.place import conv_lat_lon
from fractions import Fraction
import gen.lib
-import gen.datehandler
+from gramps.gen.datehandler import displayer
import datetime
import pyexiv2
@@ -60,7 +60,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 = gen.datehandler.displayer.display(date_part)
+ date_str = displayer.display(date_part)
time_str = _('%(hr)02d:%(min)02d:%(sec)02d') % {'hr': exif_dt.hour,
'min': exif_dt.minute,
'sec': exif_dt.second}
diff --git a/gramps/plugins/lib/libsubstkeyword.py b/gramps/plugins/lib/libsubstkeyword.py
index 1217fe2f9..508e7f7fb 100644
--- a/gramps/plugins/lib/libsubstkeyword.py
+++ b/gramps/plugins/lib/libsubstkeyword.py
@@ -38,7 +38,7 @@ Mary Smith was born on 3/28/1923.
#
#------------------------------------------------------------------------
from gen.display.name import displayer as name_displayer
-import gen.datehandler
+from gramps.gen.datehandler import displayer
import gen.lib
from gen.utils.db import get_birth_or_fallback, get_death_or_fallback
@@ -191,7 +191,7 @@ class DateFormat(GenericFormat):
return None
def _default_format(self, date):
- return gen.datehandler.displayer.display(date)
+ return displayer.display(date)
def __count_chars(self, char, max_amount):
""" count the year/month/day codes """
@@ -248,9 +248,9 @@ class DateFormat(GenericFormat):
tmp = "0" + month
return tmp[-2:]
elif count == 3: #found 'mmm'
- return gen.datehandler.displayer.short_months[int(month)]
+ return displayer.short_months[int(month)]
else: #found 'mmmm'
- return gen.datehandler.displayer.long_months[int(month)]
+ return displayer.long_months[int(month)]
def month_up():
return month("M").upper()
diff --git a/gramps/plugins/lib/libtranslate.py b/gramps/plugins/lib/libtranslate.py
index ae95ea3c7..5d0411f52 100644
--- a/gramps/plugins/lib/libtranslate.py
+++ b/gramps/plugins/lib/libtranslate.py
@@ -38,7 +38,7 @@ _ = gettext.gettext
#
#------------------------------------------------------------------------
from gen.utils.trans import get_localedomain
-import gen.datehandler
+from gramps.gen.datehandler import displayer, LANG_TO_DISPLAY
from gen.config import config
from gen.lib.grampstype import GrampsType
@@ -139,7 +139,7 @@ class Translator:
"""
if lang == Translator.DEFAULT_TRANSLATION_STR:
self.__trans = None
- self.__dd = gen.datehandler.displayer
+ self.__dd = displayer
else:
# fallback=True will cause the translator to use English if
# lang = "en" or if something goes wrong.
@@ -147,10 +147,10 @@ class Translator:
languages=[lang],
fallback=True)
val = config.get('preferences.date-format')
- if lang in gen.datehandler.LANG_TO_DISPLAY:
- self.__dd = gen.datehandler.LANG_TO_DISPLAY[lang](val)
+ if lang in LANG_TO_DISPLAY:
+ self.__dd = LANG_TO_DISPLAY[lang](val)
else:
- self.__dd = gen.datehandler.displayer
+ self.__dd = displayer
def gettext(self, message):
"""
diff --git a/gramps/plugins/quickview/ageondate.py b/gramps/plugins/quickview/ageondate.py
index 62e759859..df88370e0 100644
--- a/gramps/plugins/quickview/ageondate.py
+++ b/gramps/plugins/quickview/ageondate.py
@@ -31,7 +31,7 @@ from gen.simple import SimpleAccess, SimpleDoc
from gui.plug.quick import QuickTable
from gen.utils.alive import probably_alive
from gen.ggettext import gettext as _
-import gen.datehandler
+from gramps.gen.datehandler import displayer
import gen.lib
from gen.config import config
@@ -49,10 +49,10 @@ def run(database, document, date):
# display the title
if date.get_day_valid():
sdoc.title(_("People probably alive and their ages the %s") %
- gen.datehandler.displayer.display(date))
+ displayer.display(date))
else:
sdoc.title(_("People probably alive and their ages on %s") %
- gen.datehandler.displayer.display(date))
+ displayer.display(date))
stab.columns(_("Person"), _("Age")) # Actual Date makes column unicode
matches = 0
for person in sdb.all_people():
diff --git a/gramps/plugins/quickview/filterbyname.py b/gramps/plugins/quickview/filterbyname.py
index e8b743c75..ce6ff7abb 100644
--- a/gramps/plugins/quickview/filterbyname.py
+++ b/gramps/plugins/quickview/filterbyname.py
@@ -32,7 +32,7 @@ from gui.plug.quick import QuickTable
from gen.utils.file import media_path_full
from gui.plug.quick import run_quick_report_by_name_direct
from gen.lib import Person
-import gen.datehandler
+from gramps.gen.datehandler import get_date
import posixpath
from collections import defaultdict
@@ -304,7 +304,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 gen.datehandler.get_date(birth):
+ if not get_date(birth):
stab.row(person, _("birth event but no date"))
matches += 1
else:
diff --git a/gramps/plugins/textreport/descendreport.py b/gramps/plugins/textreport/descendreport.py
index 94fc2a554..e18ce3c1b 100644
--- a/gramps/plugins/textreport/descendreport.py
+++ b/gramps/plugins/textreport/descendreport.py
@@ -51,7 +51,7 @@ from gen.errors import ReportError
from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.sort import Sort
from gen.utils.db 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 = gen.datehandler.get_date(event)
+ date = get_date(event)
place_handle = event.get_place_handle()
if place_handle:
place = self.database.get_place_from_handle(
diff --git a/gramps/plugins/textreport/endoflinereport.py b/gramps/plugins/textreport/endoflinereport.py
index fd9d257bf..37ae16c1c 100644
--- a/gramps/plugins/textreport/endoflinereport.py
+++ b/gramps/plugins/textreport/endoflinereport.py
@@ -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 gen.datehandler
+from gramps.gen.datehandler import get_date
#------------------------------------------------------------------------
#
@@ -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 = gen.datehandler.get_date( event )
+ birth_date = 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 = gen.datehandler.get_date( event )
+ death_date = get_date( event )
dates = _(" (%(birth_date)s - %(death_date)s)") % {
'birth_date' : birth_date,
'death_date' : death_date }
diff --git a/gramps/plugins/textreport/familygroup.py b/gramps/plugins/textreport/familygroup.py
index 75115c3b6..19bc6c1b9 100644
--- a/gramps/plugins/textreport/familygroup.py
+++ b/gramps/plugins/textreport/familygroup.py
@@ -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 gen.datehandler
+from gramps.gen.datehandler import get_date
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 = gen.datehandler.get_date(event)
+ date = 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 = gen.datehandler.get_date( event )
+ birth = get_date( event )
death_ref = father.get_death_ref()
death = " "
if death_ref:
event = self.database.get_event_from_handle(death_ref.ref)
- death = gen.datehandler.get_date( event )
+ death = 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 = gen.datehandler.get_date( event )
+ birth = get_date( event )
death_ref = mother.get_death_ref()
death = " "
if death_ref:
event = self.database.get_event_from_handle(death_ref.ref)
- death = gen.datehandler.get_date( event )
+ death = 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 = gen.datehandler.get_date( addr )
+ date = 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 = gen.datehandler.get_date(event)
+ date = 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 = gen.datehandler.get_date(event)
+ birth = get_date(event)
death = " "
death_ref = spouse.get_death_ref()
if death_ref:
event = self.database.get_event_from_handle(death_ref.ref)
- death = gen.datehandler.get_date(event)
+ death = 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)
diff --git a/gramps/plugins/textreport/indivcomplete.py b/gramps/plugins/textreport/indivcomplete.py
index b3918859f..1785f5cc3 100644
--- a/gramps/plugins/textreport/indivcomplete.py
+++ b/gramps/plugins/textreport/indivcomplete.py
@@ -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 gen.datehandler
+from gramps.gen.datehandler import get_date
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 = gen.datehandler.get_date(event)
+ date = 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 = gen.datehandler.get_date(addr)
+ date = get_date(addr)
endnotes = ""
if self.use_srcs:
endnotes = Endnotes.cite_source(self.bibli, self.database, addr)
diff --git a/gramps/plugins/textreport/kinshipreport.py b/gramps/plugins/textreport/kinshipreport.py
index 8e49b8b1c..b27d9af3f 100644
--- a/gramps/plugins/textreport/kinshipreport.py
+++ b/gramps/plugins/textreport/kinshipreport.py
@@ -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 gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.utils.db 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 = gen.datehandler.get_date(birth)
+ birth_date = get_date(birth)
death_date = ""
death = get_death_or_fallback(self.database, person)
if death:
- death_date = gen.datehandler.get_date(death)
+ death_date = get_date(death)
dates = _(" (%(birth_date)s - %(death_date)s)") % {
'birth_date' : birth_date,
'death_date' : death_date }
diff --git a/gramps/plugins/textreport/placereport.py b/gramps/plugins/textreport/placereport.py
index 4b4e73691..6978d9236 100644
--- a/gramps/plugins/textreport/placereport.py
+++ b/gramps/plugins/textreport/placereport.py
@@ -44,7 +44,7 @@ from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle, TableStyle,
TableCellStyle, FONT_SANS_SERIF, FONT_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
from gen.proxy import PrivateProxyDb
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gen.sort import Sort
from gen.display.name import displayer as _nd
@@ -193,7 +193,7 @@ class PlaceReport(Report):
for evt_handle in event_handles:
event = self.database.get_event_from_handle(evt_handle)
if event:
- date = gen.datehandler.get_date(event)
+ date = get_date(event)
descr = event.get_description()
event_type = str(event.get_type())
@@ -315,7 +315,7 @@ class PlaceReport(Report):
for evt_handle in person_dict[entry]:
event = self.database.get_event_from_handle(evt_handle)
if event:
- date = gen.datehandler.get_date(event)
+ date = get_date(event)
descr = event.get_description()
event_type = str(event.get_type())
event_details = [people, event_type, descr, date]
diff --git a/gramps/plugins/textreport/summary.py b/gramps/plugins/textreport/summary.py
index a0f18d287..9f63faa37 100644
--- a/gramps/plugins/textreport/summary.py
+++ b/gramps/plugins/textreport/summary.py
@@ -46,7 +46,7 @@ from gen.plug.report import MenuReportOptions
from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle,
FONT_SANS_SERIF, INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
from gen.utils.file import media_path_full
-import gen.datehandler
+from gramps.gen.datehandler import get_date
#------------------------------------------------------------------------
@@ -133,7 +133,7 @@ class SummaryReport(Report):
birth_ref = person.get_birth_ref()
if birth_ref:
birth = self.__db.get_event_from_handle(birth_ref.ref)
- if not gen.datehandler.get_date(birth):
+ if not get_date(birth):
missing_bday += 1
else:
missing_bday += 1
diff --git a/gramps/plugins/textreport/tagreport.py b/gramps/plugins/textreport/tagreport.py
index c16847ad4..8c45fa8f2 100644
--- a/gramps/plugins/textreport/tagreport.py
+++ b/gramps/plugins/textreport/tagreport.py
@@ -48,7 +48,7 @@ from gen.lib import NoteType
from gen.filters import GenericFilterFactory, rules
from gen.display.name import displayer as name_displayer
from gen.errors import ReportError
-import gen.datehandler
+from gramps.gen.datehandler import get_date
#------------------------------------------------------------------------
#
@@ -163,7 +163,7 @@ class TagReport(Report):
birth_ref = person.get_birth_ref()
if birth_ref:
event = self.database.get_event_from_handle(birth_ref.ref)
- self.doc.write_text(gen.datehandler.get_date( event ))
+ self.doc.write_text(get_date( event ))
self.doc.end_paragraph()
self.doc.end_cell()
@@ -172,7 +172,7 @@ class TagReport(Report):
death_ref = person.get_death_ref()
if death_ref:
event = self.database.get_event_from_handle(death_ref.ref)
- self.doc.write_text(gen.datehandler.get_date( event ))
+ self.doc.write_text(get_date( event ))
self.doc.end_paragraph()
self.doc.end_cell()
@@ -329,7 +329,7 @@ class TagReport(Report):
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
- date = gen.datehandler.get_date(event)
+ date = get_date(event)
if date:
self.doc.write_text(date)
self.doc.end_paragraph()
@@ -499,7 +499,7 @@ class TagReport(Report):
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
- date = gen.datehandler.get_date(media)
+ date = get_date(media)
if date:
self.doc.write_text(date)
self.doc.end_paragraph()
diff --git a/gramps/plugins/tool/eventcmp.py b/gramps/plugins/tool/eventcmp.py
index be7ceabfa..7f29e2657 100644
--- a/gramps/plugins/tool/eventcmp.py
+++ b/gramps/plugins/tool/eventcmp.py
@@ -52,7 +52,7 @@ from gui.utils import ProgressMeter
from gen.utils.docgen import ODSTab
from gen.const import CUSTOM_FILTERS, URL_MANUAL_PAGE
from gen.errors import WindowActiveError
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gui.dialog import WarningDialog
from gui.plug import tool
from gen.plug.report import utils as ReportUtils
@@ -333,7 +333,7 @@ class DisplayChart(ManagedWindow):
if event_handle:
event = self.db.get_event_from_handle(event_handle)
- date = gen.datehandler.get_date(event)
+ date = get_date(event)
sortdate = "%09d" % (
event.get_date_object().get_sort_value()
)
diff --git a/gramps/plugins/tool/mergecitations.py b/gramps/plugins/tool/mergecitations.py
index 8efcebb87..3ea7b787a 100644
--- a/gramps/plugins/tool/mergecitations.py
+++ b/gramps/plugins/tool/mergecitations.py
@@ -51,7 +51,7 @@ from gui.utils import ProgressMeter
from gui.plug import tool
from gui.dialog import OkDialog
from gui.display import display_help
-import gen.datehandler
+from gramps.gen.datehandler import get_date
from gui.managedwindow import ManagedWindow
from gen.ggettext import sgettext as _
from gen.ggettext import ngettext
@@ -197,7 +197,7 @@ class MergeCitations(tool.BatchTool,ManagedWindow):
citation = db.get_citation_from_handle(citation_handle)
key = citation.get_page()
if fields <> IGNORE_DATE and fields <> IGNORE_BOTH:
- key += "\n" + gen.datehandler.get_date(citation)
+ key += "\n" + get_date(citation)
if fields <> IGNORE_CONFIDENCE and fields <> IGNORE_BOTH:
key += "\n" + \
confidence[citation.get_confidence_level()]
diff --git a/gramps/plugins/view/geoclose.py b/gramps/plugins/view/geoclose.py
index 3bab1c3a5..13f196307 100644
--- a/gramps/plugins/view/geoclose.py
+++ b/gramps/plugins/view/geoclose.py
@@ -50,7 +50,7 @@ _LOG = logging.getLogger("GeoGraphy.geoclose")
#-------------------------------------------------------------------------
import gen.lib
from gen.config import config
-import gen.datehandler
+from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
from gen.utils.place import conv_lat_lon
from gui.views.navigationview import NavigationView
@@ -442,7 +442,7 @@ class GeoClose(GeoGraphyView):
message = ""
evt = self.dbstate.db.get_event_from_gramps_id(plce[10])
# format the date as described in preferences.
- date = gen.datehandler.displayer.display(evt.get_date_object())
+ date = displayer.display(evt.get_date_object())
if date == "":
date = _("Unknown")
if ( plce[11] == gen.lib.EventRoleType.PRIMARY ):
diff --git a/gramps/plugins/view/geoevents.py b/gramps/plugins/view/geoevents.py
index d0caffdbe..0c6fd099d 100644
--- a/gramps/plugins/view/geoevents.py
+++ b/gramps/plugins/view/geoevents.py
@@ -56,7 +56,7 @@ _LOG = logging.getLogger("GeoGraphy.geoevents")
#-------------------------------------------------------------------------
import gen.lib
from gen.config import config
-import gen.datehandler
+from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
from gen.utils.place import conv_lat_lon
from gui.views.pageview import PageView
@@ -334,7 +334,7 @@ class GeoEvents(GeoGraphyView):
oldplace = mark[0]
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
# format the date as described in preferences.
- date = gen.datehandler.displayer.display(evt.get_date_object())
+ date = displayer.display(evt.get_date_object())
message = "(%s) %s : %s" % (date, gen.lib.EventType( mark[7] ), mark[5] )
prevmark = mark
add_item = Gtk.MenuItem(label=message)
diff --git a/gramps/plugins/view/geofamclose.py b/gramps/plugins/view/geofamclose.py
index 646d3ec72..5c7544e6d 100644
--- a/gramps/plugins/view/geofamclose.py
+++ b/gramps/plugins/view/geofamclose.py
@@ -50,7 +50,7 @@ _LOG = logging.getLogger("GeoGraphy.geofamilyclose")
#-------------------------------------------------------------------------
import gen.lib
from gen.config import config
-import gen.datehandler
+from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
from gen.utils.place import conv_lat_lon
from gui.views.navigationview import NavigationView
@@ -631,7 +631,7 @@ class GeoFamClose(GeoGraphyView):
message = ""
evt = self.dbstate.db.get_event_from_gramps_id(plce[10])
# format the date as described in preferences.
- date = gen.datehandler.displayer.display(evt.get_date_object())
+ date = displayer.display(evt.get_date_object())
if date == "":
date = _("Unknown")
if ( plce[11] == gen.lib.EventRoleType.PRIMARY ):
diff --git a/gramps/plugins/view/geofamily.py b/gramps/plugins/view/geofamily.py
index 1faf8420c..7940013ab 100644
--- a/gramps/plugins/view/geofamily.py
+++ b/gramps/plugins/view/geofamily.py
@@ -56,7 +56,7 @@ _LOG = logging.getLogger("GeoGraphy.geofamily")
#-------------------------------------------------------------------------
import gen.lib
from gen.config import config
-import gen.datehandler
+from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
from gen.utils.place import conv_lat_lon
from gui.views.pageview import PageView
@@ -425,7 +425,7 @@ class GeoFamily(GeoGraphyView):
oldplace = mark[0]
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
# format the date as described in preferences.
- date = gen.datehandler.displayer.display(evt.get_date_object())
+ date = displayer.display(evt.get_date_object())
if date == "":
date = _("Unknown")
if ( mark[5] == gen.lib.EventRoleType.PRIMARY ):
diff --git a/gramps/plugins/view/geomoves.py b/gramps/plugins/view/geomoves.py
index 3ba4ca734..c2a462e90 100644
--- a/gramps/plugins/view/geomoves.py
+++ b/gramps/plugins/view/geomoves.py
@@ -54,7 +54,7 @@ _LOG = logging.getLogger("GeoGraphy.geomoves")
#-------------------------------------------------------------------------
import gen.lib
from gen.config import config
-import gen.datehandler
+from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
from gen.utils.place import conv_lat_lon
from gui.views.navigationview import NavigationView
@@ -570,7 +570,7 @@ class GeoMoves(GeoGraphyView):
message = ""
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
# format the date as described in preferences.
- date = gen.datehandler.displayer.display(evt.get_date_object())
+ date = displayer.display(evt.get_date_object())
if date == "":
date = _("Unknown")
if ( mark[11] == gen.lib.EventRoleType.PRIMARY ):
diff --git a/gramps/plugins/view/geoperson.py b/gramps/plugins/view/geoperson.py
index 1c5440eed..1f3e67a5a 100644
--- a/gramps/plugins/view/geoperson.py
+++ b/gramps/plugins/view/geoperson.py
@@ -57,7 +57,7 @@ _LOG = logging.getLogger("GeoGraphy.geoperson")
#-------------------------------------------------------------------------
import gen.lib
from gen.config import config
-import gen.datehandler
+from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
from gen.utils.place import conv_lat_lon
from gui.views.pageview import PageView
@@ -450,7 +450,7 @@ class GeoPerson(GeoGraphyView):
message = ""
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
# format the date as described in preferences.
- date = gen.datehandler.displayer.display(evt.get_date_object())
+ date = displayer.display(evt.get_date_object())
if date == "":
date = _("Unknown")
if ( mark[11] == gen.lib.EventRoleType.PRIMARY ):
diff --git a/gramps/plugins/view/relview.py b/gramps/plugins/view/relview.py
index 87c85b558..8e610fd9a 100644
--- a/gramps/plugins/view/relview.py
+++ b/gramps/plugins/view/relview.py
@@ -64,7 +64,7 @@ from gen.display.name import displayer as name_displayer
from gen.utils.file import media_path_full
from gen.utils.alive import probably_alive
from gui.utils import open_file_with_default_application
-import gen.datehandler
+from gramps.gen.datehandler import displayer, get_date
from gui.thumbnails import get_thumbnail_image
from gen.config import config
from gui import widgets
@@ -721,7 +721,7 @@ class RelationshipView(NavigationView):
pname = None
value = {
- 'date' : gen.datehandler.displayer.display(dobj),
+ 'date' : displayer.display(dobj),
'place' : pname,
}
else:
@@ -749,7 +749,7 @@ class RelationshipView(NavigationView):
pname = None
value = {
- 'date' : gen.datehandler.displayer.display(dobj),
+ 'date' : displayer.display(dobj),
'place' : pname,
}
else:
@@ -1169,25 +1169,25 @@ class RelationshipView(NavigationView):
birth = get_birth_or_fallback(self.dbstate.db, person)
if birth and birth.get_type() != gen.lib.EventType.BIRTH:
- sdate = gen.datehandler.get_date(birth)
+ sdate = get_date(birth)
if sdate:
bdate = "%s" % cgi.escape(sdate)
else:
bdate = ""
elif birth:
- bdate = cgi.escape(gen.datehandler.get_date(birth))
+ bdate = cgi.escape(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 = gen.datehandler.get_date(death)
+ sdate = get_date(death)
if sdate:
ddate = "%s" % cgi.escape(sdate)
else:
ddate = ""
elif death:
- ddate = cgi.escape(gen.datehandler.get_date(death))
+ ddate = cgi.escape(get_date(death))
else:
ddate = ""
@@ -1292,7 +1292,7 @@ class RelationshipView(NavigationView):
pname = None
value = {
- 'date' : gen.datehandler.displayer.display(dobj),
+ 'date' : displayer.display(dobj),
'place' : pname,
'event_type' : ename,
}