* various: remove set_date/get_date removal to be replaced by

DateHandler calls


svn: r5031
This commit is contained in:
Don Allingham 2005-08-06 02:57:37 +00:00
parent 895d7e1a53
commit f1b3c2c39f
26 changed files with 191 additions and 111 deletions

View File

@ -1,3 +1,7 @@
2005-08-05 Don Allingham <don@gramps-project.org>
* various: remove set_date/get_date removal to be replaced by
DateHandler calls
2005-07-08 Alex Roitman <shura@gramps-project.org> 2005-07-08 Alex Roitman <shura@gramps-project.org>
* various: merge changes made in gramps20 branch with main trunk. * various: merge changes made in gramps20 branch with main trunk.

View File

@ -51,6 +51,7 @@ import Date
import RelLib import RelLib
import Sources import Sources
import DateEdit import DateEdit
import DateHandler
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -109,7 +110,7 @@ class AddressEditor:
if self.addr: if self.addr:
self.srcreflist = self.addr.get_source_references() self.srcreflist = self.addr.get_source_references()
self.addr_date_obj = Date.Date(self.addr.get_date_object()) self.addr_date_obj = Date.Date(self.addr.get_date_object())
self.addr_start.set_text(self.addr.get_date()) self.addr_start.set_text(DateHandler.get_date(self.addr))
self.street.set_text(self.addr.get_street()) self.street.set_text(self.addr.get_street())
self.city.set_text(self.addr.get_city()) self.city.set_text(self.addr.get_city())
self.state.set_text(self.addr.get_state()) self.state.set_text(self.addr.get_state())

View File

@ -143,3 +143,46 @@ except:
print "Date displayer for",_lang,"not available, using default" print "Date displayer for",_lang,"not available, using default"
displayer = _lang_to_display["C"](val) displayer = _lang_to_display["C"](val)
#--------------------------------------------------------------
#
# Convenience functions
#
#--------------------------------------------------------------
def set_date(date_base, text) :
"""
Sets the date of the DateBase instance.
The date is parsed into a L{Date} instance.
@param date: String representation of a date. The locale specific
L{DateParser} is used to parse the string into a GRAMPS L{Date}
object.
@type date: str
"""
parser.set_date(date_base.get_date_object(),text)
def get_date(date_base) :
"""
Returns a string representation of the date of the DateBase instance.
This representation is based off the default date display format
determined by the locale's L{DateDisplay} instance.
@return: Returns a string representing the DateBase date
@rtype: str
"""
return displayer.display(date_base.get_date_object())
def get_quote_date(self) :
"""
Returns a string representation of the date of the DateBase instance.
This representation is based off the default date display format
determined by the locale's L{DateDisplay} instance. The date is
enclosed in quotes if the L{Date} is not a valid date.
@return: Returns a string representing the DateBase date
@rtype: str
"""
return displayer.quote_display(date_base.get_date_object())

View File

@ -220,7 +220,8 @@ class ChildModel(gtk.ListStore):
def column_birth_day(self,data): def column_birth_day(self,data):
event_ref = data.get_birth_ref() event_ref = data.get_birth_ref()
if event_ref and event_ref.ref: if event_ref and event_ref.ref:
return self.db.get_event_from_handle(event_ref.ref).get_date() event = self.db.get_event_from_handle(event_ref.ref)
return DateHandler.get_date(event)
else: else:
return u"" return u""
@ -235,7 +236,8 @@ class ChildModel(gtk.ListStore):
def column_death_day(self,data): def column_death_day(self,data):
event_ref = data.get_death_ref() event_ref = data.get_death_ref()
if event_ref and event_ref.ref: if event_ref and event_ref.ref:
return self.db.get_event_from_handle(event_ref.ref).get_date() event = self.db.get_event_from_handle(event_ref.ref)
return DateHandler.get_date(event)
else: else:
return u"" return u""

View File

@ -230,7 +230,6 @@ class EditPerson:
Utils.bold_label(self.gallery_label) Utils.bold_label(self.gallery_label)
# event display # event display
self.event_box = ListBox.EventListBox( self.event_box = ListBox.EventListBox(
self, self.person, self.event_ref_list, events_label, self, self.person, self.event_ref_list, events_label,
[event_add_btn,event_edit_btn,event_delete_btn,event_sel_btn]) [event_add_btn,event_edit_btn,event_delete_btn,event_sel_btn])
@ -491,7 +490,7 @@ class EditPerson:
stat = lds_ord.get_status() stat = lds_ord.get_status()
else: else:
stat = 0 stat = 0
date.set_text(lds_ord.get_date()) date.set_text(DateHandler.get_date(lds_ord))
build_dropdown(place,self.place_list) build_dropdown(place,self.place_list)
if lds_ord and lds_ord.get_place_handle(): if lds_ord and lds_ord.get_place_handle():

View File

