diff --git a/ChangeLog b/ChangeLog index 5d5fda9d2..e96cf28bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-03-28 Brian Matherly + * src/Sort.py: remove use of deprecated functions + * src/BaseDoc.py: remove use of deprecated functions + * src/PluginUtils/_ReportUtils.py: remove use of deprecated functions + * src/plugins/DecendReport.py: remove use of deprecated functions + * src/plugins/IndivComplete.py: remove use of deprecated functions + * src/plugins/DetDescendantReport.py: remove use of deprecated functions + * src/plugins/DetAncestralReport.py: remove use of deprecated functions + 2006-03-29 Don Allingham * src/DisplayTabs.py: fix import * src/Editors/_EditPerson.py: Fix imports of EditMediaRef, remove diff --git a/src/BaseDoc.py b/src/BaseDoc.py index b372004fb..55b34d4af 100644 --- a/src/BaseDoc.py +++ b/src/BaseDoc.py @@ -75,6 +75,7 @@ from math import pi, cos, sin #------------------------------------------------------------------------- import Utils import FontScale +import const #------------------------------------------------------------------------- # diff --git a/src/PluginUtils/_ReportUtils.py b/src/PluginUtils/_ReportUtils.py index 53d19b354..a2c85cd43 100644 --- a/src/PluginUtils/_ReportUtils.py +++ b/src/PluginUtils/_ReportUtils.py @@ -1663,15 +1663,17 @@ def married_rel_str(database,person,family,is_first=True): 'spouse' :_nd.display(spouse) } + relationship = family.get_relationship()[0] + if is_first: - if family.get_relationship() == RelLib.Family.MARRIED: + if relationship == RelLib.Family.MARRIED: if person.get_gender() == RelLib.Person.MALE: text = _('He married %(spouse)s.') % values elif person.get_gender() == RelLib.Person.FEMALE: text = _('She married %(spouse)s.') % values else: text = _('This person married %(spouse)s.') % values - elif family.get_relationship() == RelLib.Family.UNMARRIED: + elif relationship == RelLib.Family.UNMARRIED: if person.get_gender() == RelLib.Person.MALE: text = _('He had an unmarried relationship with %(spouse)s.') % values elif person.get_gender() == RelLib.Person.FEMALE: @@ -1686,14 +1688,14 @@ def married_rel_str(database,person,family,is_first=True): else: text = _('This person had relationship with %(spouse)s.') % values else: - if family.get_relationship() == RelLib.Family.MARRIED: + if relationship == RelLib.Family.MARRIED: if person.get_gender() == RelLib.Person.MALE: text = _('He also married %(spouse)s.') % values elif person.get_gender() == RelLib.Person.FEMALE: text = _('She also married %(spouse)s.') % values else: text = _('This person also married %(spouse)s.') % values - elif family.get_relationship() == RelLib.Family.UNMARRIED: + elif relationship == RelLib.Family.UNMARRIED: if person.get_gender() == RelLib.Person.MALE: text = _('He had an unmarried relationship with %(spouse)s.') % values elif person.get_gender() == RelLib.Person.FEMALE: @@ -1781,9 +1783,9 @@ def find_spouse(person,family): # #------------------------------------------------------------------------- def find_marriage(database,family): - for event_handle in family.get_event_list(): - event = database.get_event_from_handle(event_handle) - if event and event.get_name() == "Marriage": + for event_ref in family.get_event_ref_list(): + event = database.get_event_from_handle(event_ref.ref) + if event and event.get_type() == RelLib.Event.MARRIAGE: return event return None @@ -1971,9 +1973,9 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""): bdate_mod = False burial = None - for event_handle in person.get_event_list(): - event = database.get_event_from_handle(event_handle) - if event and event.get_name() == "Burial": + for event_ref in person.get_event_ref_list(): + event = database.get_event_from_handle(event_ref.ref) + if event and event.get_type() == RelLib.Event.BURIAL: burial = event break @@ -2121,15 +2123,15 @@ def old_calc_age(database,person): age = 0 units = 0 - birth_handle = person.get_birth_handle() - if birth_handle: - birth = database.get_event_from_handle(birth_handle).get_date_object() + birth_ref = person.get_birth_ref() + if birth_ref: + birth = database.get_event_from_handle(birth_ref.ref).get_date_object() birth_year_valid = birth.get_year_valid() else: birth_year_valid = None - death_handle = person.get_death_handle() - if death_handle: - death = database.get_event_from_handle(death_handle).get_date_object() + death_ref = person.get_death_ref() + if death_ref: + death = database.get_event_from_handle(death_ref.ref).get_date_object() death_year_valid = death.get_year_valid() else: death_year_valid = None diff --git a/src/Sort.py b/src/Sort.py index 7fd7066ab..1a595d76f 100644 --- a/src/Sort.py +++ b/src/Sort.py @@ -99,15 +99,15 @@ class Sort: first = self.database.get_person_from_handle(first_id) second = self.database.get_person_from_handle(second_id) - birth_handle1 = first.get_birth_handle() - if birth_handle1: - date1 = self.database.get_event_from_handle(birth_handle1).get_date_object() + birth_ref1 = first.get_birth_ref() + if birth_ref1: + date1 = self.database.get_event_from_handle(birth_ref1.ref).get_date_object() else: date1 = Date() - birth_handle2 = second.get_birth_handle() - if birth_handle2: - date2 = self.database.get_event_from_handle(birth_handle2).get_date_object() + birth_ref2 = second.get_birth_ref() + if birth_ref2: + date2 = self.database.get_event_from_handle(birth_ref2.ref).get_date_object() else: date2 = Date() diff --git a/src/plugins/DescendReport.py b/src/plugins/DescendReport.py index 8caafc565..63f26a7b8 100644 --- a/src/plugins/DescendReport.py +++ b/src/plugins/DescendReport.py @@ -85,18 +85,18 @@ class DescendantReport(Report.Report): self.by_birthdate = sort.by_birthdate def dump_dates(self, person): - birth_handle = person.get_birth_handle() - if birth_handle: - birth = self.database.get_event_from_handle(birth_handle) + birth_ref = person.get_birth_ref() + if birth_ref: + birth = self.database.get_event_from_handle(birth_ref.ref) birth_date = birth.get_date_object() birth_year_valid = birth_date.get_year_valid() else: birth_year_valid = 0 birth = None - death_handle = person.get_death_handle() - if death_handle: - death = self.database.get_event_from_handle(death_handle) + death_ref = person.get_death_ref() + if death_ref: + death = self.database.get_event_from_handle(death_ref.ref) death_date = death.get_date_object() death_year_valid = death_date.get_year_valid() else: diff --git a/src/plugins/DetAncestralReport.py b/src/plugins/DetAncestralReport.py index 1f2bc6c40..adee00894 100644 --- a/src/plugins/DetAncestralReport.py +++ b/src/plugins/DetAncestralReport.py @@ -46,9 +46,9 @@ import gtk import RelLib from PluginUtils import Report, ReportOptions, ReportUtils, register_report import BaseDoc -import const +import Utils +import DateHandler from QuestionDialog import ErrorDialog -from DateHandler import displayer as _dd from NameDisplay import displayer as _nd #------------------------------------------------------------------------ @@ -227,9 +227,10 @@ class DetAncestorReport(Report.Report): self.EMPTY_DATE,self.EMPTY_PLACE) if text: self.doc.write_text(text) - birth_handle = person.get_birth_handle() - if birth_handle: - self.endnotes(self.database.get_event_from_handle(birth_handle)) + birth_ref = person.get_birth_ref() + if birth_ref: + birth = self.database.get_event_from_handle(birth_ref.ref) + self.endnotes(birth) first = 0 age,units = self.calc_age(person) @@ -237,9 +238,10 @@ class DetAncestorReport(Report.Report): self.EMPTY_DATE,self.EMPTY_PLACE,age,units) if text: self.doc.write_text(text) - death_handle = person.get_birth_handle() - if death_handle: - self.endnotes(self.database.get_event_from_handle(death_handle)) + death_ref = person.get_birth_ref() + if death_ref: + death = self.database.get_event_from_handle(death_ref.ref) + self.endnotes(death) first = 0 @@ -276,16 +278,16 @@ class DetAncestorReport(Report.Report): atype = alt_name.get_type() self.doc.write_text( _('%(name_kind)s: %(name)s%(endnotes)s') % { - 'name_kind' : const.NameTypesMap.find_value(atype), + 'name_kind' : Utils.format_name_type( atype ), 'name' : alt_name.get_regular_name(), 'endnotes' : self.endnotes(alt_name), }) self.doc.end_paragraph() if self.includeEvents: - for event_handle in person.get_event_list(): - event = self.database.get_event_from_handle(event_handle) - date = event.get_date() + for event_ref in person.get_event_ref_list(): + event = self.database.get_event_from_handle(event_ref.ref) + date = DateHandler.get_date(event) ph = event.get_place_handle() if ph: place = self.database.get_place_from_handle(ph).get_title() @@ -301,28 +303,29 @@ class DetAncestorReport(Report.Report): self.doc.start_paragraph('DAR-MoreDetails') + evtName = Utils.format_event( event.get_type() ) if date and place: self.doc.write_text( _('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % { - 'event_name' : _(event.get_name()), + 'event_name' : _(evtName), 'date' : date, 'endnotes' : self.endnotes(event), 'place' : place }) elif date: self.doc.write_text( _('%(event_name)s: %(date)s%(endnotes)s. ') % { - 'event_name' : _(event.get_name()), + 'event_name' : _(evtName), 'endnotes' : self.endnotes(event), 'date' : date}) elif place: self.doc.write_text( _('%(event_name)s: %(place)s%(endnotes)s. ') % { - 'event_name' : _(event.get_name()), + 'event_name' : _(evtName), 'endnotes' : self.endnotes(event), 'place' : place }) else: self.doc.write_text(_('%(event_name)s: ') % { - 'event_name' : _(event.get_name())}) + 'event_name' : _(evtName)}) if event.get_description(): self.doc.write_text(event.get_description()) self.doc.end_paragraph() @@ -347,7 +350,7 @@ class DetAncestorReport(Report.Report): father_name = "" text = ReportUtils.child_str(person, father_name, mother_name, - bool(person.get_death_handle()), + bool(person.get_death_ref()), firstName) if text: self.doc.write_text(text) diff --git a/src/plugins/DetDescendantReport.py b/src/plugins/DetDescendantReport.py index c70ea6151..96886ce65 100644 --- a/src/plugins/DetDescendantReport.py +++ b/src/plugins/DetDescendantReport.py @@ -256,9 +256,10 @@ class DetDescendantReport(Report.Report): self.EMPTY_DATE,self.EMPTY_PLACE) if text: self.doc.write_text(text) - birth_handle = person.get_birth_handle() - if birth_handle: - self.endnotes(self.database.get_event_from_handle(birth_handle)) + birth_ref = person.get_birth_ref() + if birth_ref: + birth = self.database.get_event_from_handle(birth_ref.ref) + self.endnotes(birth) first = 0 age,units = self.calc_age(person) @@ -266,9 +267,10 @@ class DetDescendantReport(Report.Report): self.EMPTY_DATE,self.EMPTY_PLACE,age,units) if text: self.doc.write_text(text) - death_handle = person.get_birth_handle() - if death_handle: - self.endnotes(self.database.get_event_from_handle(death_handle)) + death_ref = person.get_birth_ref() + if death_ref: + death = self.database.get_event_from_handle(death_ref.ref) + self.endnotes(death) first = 0 @@ -372,7 +374,7 @@ class DetDescendantReport(Report.Report): father_name = "" text = ReportUtils.child_str(person, father_name, mother_name, - bool(person.get_death_handle()), + bool(person.get_death_ref()), firstName) if text: self.doc.write_text(text) diff --git a/src/plugins/IndivComplete.py b/src/plugins/IndivComplete.py index 1bae7a9ff..8ef972380 100644 --- a/src/plugins/IndivComplete.py +++ b/src/plugins/IndivComplete.py @@ -42,6 +42,7 @@ import gtk #------------------------------------------------------------------------ import RelLib import const +import Utils import BaseDoc import GenericFilter import DateHandler @@ -112,7 +113,8 @@ class IndivCompleteReport(Report.Report): def write_fact(self,event): if event == None: return - name = _(event.get_name()) + evtType = event.get_type() + name = Utils.format_event( evtType ) date = DateHandler.get_date(event) place_handle = event.get_place_handle() if place_handle: @@ -238,7 +240,7 @@ class IndivCompleteReport(Report.Report): self.doc.end_row() for name in self.start_person.get_alternate_names(): - type = const.NameTypesMap.find_value(name.get_type()) + type = Utils.format_name_type( name.get_type() ) self.doc.start_row() self.normal_cell(type) text = name.get_regular_name() @@ -287,9 +289,9 @@ class IndivCompleteReport(Report.Report): self.doc.end_cell() self.doc.end_row() - for event_handle in family.get_event_list(): - if event_handle: - event = self.database.get_event_from_handle(event_handle) + for event_ref in family.get_event_ref_list(): + if event_ref: + event = self.database.get_event_from_handle(event_ref.ref) self.write_fact(event) child_handle_list = family.get_child_handle_list() @@ -349,13 +351,12 @@ class IndivCompleteReport(Report.Report): self.doc.end_cell() self.doc.end_row() - event_handle_list = [ self.start_person.get_birth_handle(), - self.start_person.get_death_handle() ] - event_handle_list = event_handle_list \ - + self.start_person.get_event_list() - for event_handle in event_handle_list: - if event_handle: - event = self.database.get_event_from_handle(event_handle) + event_ref_list = [ self.start_person.get_birth_ref(), \ + self.start_person.get_death_ref() ] + \ + self.start_person.get_event_ref_list() + for event_ref in event_ref_list: + if event_ref: + event = self.database.get_event_from_handle(event_ref.ref) self.write_fact(event) self.doc.end_table() self.doc.start_paragraph("IDS-Normal")