From f1b3c2c39fa840b2135f9d51f2b82e056fe83fff Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 6 Aug 2005 02:57:37 +0000 Subject: [PATCH] * various: remove set_date/get_date removal to be replaced by DateHandler calls svn: r5031 --- ChangeLog | 4 ++ src/AddrEdit.py | 3 +- src/DateHandler.py | 43 +++++++++++++++ src/DisplayModels.py | 6 +- src/EditPerson.py | 3 +- src/GrampsDbBase.py | 18 +++--- src/ListBox.py | 7 ++- src/Marriage.py | 5 +- src/MergePeople.py | 3 +- src/PedView.py | 11 ++-- src/PeopleModel.py | 21 ++++--- src/RelLib.py | 89 ++++++++++++++++-------------- src/ReportUtils.py | 9 +-- src/SelectEvent.py | 3 +- src/SubstKeywords.py | 7 ++- src/plugins/EventCmp.py | 7 ++- src/plugins/FamilyGroup.py | 8 +-- src/plugins/FtmStyleAncestors.py | 11 ++-- src/plugins/FtmStyleDescendants.py | 11 ++-- src/plugins/GraphViz.py | 3 +- src/plugins/IndivComplete.py | 3 +- src/plugins/IndivSummary.py | 3 +- src/plugins/RelCalc.py | 3 +- src/plugins/ScratchPad.py | 14 +++-- src/plugins/StatisticsChart.py | 4 +- src/plugins/Summary.py | 3 +- 26 files changed, 191 insertions(+), 111 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b4714bff..eb3b4e384 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-08-05 Don Allingham + * various: remove set_date/get_date removal to be replaced by + DateHandler calls + 2005-07-08 Alex Roitman * various: merge changes made in gramps20 branch with main trunk. diff --git a/src/AddrEdit.py b/src/AddrEdit.py index 55c83e497..69378a643 100644 --- a/src/AddrEdit.py +++ b/src/AddrEdit.py @@ -51,6 +51,7 @@ import Date import RelLib import Sources import DateEdit +import DateHandler #------------------------------------------------------------------------- # @@ -109,7 +110,7 @@ class AddressEditor: if self.addr: self.srcreflist = self.addr.get_source_references() 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.city.set_text(self.addr.get_city()) self.state.set_text(self.addr.get_state()) diff --git a/src/DateHandler.py b/src/DateHandler.py index 3eb14b05f..be366314d 100644 --- a/src/DateHandler.py +++ b/src/DateHandler.py @@ -143,3 +143,46 @@ except: print "Date displayer for",_lang,"not available, using default" 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()) diff --git a/src/DisplayModels.py b/src/DisplayModels.py index 131224773..0ce0ebfd9 100644 --- a/src/DisplayModels.py +++ b/src/DisplayModels.py @@ -220,7 +220,8 @@ class ChildModel(gtk.ListStore): def column_birth_day(self,data): event_ref = data.get_birth_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: return u"" @@ -235,7 +236,8 @@ class ChildModel(gtk.ListStore): def column_death_day(self,data): event_ref = data.get_death_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: return u"" diff --git a/src/EditPerson.py b/src/EditPerson.py index 600f79fb9..facd82102 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -230,7 +230,6 @@ class EditPerson: Utils.bold_label(self.gallery_label) # event display - self.event_box = ListBox.EventListBox( self, self.person, self.event_ref_list, events_label, [event_add_btn,event_edit_btn,event_delete_btn,event_sel_btn]) @@ -491,7 +490,7 @@ class EditPerson: stat = lds_ord.get_status() else: stat = 0 - date.set_text(lds_ord.get_date()) + date.set_text(DateHandler.get_date(lds_ord)) build_dropdown(place,self.place_list) if lds_ord and lds_ord.get_place_handle(): diff --git a/src/GrampsDbBase.py b/src/GrampsDbBase.py index 2b730fad7..d2e329cff 100644 --- a/src/GrampsDbBase.py +++ b/src/GrampsDbBase.py @@ -304,6 +304,7 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): if transaction.batch: data_map[handle] = obj.serialize() + old_data = None else: old_data = data_map.get(handle) transaction.add(key,handle,old_data) @@ -313,14 +314,15 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): add_list.append((handle,obj.serialize())) # committing person, do gender stats here - if old_data and key == PERSON_KEY: - old_person = Person(old_data) - if (old_data[2] != person.gender or - old_data[3].first_name != obj.primary_name.first_name): - self.genderStats.uncount_person(old_person) + if key == PERSON_KEY: + if old_data: + old_person = Person(old_data) + if (old_data[2] != person.gender or + 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) - else: - self.genderStats.count_person(obj,self) def commit_person(self,person,transaction,change_time=None): """ @@ -649,7 +651,7 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): obj.handle = self.create_id() commit_func(obj,transaction) if obj.__class__.__name__ == 'Person': - self.genderStats.count_person (person, self) + self.genderStats.count_person (obj, self) return obj.handle def add_person(self,person,transaction): diff --git a/src/ListBox.py b/src/ListBox.py index 42b33d497..b7f32950e 100644 --- a/src/ListBox.py +++ b/src/ListBox.py @@ -55,6 +55,7 @@ import EventEdit import AddrEdit import NameDisplay import Utils +import DateHandler class ListBox: """ @@ -433,7 +434,7 @@ class EventListBox(ReorderListBox): role = ref_role[1] else: 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] class NameListBox(ReorderListBox): @@ -563,7 +564,7 @@ class AddressListBox(ReorderListBox): def display_data(self,item): has_note = item.get_note() 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_country(), has_source,has_note] @@ -585,7 +586,7 @@ class UrlListBox(ReorderListBox): (_('Description'), NOSORT, 100, TEXT, None, self.set_description), ] 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) def set_path(self,index,value): diff --git a/src/Marriage.py b/src/Marriage.py index fedb5401f..2f3cd2b24 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -57,6 +57,7 @@ import GrampsKeys import NameDisplay import Date import DateEdit +import DateHandler from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog from DdTargets import DdTargets @@ -235,7 +236,7 @@ class Marriage: place = self.db.get_place_from_handle( place_handle) if place: 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.lds_date_object = lds_ord.get_date_object() else: @@ -746,7 +747,7 @@ class Marriage: return 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() if place_handle: place_name = self.db.get_place_from_handle(place_handle).get_title() diff --git a/src/MergePeople.py b/src/MergePeople.py index bad53da47..7113bd5c0 100644 --- a/src/MergePeople.py +++ b/src/MergePeople.py @@ -46,6 +46,7 @@ import ReportUtils import Utils import NameDisplay import const +import DateHandler sex = ( _("female"), _("male"), _("unknown")) @@ -189,7 +190,7 @@ class Compare: place = "" if handle: event = self.db.get_event_from_handle(handle) - date = event.get_date() + date = DateHandler.get_date(event) place = self.place_name(event) if date: if place: diff --git a/src/PedView.py b/src/PedView.py index 76b6c9a62..d2e185d31 100644 --- a/src/PedView.py +++ b/src/PedView.py @@ -47,6 +47,7 @@ import Relationship import NameDisplay import RelLib import Utils +import DateHandler #------------------------------------------------------------------------- # @@ -689,12 +690,12 @@ class PedigreeView: event = self.db.get_event_from_handle(event_ref.ref) if event: if line_count < 3: - return event.get_date() + return DateHandler.get_date(event) i,s = event.get_type() name = Utils.family_relations[i] text += name text += "\n" - text += event.get_date() + text += DateHandler.get_date(event) text += "\n" text += self.get_place_name(event.get_place_handle()) if line_count < 5: @@ -725,14 +726,14 @@ class PedigreeView: bp="" if birth_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()) death_ref = person.get_death_ref() dd="" dp="" if death_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()) if line_count < 5: 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): if not event: return u"" - ed = event.get_date() + ed = DateHandler.get_date(event) ep = None place_handle = event.get_place_handle() if place_handle: diff --git a/src/PeopleModel.py b/src/PeopleModel.py index 1ecae22d4..deee7e38d 100644 --- a/src/PeopleModel.py +++ b/src/PeopleModel.py @@ -47,6 +47,7 @@ import pango #------------------------------------------------------------------------- from RelLib import * import NameDisplay +import DateHandler #------------------------------------------------------------------------- # @@ -307,30 +308,34 @@ class PeopleModel(gtk.GenericTreeModel): def column_birth_day(self,data,node): if data[_BIRTH_COL]: birth = self.db.get_event_from_handle(data[_BIRTH_COL].ref) - if birth.get_date() and birth.get_date() != "": - return cgi.escape(birth.get_date()) + date_str = DateHandler.get_date(birth) + if date_str != "": + return cgi.escape(date_str) for event_ref in data[_EVENT_COL]: event = self.db.get_event_from_handle(event_ref.ref) etype = event.get_type()[0] + date_str = DateHandler.get_date(event) if (etype in [Event.BAPTISM, Event.CHRISTEN] - and event.get_date() != ""): - return "" + cgi.escape(event.get_date()) + "" + and date_str != ""): + return "" + cgi.escape(date_str) + "" return u"" def column_death_day(self,data,node): if data[_DEATH_COL]: death = self.db.get_event_from_handle(data[_DEATH_COL].ref) - if death.get_date() and death.get_date() != "": - return cgi.escape(death.get_date()) + date_str = DateHandler.get_date(death) + if date_str != "": + return cgi.escape(date_str) for event_ref in data[_EVENT_COL]: event = self.db.get_event_from_handle(event_ref.ref) etype = event.get_type()[0] + date_str = DateHandler.get_date(event) if (etype in [Event.BURIAL, Event.CREMATION] - and event.get_date() != ""): - return "" + cgi.escape(event.get_date()) + "" + and date_str != ""): + return "" + cgi.escape(date_str) + "" return u"" diff --git a/src/RelLib.py b/src/RelLib.py index f3c6b525a..a5bf793fa 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -43,7 +43,6 @@ from warnings import warn # #------------------------------------------------------------------------- import Date -import DateHandler #------------------------------------------------------------------------- # @@ -643,47 +642,47 @@ class DateBase: else: self.date = None - def set_date(self, date) : - """ - Sets the date of the DateBase instance. +# def set_date(self, date) : +# """ +# 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 - L{DateParser} is used to parse the string into a GRAMPS L{Date} - object. - @type date: str - """ - self.date = DateHandler.parser.parse(date) +# @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 +# """ +# self.date = DateHandler.parser.parse(date) - def get_date(self) : - """ - Returns a string representation of the date of the DateBase instance. +# def get_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. +# 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 - """ - if self.date: - return DateHandler.displayer.display(self.date) - return u"" +# @return: Returns a string representing the DateBase date +# @rtype: str +# """ +# if self.date: +# return DateHandler.displayer.display(self.date) +# return u"" - def get_quote_date(self) : - """ - Returns a string representation of the date of the DateBase instance. +# 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. +# 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 - """ - if self.date: - return DateHandler.displayer.quote_display(self.date) - return u"" +# @return: Returns a string representing the DateBase date +# @rtype: str +# """ +# if self.date: +# return DateHandler.displayer.quote_display(self.date) +# return u"" 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. @rtype: list """ - return [self.description,self.type[1],self.cause, - self.get_date(),self.gramps_id] + return [self.description,self.type[1],self.cause,self.gramps_id] + #return [self.description,self.type[1],self.cause, + # self.get_date(),self.gramps_id] 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. @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): """ @@ -3140,7 +3141,8 @@ class LdsOrd(SourceNote,DateBase,PlaceBase): @return: Returns the list of all textual attributes of the object. @rtype: list """ - return [self.temple,self.get_date()] + return [self.temple] + #return [self.temple,self.get_date()] def get_text_data_child_list(self): """ @@ -3648,7 +3650,9 @@ class Address(PrivateSourceNote,DateBase): @rtype: list """ 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): """ @@ -3772,7 +3776,9 @@ class Name(PrivateSourceNote,DateBase): @rtype: list """ 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): """ @@ -4135,7 +4141,8 @@ class SourceRef(BaseObject,DateBase,PrivacyBase,NoteBase): @return: Returns the list of all textual attributes of the object. @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): """ diff --git a/src/ReportUtils.py b/src/ReportUtils.py index 965421a8c..ee5f20749 100644 --- a/src/ReportUtils.py +++ b/src/ReportUtils.py @@ -30,6 +30,7 @@ import Date import DateHandler import RelLib from NameDisplay import displayer as _nd +import DateHandler import time 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() if 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() if bplace_handle: 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() if 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() if dplace_handle: 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 spouse_name = _nd.display(spouse) - mdate = event.get_date() + mdate = DateHandler.get_date(event) if mdate: date = mdate place_handle = event.get_place_handle() @@ -1462,7 +1463,7 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""): break if burial: - bdate = burial.get_date() + bdate = DateHandler.get_date(burial) bplace_handle = burial.get_place_handle() if bplace_handle: bplace = database.get_place_from_handle(bplace_handle).get_title() diff --git a/src/SelectEvent.py b/src/SelectEvent.py index 0a0635bf8..425a39f9c 100644 --- a/src/SelectEvent.py +++ b/src/SelectEvent.py @@ -45,6 +45,7 @@ import const import Utils import ListModel import RelLib +import DateHandler #------------------------------------------------------------------------- # @@ -95,7 +96,7 @@ class SelectEvent: pname = self.db.get_place_from_handle(place_handle).get_title() else: pname = u'' - date = event.get_date() + date = DateHandler.get_date(event) cause = event.get_cause() self.model.add([desc,the_id,name,date,pname,cause],handle) diff --git a/src/SubstKeywords.py b/src/SubstKeywords.py index 12650998b..83cc921da 100644 --- a/src/SubstKeywords.py +++ b/src/SubstKeywords.py @@ -42,6 +42,7 @@ __version__ = "$Revision$" #------------------------------------------------------------------------ import NameDisplay +import DateHandler #------------------------------------------------------------------------ # @@ -84,14 +85,14 @@ class SubstKeywords: birth_handle = person.get_birth_handle() if 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() if bplace_handle: self.B = database.get_place_from_handle(bplace_handle).get_title() death_handle = person.get_death_handle() if 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() if dplace_handle: self.D = database.get_place_from_handle(dplace_handle).get_title() @@ -117,7 +118,7 @@ class SubstKeywords: continue e = database.get_event_from_handle(e_id) if e.get_name() == 'Marriage': - self.m = e.get_date() + self.m = DateHandler.get_date(e) mplace_handle = e.get_place_handle() if mplace_handle: self.M = database.get_place_from_handle(mplace_handle).get_title() diff --git a/src/plugins/EventCmp.py b/src/plugins/EventCmp.py index eed1e2854..6ce56d581 100644 --- a/src/plugins/EventCmp.py +++ b/src/plugins/EventCmp.py @@ -51,6 +51,7 @@ import Utils import BaseDoc import OpenSpreadSheet import const +import DateHandler from QuestionDialog import WarningDialog #------------------------------------------------------------------------ @@ -323,7 +324,7 @@ class DisplayChart: bplace = "" if 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() if bplace_handle: bplace = self.db.get_place_from_handle(bplace_handle).get_title() @@ -332,7 +333,7 @@ class DisplayChart: dplace = "" if 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() if dplace_handle: dplace = self.db.get_place_from_handle(dplace_handle).get_title() @@ -365,7 +366,7 @@ class DisplayChart: place = "" if 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() if place_handle: place = self.db.get_place_from_handle(place_handle).get_title() diff --git a/src/plugins/FamilyGroup.py b/src/plugins/FamilyGroup.py index ff8010442..6dcc58994 100644 --- a/src/plugins/FamilyGroup.py +++ b/src/plugins/FamilyGroup.py @@ -46,7 +46,7 @@ import Report import BaseDoc import ReportOptions import const -from DateHandler import displayer as _dd +import DateHandler #------------------------------------------------------------------------ # @@ -179,7 +179,7 @@ class FamilyGroup(Report.Report): bplace = "" if 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() if bplace_handle: bplace = self.database.get_place_from_handle(bplace_handle).get_title() @@ -189,7 +189,7 @@ class FamilyGroup(Report.Report): dplace = "" if 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() if dplace_handle: dplace = self.database.get_place_from_handle(dplace_handle).get_title() @@ -274,7 +274,7 @@ class FamilyGroup(Report.Report): date = "" place = "" if event: - date = event.get_date() + date = DateHandler.get_date(event) place_handle = event.get_place_handle() if place_handle: place = self.database.get_place_from_handle(place_handle).get_title() diff --git a/src/plugins/FtmStyleAncestors.py b/src/plugins/FtmStyleAncestors.py index ef2583c65..0efa9dfd3 100644 --- a/src/plugins/FtmStyleAncestors.py +++ b/src/plugins/FtmStyleAncestors.py @@ -38,7 +38,7 @@ import Report import BaseDoc import RelLib import ReportOptions -from DateHandler import displayer as dd +import DateHandler import const import ReportUtils @@ -152,8 +152,9 @@ class FtmAncestorReport(Report.Report): self.doc.start_paragraph('FTA-Endnotes',"%d." % key) self.doc.write_text(base.get_title()) - for item in [ base.get_author(), base.get_publication_info(), base.get_abbreviation(), - dd.display(srcref.get_date_object()),]: + for item in [ base.get_author(), base.get_publication_info(), + base.get_abbreviation(), + DateHandler.get_date(srcref),]: if item: self.doc.write_text('; %s' % item) @@ -233,7 +234,7 @@ class FtmAncestorReport(Report.Report): for event_handle in person.get_event_list(): event = self.database.get_event_from_handle(event_handle) - date = event.get_date() + date = DateHandler.get_date(event) place_handle = event.get_place_handle() if place_handle: place = self.database.get_place_from_handle(place_handle).get_title() @@ -294,7 +295,7 @@ class FtmAncestorReport(Report.Report): else: return - date = event.get_date() + date = DateHandler.get_date(event) place_handle = event.get_place_handle() if place_handle: place = self.database.get_place_from_handle(place_handle).get_title() diff --git a/src/plugins/FtmStyleDescendants.py b/src/plugins/FtmStyleDescendants.py index 88b9af578..bc7072bcf 100644 --- a/src/plugins/FtmStyleDescendants.py +++ b/src/plugins/FtmStyleDescendants.py @@ -42,7 +42,7 @@ import BaseDoc import RelLib import ReportUtils import ReportOptions -from DateHandler import displayer as dd +import DateHandler import const #------------------------------------------------------------------------ @@ -182,8 +182,9 @@ class FtmDescendantReport(Report.Report): self.doc.start_paragraph('FTD-Endnotes',"%d." % key) self.doc.write_text(base.get_title()) - for item in [ base.get_author(), base.get_publication_info(), base.get_abbreviation(), - dd.display(srcref.get_date_object()),]: + for item in [ base.get_author(), base.get_publication_info(), + base.get_abbreviation(), + DateHandler.get_date(srcref),]: if item: self.doc.write_text('; %s' % item) @@ -267,7 +268,7 @@ class FtmDescendantReport(Report.Report): if not event_handle: continue event = self.database.get_event_from_handle(event_handle) - date = event.get_date() + date = DateHandler.get_date(event) place_handle = event.get_place_handle() if place_handle: place = self.database.get_place_from_handle(place_handle) @@ -323,7 +324,7 @@ class FtmDescendantReport(Report.Report): if not event_handle: continue event = self.database.get_event_from_handle(event_handle) - date = event.get_date() + date = DateHandler.get_date(event) place_handle = event.get_place_handle() if place_handle: place = self.database.get_place_from_handle(place_handle) diff --git a/src/plugins/GraphViz.py b/src/plugins/GraphViz.py index 3383eaa8a..d0f340ed6 100644 --- a/src/plugins/GraphViz.py +++ b/src/plugins/GraphViz.py @@ -49,6 +49,7 @@ import ReportOptions import GenericFilter import const import RelLib +import DateHandler from BaseDoc import PAPER_LANDSCAPE from latin_utf8 import utf8_to_latin from QuestionDialog import ErrorDialog @@ -370,7 +371,7 @@ class GraphViz: if self.just_years: return '%i' % event.get_date_object().get_year() else: - return event.get_date() + return DateHandler.get_date(event) elif self.placecause: place_handle = event.get_place_handle() place = self.database.get_place_from_handle(place_handle) diff --git a/src/plugins/IndivComplete.py b/src/plugins/IndivComplete.py index 4b8028fe2..c0ded0bbb 100644 --- a/src/plugins/IndivComplete.py +++ b/src/plugins/IndivComplete.py @@ -46,6 +46,7 @@ import BaseDoc import Report import GenericFilter import ReportOptions +import DateHandler #------------------------------------------------------------------------ # @@ -113,7 +114,7 @@ class IndivCompleteReport(Report.Report): if event == None: return name = _(event.get_name()) - date = event.get_date() + date = DateHandler.get_date(event) place_handle = event.get_place_handle() if place_handle: place = self.database.get_place_from_handle(place_handle).get_title() diff --git a/src/plugins/IndivSummary.py b/src/plugins/IndivSummary.py index f722569ac..edf10ec00 100644 --- a/src/plugins/IndivSummary.py +++ b/src/plugins/IndivSummary.py @@ -47,6 +47,7 @@ import const import BaseDoc import Report import ReportOptions +import DateHandler import const #------------------------------------------------------------------------ @@ -94,7 +95,7 @@ class IndivSummary(Report.Report): if event == None: return name = const.display_event(event.get_name()) - date = event.get_date() + date = DateHandler.get_date(event) place_handle = event.get_place_handle() if place_handle: place_obj = self.database.get_place_from_handle(place_handle) diff --git a/src/plugins/RelCalc.py b/src/plugins/RelCalc.py index c010ec550..0c027474d 100644 --- a/src/plugins/RelCalc.py +++ b/src/plugins/RelCalc.py @@ -47,6 +47,7 @@ import Utils import NameDisplay import ListModel import PluginMgr +import DateHandler #------------------------------------------------------------------------- # @@ -103,7 +104,7 @@ class RelCalc: continue bh = p.get_birth_handle() if bh: - bdate = self.db.get_event_from_handle(bh).get_date() + bdate = DateHandler.get_date(self.db.get_event_from_handle(bh)) else: bdate = "" name = p.get_primary_name() diff --git a/src/plugins/ScratchPad.py b/src/plugins/ScratchPad.py index fa8ae4c58..4aa411faf 100644 --- a/src/plugins/ScratchPad.py +++ b/src/plugins/ScratchPad.py @@ -47,6 +47,7 @@ from gnome import help_display #------------------------------------------------------------------------- import const import TreeTips +import DateHandler from DdTargets import DdTargets @@ -136,7 +137,7 @@ class ScratchPadAddress(ScratchPadGrampsTypeWrapper): def __init__(self,model,obj): ScratchPadGrampsTypeWrapper.__init__(self,model,obj) 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._obj.get_state(),self._obj.get_country()) @@ -153,7 +154,7 @@ class ScratchPadAddress(ScratchPadGrampsTypeWrapper): "\t\t%s\n"\ "\t%s:\t%s\n" % ( _("Address"), - _("Date"), escape(self._obj.get_date()), + _("Date"), escape(DateHandler.get_date(self._obj)), _("Location"), escape(self._obj.get_street()), escape(self._obj.get_city()), @@ -197,7 +198,7 @@ class ScratchPadEvent(ScratchPadGrampsTypeWrapper): "\t%s:\t%s\n" % ( _("Event"), _("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)), _("Cause"),escape(self._obj.get_cause()), _("Description"), escape(self._obj.get_description())) @@ -239,7 +240,7 @@ class ScratchPadFamilyEvent(ScratchPadGrampsTypeWrapper): "\t%s:\t%s\n" % ( _("Family Event"), _("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)), _("Cause"),escape(self._obj.get_cause()), _("Description"), escape(self._obj.get_description())) @@ -465,8 +466,9 @@ class ScratchPersonLink(ScratchPadWrapper): birth_handle = person.get_birth_handle() if birth_handle: birth = self._db.get_event_from_handle(birth_handle) - if birth.get_date() and birth.get_date() != "": - self._value = escape(birth.get_date()) + date_str = DateHandler.get_date(birth) + if date_str != "": + self._value = escape(date_str) def tooltip(self): diff --git a/src/plugins/StatisticsChart.py b/src/plugins/StatisticsChart.py index 7e67bf475..3b610a1a9 100755 --- a/src/plugins/StatisticsChart.py +++ b/src/plugins/StatisticsChart.py @@ -58,7 +58,7 @@ import Report import ReportUtils import ReportOptions import GenericFilter -from DateHandler import displayer as _dd +import DateHandler #------------------------------------------------------------------------ # @@ -190,7 +190,7 @@ class Extract: if date: month = date.get_month() if month: - return [_dd._months[month]] + return [DateHandler.displayer._months[month]] return [_("Date(s) missing")] def get_cause(self, event): diff --git a/src/plugins/Summary.py b/src/plugins/Summary.py index ff1502e92..21ab8cf38 100644 --- a/src/plugins/Summary.py +++ b/src/plugins/Summary.py @@ -47,6 +47,7 @@ import Utils import RelLib import const import Report +import DateHandler #------------------------------------------------------------------------ # @@ -95,7 +96,7 @@ def build_report(database,person): birth_handle = person.get_birth_handle() if 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 else: missing_bday = missing_bday + 1