@ -304,6 +304,7 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
if transaction.batch: if transaction.batch:
data_map[handle] = obj.serialize() data_map[handle] = obj.serialize()
old_data = None
else: else:
old_data = data_map.get(handle) old_data = data_map.get(handle)
transaction.add(key,handle,old_data) transaction.add(key,handle,old_data)
@ -313,14 +314,15 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
add_list.append((handle,obj.serialize())) add_list.append((handle,obj.serialize()))
# committing person, do gender stats here # committing person, do gender stats here
if old_data and key == PERSON_KEY: if key == PERSON_KEY:
old_person = Person(old_data) if old_data:
if (old_data[2] != person.gender or old_person = Person(old_data)
old_data[3].first_name != obj.primary_name.first_name): if (old_data[2] != person.gender or
self.genderStats.uncount_person(old_person) old_data[3].first_name != obj.primary_name.first_name):
self.genderStats.uncount_person(old_person)
self.genderStats.count_person(obj,self)
else:
self.genderStats.count_person(obj,self) self.genderStats.count_person(obj,self)
else:
self.genderStats.count_person(obj,self)
def commit_person(self,person,transaction,change_time=None): def commit_person(self,person,transaction,change_time=None):
""" """
@ -649,7 +651,7 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
obj.handle = self.create_id() obj.handle = self.create_id()
commit_func(obj,transaction) commit_func(obj,transaction)
if obj.__class__.__name__ == 'Person': if obj.__class__.__name__ == 'Person':
self.genderStats.count_person (person, self) self.genderStats.count_person (obj, self)
return obj.handle return obj.handle
def add_person(self,person,transaction): def add_person(self,person,transaction):

View File

@ -55,6 +55,7 @@ import EventEdit
import AddrEdit import AddrEdit
import NameDisplay import NameDisplay
import Utils import Utils
import DateHandler
class ListBox: class ListBox:
""" """
@ -433,7 +434,7 @@ class EventListBox(ReorderListBox):
role = ref_role[1] role = ref_role[1]
else: else:
role = self.role_dict[ref_role[0]] role = self.role_dict[ref_role[0]]
return [name, event.get_description(), event.get_date(), return [name, event.get_description(), DateHandler.get_date(event),
pname, role, has_source, has_note] pname, role, has_source, has_note]
class NameListBox(ReorderListBox): class NameListBox(ReorderListBox):
@ -563,7 +564,7 @@ class AddressListBox(ReorderListBox):
def display_data(self,item): def display_data(self,item):
has_note = item.get_note() has_note = item.get_note()
has_source = len(item.get_source_references())> 0 has_source = len(item.get_source_references())> 0
return [item.get_date(),item.get_street(), return [DateHandler.get_date(item),item.get_street(),
item.get_city(), item.get_state(), item.get_city(), item.get_state(),
item.get_country(), has_source,has_note] item.get_country(), has_source,has_note]
@ -585,7 +586,7 @@ class UrlListBox(ReorderListBox):
(_('Description'), NOSORT, 100, TEXT, None, self.set_description), (_('Description'), NOSORT, 100, TEXT, None, self.set_description),
] ]
self.data = person.get_url_list()[:] self.data = person.get_url_list()[:]
ReorderListBox.__init__(self, person, person, obj, label, ReorderListBox.__init__(self, parent, person, obj, label,
button_list, titles, DdTargets.URL) button_list, titles, DdTargets.URL)
def set_path(self,index,value): def set_path(self,index,value):

View File

@ -57,6 +57,7 @@ import GrampsKeys
import NameDisplay import NameDisplay
import Date import Date
import DateEdit import DateEdit
import DateHandler
from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog
from DdTargets import DdTargets from DdTargets import DdTargets
@ -235,7 +236,7 @@ class Marriage:
place = self.db.get_place_from_handle( place_handle) place = self.db.get_place_from_handle( place_handle)
if place: if place:
self.lds_place.child.set_text( place.get_title()) self.lds_place.child.set_text( place.get_title())
self.lds_date.set_text(lds_ord.get_date()) self.lds_date.set_text(DateHandler.get_date(lds_ord))
self.seal_stat = lds_ord.get_status() self.seal_stat = lds_ord.get_status()
self.lds_date_object = lds_ord.get_date_object() self.lds_date_object = lds_ord.get_date_object()
else: else:
@ -746,7 +747,7 @@ class Marriage:
return return
event = self.etree.get_object(node) event = self.etree.get_object(node)
self.date_field.set_text(event.get_date()) self.date_field.set_text(DateHandler.get_date(event))
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place_name = self.db.get_place_from_handle(place_handle).get_title() place_name = self.db.get_place_from_handle(place_handle).get_title()

View File

