Remove use of deprecated functions. Supported text reports now work.
svn: r6229
This commit is contained in:
parent
b6aec043a6
commit
8a4302a1af
@ -1,3 +1,12 @@
|
|||||||
|
2006-03-28 Brian Matherly <pez4brian@users.sourceforge.net>
|
||||||
|
* 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 <don@gramps-project.org>
|
2006-03-29 Don Allingham <don@gramps-project.org>
|
||||||
* src/DisplayTabs.py: fix import
|
* src/DisplayTabs.py: fix import
|
||||||
* src/Editors/_EditPerson.py: Fix imports of EditMediaRef, remove
|
* src/Editors/_EditPerson.py: Fix imports of EditMediaRef, remove
|
||||||
|
@ -75,6 +75,7 @@ from math import pi, cos, sin
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import Utils
|
import Utils
|
||||||
import FontScale
|
import FontScale
|
||||||
|
import const
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -1663,15 +1663,17 @@ def married_rel_str(database,person,family,is_first=True):
|
|||||||
'spouse' :_nd.display(spouse)
|
'spouse' :_nd.display(spouse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
relationship = family.get_relationship()[0]
|
||||||
|
|
||||||
if is_first:
|
if is_first:
|
||||||
if family.get_relationship() == RelLib.Family.MARRIED:
|
if relationship == RelLib.Family.MARRIED:
|
||||||
if person.get_gender() == RelLib.Person.MALE:
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
text = _('He married %(spouse)s.') % values
|
text = _('He married %(spouse)s.') % values
|
||||||
elif person.get_gender() == RelLib.Person.FEMALE:
|
elif person.get_gender() == RelLib.Person.FEMALE:
|
||||||
text = _('She married %(spouse)s.') % values
|
text = _('She married %(spouse)s.') % values
|
||||||
else:
|
else:
|
||||||
text = _('This person married %(spouse)s.') % values
|
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:
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
text = _('He had an unmarried relationship with %(spouse)s.') % values
|
text = _('He had an unmarried relationship with %(spouse)s.') % values
|
||||||
elif person.get_gender() == RelLib.Person.FEMALE:
|
elif person.get_gender() == RelLib.Person.FEMALE:
|
||||||
@ -1686,14 +1688,14 @@ def married_rel_str(database,person,family,is_first=True):
|
|||||||
else:
|
else:
|
||||||
text = _('This person had relationship with %(spouse)s.') % values
|
text = _('This person had relationship with %(spouse)s.') % values
|
||||||
else:
|
else:
|
||||||
if family.get_relationship() == RelLib.Family.MARRIED:
|
if relationship == RelLib.Family.MARRIED:
|
||||||
if person.get_gender() == RelLib.Person.MALE:
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
text = _('He also married %(spouse)s.') % values
|
text = _('He also married %(spouse)s.') % values
|
||||||
elif person.get_gender() == RelLib.Person.FEMALE:
|
elif person.get_gender() == RelLib.Person.FEMALE:
|
||||||
text = _('She also married %(spouse)s.') % values
|
text = _('She also married %(spouse)s.') % values
|
||||||
else:
|
else:
|
||||||
text = _('This person also married %(spouse)s.') % values
|
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:
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
text = _('He had an unmarried relationship with %(spouse)s.') % values
|
text = _('He had an unmarried relationship with %(spouse)s.') % values
|
||||||
elif person.get_gender() == RelLib.Person.FEMALE:
|
elif person.get_gender() == RelLib.Person.FEMALE:
|
||||||
@ -1781,9 +1783,9 @@ def find_spouse(person,family):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def find_marriage(database,family):
|
def find_marriage(database,family):
|
||||||
for event_handle in family.get_event_list():
|
for event_ref in family.get_event_ref_list():
|
||||||
event = database.get_event_from_handle(event_handle)
|
event = database.get_event_from_handle(event_ref.ref)
|
||||||
if event and event.get_name() == "Marriage":
|
if event and event.get_type() == RelLib.Event.MARRIAGE:
|
||||||
return event
|
return event
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -1971,9 +1973,9 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""):
|
|||||||
bdate_mod = False
|
bdate_mod = False
|
||||||
|
|
||||||
burial = None
|
burial = None
|
||||||
for event_handle in person.get_event_list():
|
for event_ref in person.get_event_ref_list():
|
||||||
event = database.get_event_from_handle(event_handle)
|
event = database.get_event_from_handle(event_ref.ref)
|
||||||
if event and event.get_name() == "Burial":
|
if event and event.get_type() == RelLib.Event.BURIAL:
|
||||||
burial = event
|
burial = event
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -2121,15 +2123,15 @@ def old_calc_age(database,person):
|
|||||||
age = 0
|
age = 0
|
||||||
units = 0
|
units = 0
|
||||||
|
|
||||||
birth_handle = person.get_birth_handle()
|
birth_ref = person.get_birth_ref()
|
||||||
if birth_handle:
|
if birth_ref:
|
||||||
birth = database.get_event_from_handle(birth_handle).get_date_object()
|
birth = database.get_event_from_handle(birth_ref.ref).get_date_object()
|
||||||
birth_year_valid = birth.get_year_valid()
|
birth_year_valid = birth.get_year_valid()
|
||||||
else:
|
else:
|
||||||
birth_year_valid = None
|
birth_year_valid = None
|
||||||
death_handle = person.get_death_handle()
|
death_ref = person.get_death_ref()
|
||||||
if death_handle:
|
if death_ref:
|
||||||
death = database.get_event_from_handle(death_handle).get_date_object()
|
death = database.get_event_from_handle(death_ref.ref).get_date_object()
|
||||||
death_year_valid = death.get_year_valid()
|
death_year_valid = death.get_year_valid()
|
||||||
else:
|
else:
|
||||||
death_year_valid = None
|
death_year_valid = None
|
||||||
|
12
src/Sort.py
12
src/Sort.py
@ -99,15 +99,15 @@ class Sort:
|
|||||||
first = self.database.get_person_from_handle(first_id)
|
first = self.database.get_person_from_handle(first_id)
|
||||||
second = self.database.get_person_from_handle(second_id)
|
second = self.database.get_person_from_handle(second_id)
|
||||||
|
|
||||||
birth_handle1 = first.get_birth_handle()
|
birth_ref1 = first.get_birth_ref()
|
||||||
if birth_handle1:
|
if birth_ref1:
|
||||||
date1 = self.database.get_event_from_handle(birth_handle1).get_date_object()
|
date1 = self.database.get_event_from_handle(birth_ref1.ref).get_date_object()
|
||||||
else:
|
else:
|
||||||
date1 = Date()
|
date1 = Date()
|
||||||
|
|
||||||
birth_handle2 = second.get_birth_handle()
|
birth_ref2 = second.get_birth_ref()
|
||||||
if birth_handle2:
|
if birth_ref2:
|
||||||
date2 = self.database.get_event_from_handle(birth_handle2).get_date_object()
|
date2 = self.database.get_event_from_handle(birth_ref2.ref).get_date_object()
|
||||||
else:
|
else:
|
||||||
date2 = Date()
|
date2 = Date()
|
||||||
|
|
||||||
|
@ -85,18 +85,18 @@ class DescendantReport(Report.Report):
|
|||||||
self.by_birthdate = sort.by_birthdate
|
self.by_birthdate = sort.by_birthdate
|
||||||
|
|
||||||
def dump_dates(self, person):
|
def dump_dates(self, person):
|
||||||
birth_handle = person.get_birth_handle()
|
birth_ref = person.get_birth_ref()
|
||||||
if birth_handle:
|
if birth_ref:
|
||||||
birth = self.database.get_event_from_handle(birth_handle)
|
birth = self.database.get_event_from_handle(birth_ref.ref)
|
||||||
birth_date = birth.get_date_object()
|
birth_date = birth.get_date_object()
|
||||||
birth_year_valid = birth_date.get_year_valid()
|
birth_year_valid = birth_date.get_year_valid()
|
||||||
else:
|
else:
|
||||||
birth_year_valid = 0
|
birth_year_valid = 0
|
||||||
birth = None
|
birth = None
|
||||||
|
|
||||||
death_handle = person.get_death_handle()
|
death_ref = person.get_death_ref()
|
||||||
if death_handle:
|
if death_ref:
|
||||||
death = self.database.get_event_from_handle(death_handle)
|
death = self.database.get_event_from_handle(death_ref.ref)
|
||||||
death_date = death.get_date_object()
|
death_date = death.get_date_object()
|
||||||
death_year_valid = death_date.get_year_valid()
|
death_year_valid = death_date.get_year_valid()
|
||||||
else:
|
else:
|
||||||
|
@ -46,9 +46,9 @@ import gtk
|
|||||||
import RelLib
|
import RelLib
|
||||||
from PluginUtils import Report, ReportOptions, ReportUtils, register_report
|
from PluginUtils import Report, ReportOptions, ReportUtils, register_report
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
import const
|
import Utils
|
||||||
|
import DateHandler
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
from DateHandler import displayer as _dd
|
|
||||||
from NameDisplay import displayer as _nd
|
from NameDisplay import displayer as _nd
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@ -227,9 +227,10 @@ class DetAncestorReport(Report.Report):
|
|||||||
self.EMPTY_DATE,self.EMPTY_PLACE)
|
self.EMPTY_DATE,self.EMPTY_PLACE)
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text(text)
|
self.doc.write_text(text)
|
||||||
birth_handle = person.get_birth_handle()
|
birth_ref = person.get_birth_ref()
|
||||||
if birth_handle:
|
if birth_ref:
|
||||||
self.endnotes(self.database.get_event_from_handle(birth_handle))
|
birth = self.database.get_event_from_handle(birth_ref.ref)
|
||||||
|
self.endnotes(birth)
|
||||||
first = 0
|
first = 0
|
||||||
|
|
||||||
age,units = self.calc_age(person)
|
age,units = self.calc_age(person)
|
||||||
@ -237,9 +238,10 @@ class DetAncestorReport(Report.Report):
|
|||||||
self.EMPTY_DATE,self.EMPTY_PLACE,age,units)
|
self.EMPTY_DATE,self.EMPTY_PLACE,age,units)
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text(text)
|
self.doc.write_text(text)
|
||||||
death_handle = person.get_birth_handle()
|
death_ref = person.get_birth_ref()
|
||||||
if death_handle:
|
if death_ref:
|
||||||
self.endnotes(self.database.get_event_from_handle(death_handle))
|
death = self.database.get_event_from_handle(death_ref.ref)
|
||||||
|
self.endnotes(death)
|
||||||
first = 0
|
first = 0
|
||||||
|
|
||||||
|
|
||||||
@ -276,16 +278,16 @@ class DetAncestorReport(Report.Report):
|
|||||||
atype = alt_name.get_type()
|
atype = alt_name.get_type()
|
||||||
self.doc.write_text(
|
self.doc.write_text(
|
||||||
_('%(name_kind)s: %(name)s%(endnotes)s') % {
|
_('%(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(),
|
'name' : alt_name.get_regular_name(),
|
||||||
'endnotes' : self.endnotes(alt_name),
|
'endnotes' : self.endnotes(alt_name),
|
||||||
})
|
})
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
if self.includeEvents:
|
if self.includeEvents:
|
||||||
for event_handle in person.get_event_list():
|
for event_ref in person.get_event_ref_list():
|
||||||
event = self.database.get_event_from_handle(event_handle)
|
event = self.database.get_event_from_handle(event_ref.ref)
|
||||||
date = event.get_date()
|
date = DateHandler.get_date(event)
|
||||||
ph = event.get_place_handle()
|
ph = event.get_place_handle()
|
||||||
if ph:
|
if ph:
|
||||||
place = self.database.get_place_from_handle(ph).get_title()
|
place = self.database.get_place_from_handle(ph).get_title()
|
||||||
@ -301,28 +303,29 @@ class DetAncestorReport(Report.Report):
|
|||||||
|
|
||||||
|
|
||||||
self.doc.start_paragraph('DAR-MoreDetails')
|
self.doc.start_paragraph('DAR-MoreDetails')
|
||||||
|
evtName = Utils.format_event( event.get_type() )
|
||||||
if date and place:
|
if date and place:
|
||||||
self.doc.write_text(
|
self.doc.write_text(
|
||||||
_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
|
_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
|
||||||
'event_name' : _(event.get_name()),
|
'event_name' : _(evtName),
|
||||||
'date' : date,
|
'date' : date,
|
||||||
'endnotes' : self.endnotes(event),
|
'endnotes' : self.endnotes(event),
|
||||||
'place' : place })
|
'place' : place })
|
||||||
elif date:
|
elif date:
|
||||||
self.doc.write_text(
|
self.doc.write_text(
|
||||||
_('%(event_name)s: %(date)s%(endnotes)s. ') % {
|
_('%(event_name)s: %(date)s%(endnotes)s. ') % {
|
||||||
'event_name' : _(event.get_name()),
|
'event_name' : _(evtName),
|
||||||
'endnotes' : self.endnotes(event),
|
'endnotes' : self.endnotes(event),
|
||||||
'date' : date})
|
'date' : date})
|
||||||
elif place:
|
elif place:
|
||||||
self.doc.write_text(
|
self.doc.write_text(
|
||||||
_('%(event_name)s: %(place)s%(endnotes)s. ') % {
|
_('%(event_name)s: %(place)s%(endnotes)s. ') % {
|
||||||
'event_name' : _(event.get_name()),
|
'event_name' : _(evtName),
|
||||||
'endnotes' : self.endnotes(event),
|
'endnotes' : self.endnotes(event),
|
||||||
'place' : place })
|
'place' : place })
|
||||||
else:
|
else:
|
||||||
self.doc.write_text(_('%(event_name)s: ') % {
|
self.doc.write_text(_('%(event_name)s: ') % {
|
||||||
'event_name' : _(event.get_name())})
|
'event_name' : _(evtName)})
|
||||||
if event.get_description():
|
if event.get_description():
|
||||||
self.doc.write_text(event.get_description())
|
self.doc.write_text(event.get_description())
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
@ -347,7 +350,7 @@ class DetAncestorReport(Report.Report):
|
|||||||
father_name = ""
|
father_name = ""
|
||||||
|
|
||||||
text = ReportUtils.child_str(person, father_name, mother_name,
|
text = ReportUtils.child_str(person, father_name, mother_name,
|
||||||
bool(person.get_death_handle()),
|
bool(person.get_death_ref()),
|
||||||
firstName)
|
firstName)
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text(text)
|
self.doc.write_text(text)
|
||||||
|
@ -256,9 +256,10 @@ class DetDescendantReport(Report.Report):
|
|||||||
self.EMPTY_DATE,self.EMPTY_PLACE)
|
self.EMPTY_DATE,self.EMPTY_PLACE)
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text(text)
|
self.doc.write_text(text)
|
||||||
birth_handle = person.get_birth_handle()
|
birth_ref = person.get_birth_ref()
|
||||||
if birth_handle:
|
if birth_ref:
|
||||||
self.endnotes(self.database.get_event_from_handle(birth_handle))
|
birth = self.database.get_event_from_handle(birth_ref.ref)
|
||||||
|
self.endnotes(birth)
|
||||||
first = 0
|
first = 0
|
||||||
|
|
||||||
age,units = self.calc_age(person)
|
age,units = self.calc_age(person)
|
||||||
@ -266,9 +267,10 @@ class DetDescendantReport(Report.Report):
|
|||||||
self.EMPTY_DATE,self.EMPTY_PLACE,age,units)
|
self.EMPTY_DATE,self.EMPTY_PLACE,age,units)
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text(text)
|
self.doc.write_text(text)
|
||||||
death_handle = person.get_birth_handle()
|
death_ref = person.get_birth_ref()
|
||||||
if death_handle:
|
if death_ref:
|
||||||
self.endnotes(self.database.get_event_from_handle(death_handle))
|
death = self.database.get_event_from_handle(death_ref.ref)
|
||||||
|
self.endnotes(death)
|
||||||
first = 0
|
first = 0
|
||||||
|
|
||||||
|
|
||||||
@ -372,7 +374,7 @@ class DetDescendantReport(Report.Report):
|
|||||||
father_name = ""
|
father_name = ""
|
||||||
|
|
||||||
text = ReportUtils.child_str(person, father_name, mother_name,
|
text = ReportUtils.child_str(person, father_name, mother_name,
|
||||||
bool(person.get_death_handle()),
|
bool(person.get_death_ref()),
|
||||||
firstName)
|
firstName)
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text(text)
|
self.doc.write_text(text)
|
||||||
|
@ -42,6 +42,7 @@ import gtk
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import RelLib
|
import RelLib
|
||||||
import const
|
import const
|
||||||
|
import Utils
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
import GenericFilter
|
import GenericFilter
|
||||||
import DateHandler
|
import DateHandler
|
||||||
@ -112,7 +113,8 @@ class IndivCompleteReport(Report.Report):
|
|||||||
def write_fact(self,event):
|
def write_fact(self,event):
|
||||||
if event == None:
|
if event == None:
|
||||||
return
|
return
|
||||||
name = _(event.get_name())
|
evtType = event.get_type()
|
||||||
|
name = Utils.format_event( evtType )
|
||||||
date = DateHandler.get_date(event)
|
date = DateHandler.get_date(event)
|
||||||
place_handle = event.get_place_handle()
|
place_handle = event.get_place_handle()
|
||||||
if place_handle:
|
if place_handle:
|
||||||
@ -238,7 +240,7 @@ class IndivCompleteReport(Report.Report):
|
|||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
for name in self.start_person.get_alternate_names():
|
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.doc.start_row()
|
||||||
self.normal_cell(type)
|
self.normal_cell(type)
|
||||||
text = name.get_regular_name()
|
text = name.get_regular_name()
|
||||||
@ -287,9 +289,9 @@ class IndivCompleteReport(Report.Report):
|
|||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
for event_handle in family.get_event_list():
|
for event_ref in family.get_event_ref_list():
|
||||||
if event_handle:
|
if event_ref:
|
||||||
event = self.database.get_event_from_handle(event_handle)
|
event = self.database.get_event_from_handle(event_ref.ref)
|
||||||
self.write_fact(event)
|
self.write_fact(event)
|
||||||
|
|
||||||
child_handle_list = family.get_child_handle_list()
|
child_handle_list = family.get_child_handle_list()
|
||||||
@ -349,13 +351,12 @@ class IndivCompleteReport(Report.Report):
|
|||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
event_handle_list = [ self.start_person.get_birth_handle(),
|
event_ref_list = [ self.start_person.get_birth_ref(), \
|
||||||
self.start_person.get_death_handle() ]
|
self.start_person.get_death_ref() ] + \
|
||||||
event_handle_list = event_handle_list \
|
self.start_person.get_event_ref_list()
|
||||||
+ self.start_person.get_event_list()
|
for event_ref in event_ref_list:
|
||||||
for event_handle in event_handle_list:
|
if event_ref:
|
||||||
if event_handle:
|
event = self.database.get_event_from_handle(event_ref.ref)
|
||||||
event = self.database.get_event_from_handle(event_handle)
|
|
||||||
self.write_fact(event)
|
self.write_fact(event)
|
||||||
self.doc.end_table()
|
self.doc.end_table()
|
||||||
self.doc.start_paragraph("IDS-Normal")
|
self.doc.start_paragraph("IDS-Normal")
|
||||||
|
Loading…
Reference in New Issue
Block a user