@ -46,6 +46,7 @@ import ReportUtils
import Utils import Utils
import NameDisplay import NameDisplay
import const import const
import DateHandler
sex = ( _("female"), _("male"), _("unknown")) sex = ( _("female"), _("male"), _("unknown"))
@ -189,7 +190,7 @@ class Compare:
place = "" place = ""
if handle: if handle:
event = self.db.get_event_from_handle(handle) event = self.db.get_event_from_handle(handle)
date = event.get_date() date = DateHandler.get_date(event)
place = self.place_name(event) place = self.place_name(event)
if date: if date:
if place: if place:

View File

@ -47,6 +47,7 @@ import Relationship
import NameDisplay import NameDisplay
import RelLib import RelLib
import Utils import Utils
import DateHandler
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -689,12 +690,12 @@ class PedigreeView:
event = self.db.get_event_from_handle(event_ref.ref) event = self.db.get_event_from_handle(event_ref.ref)
if event: if event:
if line_count < 3: if line_count < 3:
return event.get_date() return DateHandler.get_date(event)
i,s = event.get_type() i,s = event.get_type()
name = Utils.family_relations[i] name = Utils.family_relations[i]
text += name text += name
text += "\n" text += "\n"
text += event.get_date() text += DateHandler.get_date(event)
text += "\n" text += "\n"
text += self.get_place_name(event.get_place_handle()) text += self.get_place_name(event.get_place_handle())
if line_count < 5: if line_count < 5:
@ -725,14 +726,14 @@ class PedigreeView:
bp="" bp=""
if birth_ref: if birth_ref:
birth = self.db.get_event_from_handle(birth_ref.ref) birth = self.db.get_event_from_handle(birth_ref.ref)
bd = birth.get_date() bd = DateHandler.get_date(birth)
bp = self.get_place_name(birth.get_place_handle()) bp = self.get_place_name(birth.get_place_handle())
death_ref = person.get_death_ref() death_ref = person.get_death_ref()
dd="" dd=""
dp="" dp=""
if death_ref: if death_ref:
death = self.db.get_event_from_handle(death_ref.ref) death = self.db.get_event_from_handle(death_ref.ref)
dd = death.get_date() dd = DateHandler.get_date(death)
dp = self.get_place_name(death.get_place_handle()) dp = self.get_place_name(death.get_place_handle())
if line_count < 5: if line_count < 5:
return "%s\n* %s\n+ %s" % (name,bd,dd) return "%s\n* %s\n+ %s" % (name,bd,dd)
@ -790,7 +791,7 @@ def build_detail_string(db,person):
def format_event(db, label, event): def format_event(db, label, event):
if not event: if not event:
return u"" return u""
ed = event.get_date() ed = DateHandler.get_date(event)
ep = None ep = None
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:

View File

@ -47,6 +47,7 @@ import pango
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from RelLib import * from RelLib import *
import NameDisplay import NameDisplay
import DateHandler
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -307,30 +308,34 @@ class PeopleModel(gtk.GenericTreeModel):
def column_birth_day(self,data,node): def column_birth_day(self,data,node):
if data[_BIRTH_COL]: if data[_BIRTH_COL]:
birth = self.db.get_event_from_handle(data[_BIRTH_COL].ref) birth = self.db.get_event_from_handle(data[_BIRTH_COL].ref)
if birth.get_date() and birth.get_date() != "": date_str = DateHandler.get_date(birth)
return cgi.escape(birth.get_date()) if date_str != "":
return cgi.escape(date_str)
for event_ref in data[_EVENT_COL]: for event_ref in data[_EVENT_COL]:
event = self.db.get_event_from_handle(event_ref.ref) event = self.db.get_event_from_handle(event_ref.ref)
etype = event.get_type()[0] etype = event.get_type()[0]
date_str = DateHandler.get_date(event)
if (etype in [Event.BAPTISM, Event.CHRISTEN] if (etype in [Event.BAPTISM, Event.CHRISTEN]
and event.get_date() != ""): and date_str != ""):
return "<i>" + cgi.escape(event.get_date()) + "</i>" return "<i>" + cgi.escape(date_str) + "</i>"
return u"" return u""
def column_death_day(self,data,node): def column_death_day(self,data,node):
if data[_DEATH_COL]: if data[_DEATH_COL]:
death = self.db.get_event_from_handle(data[_DEATH_COL].ref) death = self.db.get_event_from_handle(data[_DEATH_COL].ref)
if death.get_date() and death.get_date() != "": date_str = DateHandler.get_date(death)
return cgi.escape(death.get_date()) if date_str != "":
return cgi.escape(date_str)
for event_ref in data[_EVENT_COL]: for event_ref in data[_EVENT_COL]:
event = self.db.get_event_from_handle(event_ref.ref) event = self.db.get_event_from_handle(event_ref.ref)
etype = event.get_type()[0] etype = event.get_type()[0]
date_str = DateHandler.get_date(event)
if (etype in [Event.BURIAL, Event.CREMATION] if (etype in [Event.BURIAL, Event.CREMATION]
and event.get_date() != ""): and date_str != ""):
return "<i>" + cgi.escape(event.get_date()) + "</i>" return "<i>" + cgi.escape(date_str) + "</i>"
return u"" return u""

View File

@ -43,7 +43,6 @@ from warnings import warn
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import Date import Date
import DateHandler
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -643,47 +642,47 @@ class DateBase:
else: else:
self.date = None self.date = None
def set_date(self, date) : # def set_date(self, date) :
""" # """
Sets the date of the DateBase instance. # Sets the date of the DateBase instance.
The date is parsed into a L{Date} instance. # The date is parsed into a L{Date} instance.
@param date: String representation of a date. The locale specific # @param date: String representation of a date. The locale specific
L{DateParser} is used to parse the string into a GRAMPS L{Date} # L{DateParser} is used to parse the string into a GRAMPS L{Date}
object. # object.
@type date: str # @type date: str
""" # """
self.date = DateHandler.parser.parse(date) # self.date = DateHandler.parser.parse(date)
def get_date(self) : # def get_date(self) :
""" # """
Returns a string representation of the date of the DateBase instance. # Returns a string representation of the date of the DateBase instance.
This representation is based off the default date display format # This representation is based off the default date display format
determined by the locale's L{DateDisplay} instance. # determined by the locale's L{DateDisplay} instance.
@return: Returns a string representing the DateBase date # @return: Returns a string representing the DateBase date
@rtype: str # @rtype: str
""" # """
if self.date: # if self.date:
return DateHandler.displayer.display(self.date) # return DateHandler.displayer.display(self.date)
return u"" # return u""
def get_quote_date(self) : # def get_quote_date(self) :
""" # """
Returns a string representation of the date of the DateBase instance. # Returns a string representation of the date of the DateBase instance.
This representation is based off the default date display format # This representation is based off the default date display format
determined by the locale's L{DateDisplay} instance. The date is # determined by the locale's L{DateDisplay} instance. The date is
enclosed in quotes if the L{Date} is not a valid date. # enclosed in quotes if the L{Date} is not a valid date.
@return: Returns a string representing the DateBase date # @return: Returns a string representing the DateBase date
@rtype: str # @rtype: str
""" # """
if self.date: # if self.date:
return DateHandler.displayer.quote_display(self.date) # return DateHandler.displayer.quote_display(self.date)
return u"" # return u""
def get_date_object(self): def get_date_object(self):
""" """
@ -2288,8 +2287,9 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
@return: Returns the list of all textual attributes of the object. @return: Returns the list of all textual attributes of the object.
@rtype: list @rtype: list
""" """
return [self.description,self.type[1],self.cause, return [self.description,self.type[1],self.cause,self.gramps_id]
self.get_date(),self.gramps_id] #return [self.description,self.type[1],self.cause,
# self.get_date(),self.gramps_id]
def get_text_data_child_list(self): def get_text_data_child_list(self):
""" """
@ -2812,7 +2812,8 @@ class MediaObject(PrimaryObject,SourceNote,DateBase,AttributeBase):
@return: Returns the list of all textual attributes of the object. @return: Returns the list of all textual attributes of the object.
@rtype: list @rtype: list
""" """
return [self.path,self.mime,self.desc,self.get_date(),self.gramps_id] return [self.path,self.mime,self.desc,self.gramps_id]
#return [self.path,self.mime,self.desc,self.get_date(),self.gramps_id]
def get_text_data_child_list(self): def get_text_data_child_list(self):
""" """
@ -3140,7 +3141,8 @@ class LdsOrd(SourceNote,DateBase,PlaceBase):
@return: Returns the list of all textual attributes of the object. @return: Returns the list of all textual attributes of the object.
@rtype: list @rtype: list
""" """
return [self.temple,self.get_date()] return [self.temple]
#return [self.temple,self.get_date()]
def get_text_data_child_list(self): def get_text_data_child_list(self):
""" """
@ -3648,7 +3650,9 @@ class Address(PrivateSourceNote,DateBase):
@rtype: list @rtype: list
""" """
return [self.street,self.city,self.state,self.country, return [self.street,self.city,self.state,self.country,
self.postal,self.phone,self.get_date()] self.postal,self.phone]
#return [self.street,self.city,self.state,self.country,
# self.postal,self.phone,self.get_date()]
def get_text_data_child_list(self): def get_text_data_child_list(self):
""" """
@ -3772,7 +3776,9 @@ class Name(PrivateSourceNote,DateBase):
@rtype: list @rtype: list
""" """
return [self.first_name,self.surname,self.suffix,self.title, return [self.first_name,self.surname,self.suffix,self.title,
self.type[1],self.prefix,self.patronymic,self.get_date()] self.type[1],self.prefix,self.patronymic]
#return [self.first_name,self.surname,self.suffix,self.title,
# self.type[1],self.prefix,self.patronymic,self.get_date()]
def get_text_data_child_list(self): def get_text_data_child_list(self):
""" """
@ -4135,7 +4141,8 @@ class SourceRef(BaseObject,DateBase,PrivacyBase,NoteBase):
@return: Returns the list of all textual attributes of the object. @return: Returns the list of all textual attributes of the object.
@rtype: list @rtype: list
""" """
return [self.page,self.text,self.get_date()] return [self.page,self.text]
#return [self.page,self.text,self.get_date()]
def get_text_data_child_list(self): def get_text_data_child_list(self):
""" """

View File

@ -30,6 +30,7 @@ import Date
import DateHandler import DateHandler
import RelLib import RelLib
from NameDisplay import displayer as _nd from NameDisplay import displayer as _nd
import DateHandler
import time import time
from gettext import gettext as _ from gettext import gettext as _
@ -443,7 +444,7 @@ def get_birth_death_strings(database,person,empty_date="",empty_place=""):
birth_handle = person.get_birth_handle() birth_handle = person.get_birth_handle()
if birth_handle: if birth_handle:
birth = database.get_event_from_handle(birth_handle) birth = database.get_event_from_handle(birth_handle)
bdate = birth.get_date() bdate = DateHandler.get_date(birth)
bplace_handle = birth.get_place_handle() bplace_handle = birth.get_place_handle()
if bplace_handle: if bplace_handle:
bplace = database.get_place_from_handle(bplace_handle).get_title() bplace = database.get_place_from_handle(bplace_handle).get_title()
@ -453,7 +454,7 @@ def get_birth_death_strings(database,person,empty_date="",empty_place=""):
death_handle = person.get_death_handle() death_handle = person.get_death_handle()
if death_handle: if death_handle:
death = database.get_event_from_handle(death_handle) death = database.get_event_from_handle(death_handle)
ddate = death.get_date() ddate = DateHandler.get_date(death)
dplace_handle = death.get_place_handle() dplace_handle = death.get_place_handle()
if dplace_handle: if dplace_handle:
dplace = database.get_place_from_handle(dplace_handle).get_title() dplace = database.get_place_from_handle(dplace_handle).get_title()
@ -808,7 +809,7 @@ def married_str(database,person,spouse,event,endnotes=None,
place = empty_place place = empty_place
spouse_name = _nd.display(spouse) spouse_name = _nd.display(spouse)
mdate = event.get_date() mdate = DateHandler.get_date(event)
if mdate: if mdate:
date = mdate date = mdate
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
@ -1462,7 +1463,7 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""):
break break
if burial: if burial:
bdate = burial.get_date() bdate = DateHandler.get_date(burial)
bplace_handle = burial.get_place_handle() bplace_handle = burial.get_place_handle()
if bplace_handle: if bplace_handle:
bplace = database.get_place_from_handle(bplace_handle).get_title() bplace = database.get_place_from_handle(bplace_handle).get_title()

View File

@ -45,6 +45,7 @@ import const
import Utils import Utils
import ListModel import ListModel
import RelLib import RelLib
import DateHandler
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -95,7 +96,7 @@ class SelectEvent:
pname = self.db.get_place_from_handle(place_handle).get_title() pname = self.db.get_place_from_handle(place_handle).get_title()
else: else:
pname = u'' pname = u''
date = event.get_date() date = DateHandler.get_date(event)
cause = event.get_cause() cause = event.get_cause()
self.model.add([desc,the_id,name,date,pname,cause],handle) self.model.add([desc,the_id,name,date,pname,cause],handle)

View File

@ -42,6 +42,7 @@ __version__ = "$Revision$"
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import NameDisplay import NameDisplay
import DateHandler
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -84,14 +85,14 @@ class SubstKeywords:
birth_handle = person.get_birth_handle() birth_handle = person.get_birth_handle()
if birth_handle: if birth_handle:
birth = database.get_event_from_handle(birth_handle) birth = database.get_event_from_handle(birth_handle)
self.b = birth.get_date() self.b = DateHandler.get_date(birth)
bplace_handle = birth.get_place_handle() bplace_handle = birth.get_place_handle()
if bplace_handle: if bplace_handle:
self.B = database.get_place_from_handle(bplace_handle).get_title() self.B = database.get_place_from_handle(bplace_handle).get_title()
death_handle = person.get_death_handle() death_handle = person.get_death_handle()
if death_handle: if death_handle:
death = database.get_event_from_handle(death_handle) death = database.get_event_from_handle(death_handle)
self.d = death.get_date() self.d = DateHandler.get_date(death)
dplace_handle = death.get_place_handle() dplace_handle = death.get_place_handle()
if dplace_handle: if dplace_handle:
self.D = database.get_place_from_handle(dplace_handle).get_title() self.D = database.get_place_from_handle(dplace_handle).get_title()
@ -117,7 +118,7 @@ class SubstKeywords:
continue continue
e = database.get_event_from_handle(e_id) e = database.get_event_from_handle(e_id)
if e.get_name() == 'Marriage': if e.get_name() == 'Marriage':
self.m = e.get_date() self.m = DateHandler.get_date(e)
mplace_handle = e.get_place_handle() mplace_handle = e.get_place_handle()
if mplace_handle: if mplace_handle:
self.M = database.get_place_from_handle(mplace_handle).get_title() self.M = database.get_place_from_handle(mplace_handle).get_title()

View File

@ -51,6 +51,7 @@ import Utils
import BaseDoc import BaseDoc
import OpenSpreadSheet import OpenSpreadSheet
import const import const
import DateHandler
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -323,7 +324,7 @@ class DisplayChart:
bplace = "" bplace = ""
if birth_handle: if birth_handle:
birth = self.db.get_event_from_handle(birth_handle) birth = self.db.get_event_from_handle(birth_handle)
bdate = birth.get_date() bdate = DateHandler.get_date(birth)
bplace_handle = birth.get_place_handle() bplace_handle = birth.get_place_handle()
if bplace_handle: if bplace_handle:
bplace = self.db.get_place_from_handle(bplace_handle).get_title() bplace = self.db.get_place_from_handle(bplace_handle).get_title()
@ -332,7 +333,7 @@ class DisplayChart:
dplace = "" dplace = ""
if death_handle: if death_handle:
death = self.db.get_event_from_handle(death_handle) death = self.db.get_event_from_handle(death_handle)
ddate = death.get_date() ddate = DateHandler.get_date(death)
dplace_handle = death.get_place_handle() dplace_handle = death.get_place_handle()
if dplace_handle: if dplace_handle:
dplace = self.db.get_place_from_handle(dplace_handle).get_title() dplace = self.db.get_place_from_handle(dplace_handle).get_title()
@ -365,7 +366,7 @@ class DisplayChart:
place = "" place = ""
if event_handle: if event_handle:
event = self.db.get_event_from_handle(event_handle) event = self.db.get_event_from_handle(event_handle)
date = event.get_date() date = DateHandler.get_date(event)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place = self.db.get_place_from_handle(place_handle).get_title() place = self.db.get_place_from_handle(place_handle).get_title()

View File

@ -46,7 +46,7 @@ import Report
import BaseDoc import BaseDoc
import ReportOptions import ReportOptions
import const import const
from DateHandler import displayer as _dd import DateHandler
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -179,7 +179,7 @@ class FamilyGroup(Report.Report):
bplace = "" bplace = ""
if birth_handle: if birth_handle:
birth = self.database.get_event_from_handle(birth_handle) birth = self.database.get_event_from_handle(birth_handle)
bdate = birth.get_date() bdate = DateHandler.get_date(birth)
bplace_handle = birth.get_place_handle() bplace_handle = birth.get_place_handle()
if bplace_handle: if bplace_handle:
bplace = self.database.get_place_from_handle(bplace_handle).get_title() bplace = self.database.get_place_from_handle(bplace_handle).get_title()
@ -189,7 +189,7 @@ class FamilyGroup(Report.Report):
dplace = "" dplace = ""
if death_handle: if death_handle:
death = self.database.get_event_from_handle(death_handle) death = self.database.get_event_from_handle(death_handle)
ddate = death.get_date() ddate = DateHandler.get_date(death)
dplace_handle = death.get_place_handle() dplace_handle = death.get_place_handle()
if dplace_handle: if dplace_handle:
dplace = self.database.get_place_from_handle(dplace_handle).get_title() dplace = self.database.get_place_from_handle(dplace_handle).get_title()
@ -274,7 +274,7 @@ class FamilyGroup(Report.Report):
date = "" date = ""
place = "" place = ""
if event: if event:
date = event.get_date() date = DateHandler.get_date(event)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place = self.database.get_place_from_handle(place_handle).get_title() place = self.database.get_place_from_handle(place_handle).get_title()

View File

@ -38,7 +38,7 @@ import Report
import BaseDoc import BaseDoc
import RelLib import RelLib
import ReportOptions import ReportOptions
from DateHandler import displayer as dd import DateHandler
import const import const
import ReportUtils import ReportUtils
@ -152,8 +152,9 @@ class FtmAncestorReport(Report.Report):
self.doc.start_paragraph('FTA-Endnotes',"%d." % key) self.doc.start_paragraph('FTA-Endnotes',"%d." % key)
self.doc.write_text(base.get_title()) self.doc.write_text(base.get_title())
for item in [ base.get_author(), base.get_publication_info(), base.get_abbreviation(), for item in [ base.get_author(), base.get_publication_info(),
dd.display(srcref.get_date_object()),]: base.get_abbreviation(),
DateHandler.get_date(srcref),]:
if item: if item:
self.doc.write_text('; %s' % item) self.doc.write_text('; %s' % item)
@ -233,7 +234,7 @@ class FtmAncestorReport(Report.Report):
for event_handle in person.get_event_list(): for event_handle in person.get_event_list():
event = self.database.get_event_from_handle(event_handle) event = self.database.get_event_from_handle(event_handle)
date = event.get_date() date = DateHandler.get_date(event)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place = self.database.get_place_from_handle(place_handle).get_title() place = self.database.get_place_from_handle(place_handle).get_title()
@ -294,7 +295,7 @@ class FtmAncestorReport(Report.Report):
else: else:
return return
date = event.get_date() date = DateHandler.get_date(event)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place = self.database.get_place_from_handle(place_handle).get_title() place = self.database.get_place_from_handle(place_handle).get_title()

View File

@ -42,7 +42,7 @@ import BaseDoc
import RelLib import RelLib
import ReportUtils import ReportUtils
import ReportOptions import ReportOptions
from DateHandler import displayer as dd import DateHandler
import const import const
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -182,8 +182,9 @@ class FtmDescendantReport(Report.Report):
self.doc.start_paragraph('FTD-Endnotes',"%d." % key) self.doc.start_paragraph('FTD-Endnotes',"%d." % key)
self.doc.write_text(base.get_title()) self.doc.write_text(base.get_title())
for item in [ base.get_author(), base.get_publication_info(), base.get_abbreviation(), for item in [ base.get_author(), base.get_publication_info(),
dd.display(srcref.get_date_object()),]: base.get_abbreviation(),
DateHandler.get_date(srcref),]:
if item: if item:
self.doc.write_text('; %s' % item) self.doc.write_text('; %s' % item)
@ -267,7 +268,7 @@ class FtmDescendantReport(Report.Report):
if not event_handle: if not event_handle:
continue continue
event = self.database.get_event_from_handle(event_handle) event = self.database.get_event_from_handle(event_handle)
date = event.get_date() date = DateHandler.get_date(event)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place = self.database.get_place_from_handle(place_handle) place = self.database.get_place_from_handle(place_handle)
@ -323,7 +324,7 @@ class FtmDescendantReport(Report.Report):
if not event_handle: if not event_handle:
continue continue
event = self.database.get_event_from_handle(event_handle) event = self.database.get_event_from_handle(event_handle)
date = event.get_date() date = DateHandler.get_date(event)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place = self.database.get_place_from_handle(place_handle) place = self.database.get_place_from_handle(place_handle)

View File

@ -49,6 +49,7 @@ import ReportOptions
import GenericFilter import GenericFilter
import const import const
import RelLib import RelLib
import DateHandler
from BaseDoc import PAPER_LANDSCAPE from BaseDoc import PAPER_LANDSCAPE
from latin_utf8 import utf8_to_latin from latin_utf8 import utf8_to_latin
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
@ -370,7 +371,7 @@ class GraphViz:
if self.just_years: if self.just_years:
return '%i' % event.get_date_object().get_year() return '%i' % event.get_date_object().get_year()
else: else:
return event.get_date() return DateHandler.get_date(event)
elif self.placecause: elif self.placecause:
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
place = self.database.get_place_from_handle(place_handle) place = self.database.get_place_from_handle(place_handle)

View File

@ -46,6 +46,7 @@ import BaseDoc
import Report import Report
import GenericFilter import GenericFilter
import ReportOptions import ReportOptions
import DateHandler
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -113,7 +114,7 @@ class IndivCompleteReport(Report.Report):
if event == None: if event == None:
return return
name = _(event.get_name()) name = _(event.get_name())
date = event.get_date() date = DateHandler.get_date(event)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place = self.database.get_place_from_handle(place_handle).get_title() place = self.database.get_place_from_handle(place_handle).get_title()

View File

@ -47,6 +47,7 @@ import const
import BaseDoc import BaseDoc
import Report import Report
import ReportOptions import ReportOptions
import DateHandler
import const import const
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -94,7 +95,7 @@ class IndivSummary(Report.Report):
if event == None: if event == None:
return return
name = const.display_event(event.get_name()) name = const.display_event(event.get_name())
date = event.get_date() date = DateHandler.get_date(event)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
place_obj = self.database.get_place_from_handle(place_handle) place_obj = self.database.get_place_from_handle(place_handle)

View File

@ -47,6 +47,7 @@ import Utils
import NameDisplay import NameDisplay
import ListModel import ListModel
import PluginMgr import PluginMgr
import DateHandler
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -103,7 +104,7 @@ class RelCalc:
continue continue
bh = p.get_birth_handle() bh = p.get_birth_handle()
if bh: if bh:
bdate = self.db.get_event_from_handle(bh).get_date() bdate = DateHandler.get_date(self.db.get_event_from_handle(bh))
else: else:
bdate = "" bdate = ""
name = p.get_primary_name() name = p.get_primary_name()

View File

@ -47,6 +47,7 @@ from gnome import help_display
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import TreeTips import TreeTips
import DateHandler
from DdTargets import DdTargets from DdTargets import DdTargets
@ -136,7 +137,7 @@ class ScratchPadAddress(ScratchPadGrampsTypeWrapper):
def __init__(self,model,obj): def __init__(self,model,obj):
ScratchPadGrampsTypeWrapper.__init__(self,model,obj) ScratchPadGrampsTypeWrapper.__init__(self,model,obj)
self._type = _("Address") self._type = _("Address")
self._title = self._obj.get_date() self._title = DateHandler.get_date(self._obj)
self._value = "%s %s %s %s" % (self._obj.get_street(),self._obj.get_city(), self._value = "%s %s %s %s" % (self._obj.get_street(),self._obj.get_city(),
self._obj.get_state(),self._obj.get_country()) self._obj.get_state(),self._obj.get_country())
@ -153,7 +154,7 @@ class ScratchPadAddress(ScratchPadGrampsTypeWrapper):
"\t\t%s\n"\ "\t\t%s\n"\
"\t<b>%s:</b>\t%s\n" % ( "\t<b>%s:</b>\t%s\n" % (
_("Address"), _("Address"),
_("Date"), escape(self._obj.get_date()), _("Date"), escape(DateHandler.get_date(self._obj)),
_("Location"), _("Location"),
escape(self._obj.get_street()), escape(self._obj.get_street()),
escape(self._obj.get_city()), escape(self._obj.get_city()),
@ -197,7 +198,7 @@ class ScratchPadEvent(ScratchPadGrampsTypeWrapper):
"\t<b>%s:</b>\t%s\n" % ( "\t<b>%s:</b>\t%s\n" % (
_("Event"), _("Event"),
_("Type"),escape(const.display_pevent(self._obj.get_name())), _("Type"),escape(const.display_pevent(self._obj.get_name())),
_("Date"),escape(self._obj.get_date()), _("Date"),escape(DateHander.get_date(self._obj)),
_("Place"),escape(place_title(self._db,self._obj)), _("Place"),escape(place_title(self._db,self._obj)),
_("Cause"),escape(self._obj.get_cause()), _("Cause"),escape(self._obj.get_cause()),
_("Description"), escape(self._obj.get_description())) _("Description"), escape(self._obj.get_description()))
@ -239,7 +240,7 @@ class ScratchPadFamilyEvent(ScratchPadGrampsTypeWrapper):
"\t<b>%s:</b>\t%s\n" % ( "\t<b>%s:</b>\t%s\n" % (
_("Family Event"), _("Family Event"),
_("Type"),escape(const.display_fevent(self._obj.get_name())), _("Type"),escape(const.display_fevent(self._obj.get_name())),
_("Date"),escape(self._obj.get_date()), _("Date"),escape(DateHander.get_date(self._obj)),
_("Place"),escape(place_title(self.db,self._obj)), _("Place"),escape(place_title(self.db,self._obj)),
_("Cause"),escape(self._obj.get_cause()), _("Cause"),escape(self._obj.get_cause()),
_("Description"), escape(self._obj.get_description())) _("Description"), escape(self._obj.get_description()))
@ -465,8 +466,9 @@ class ScratchPersonLink(ScratchPadWrapper):
birth_handle = person.get_birth_handle() birth_handle = person.get_birth_handle()
if birth_handle: if birth_handle:
birth = self._db.get_event_from_handle(birth_handle) birth = self._db.get_event_from_handle(birth_handle)
if birth.get_date() and birth.get_date() != "": date_str = DateHandler.get_date(birth)
self._value = escape(birth.get_date()) if date_str != "":
self._value = escape(date_str)
def tooltip(self): def tooltip(self):

View File

@ -58,7 +58,7 @@ import Report
import ReportUtils import ReportUtils
import ReportOptions import ReportOptions
import GenericFilter import GenericFilter
from DateHandler import displayer as _dd import DateHandler
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -190,7 +190,7 @@ class Extract:
if date: if date:
month = date.get_month() month = date.get_month()
if month: if month:
return [_dd._months[month]] return [DateHandler.displayer._months[month]]
return [_("Date(s) missing")] return [_("Date(s) missing")]
def get_cause(self, event): def get_cause(self, event):

View File

@ -47,6 +47,7 @@ import Utils
import RelLib import RelLib
import const import const
import Report import Report
import DateHandler
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -95,7 +96,7 @@ def build_report(database,person):
birth_handle = person.get_birth_handle() birth_handle = person.get_birth_handle()
if birth_handle: if birth_handle:
birth = database.get_event_from_handle(birth_handle) birth = database.get_event_from_handle(birth_handle)
if not birth.get_date(): if not DateHandler.get_date(birth):
missing_bday = missing_bday + 1 missing_bday = missing_bday + 1
else: else:
missing_bday = missing_bday + 1 missing_bday = missing_bday + 1