3442: Fan chart report might use ReportUtils.get_birth_or_fallback and get_death_or_fallback for years
svn: r20289
This commit is contained in:
parent
39dba1ffd0
commit
3d473d7062
@ -51,6 +51,8 @@ from gen.plug.report import Report
|
|||||||
from gen.plug.report import utils as ReportUtils
|
from gen.plug.report import utils as ReportUtils
|
||||||
from gen.plug.report import MenuReportOptions
|
from gen.plug.report import MenuReportOptions
|
||||||
from gen.config import config
|
from gen.config import config
|
||||||
|
from gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
import gen.lib
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -264,23 +266,23 @@ class FanChart(Report):
|
|||||||
pn = person.get_primary_name()
|
pn = person.get_primary_name()
|
||||||
self.calendar = config.get('preferences.calendar-format-report')
|
self.calendar = config.get('preferences.calendar-format-report')
|
||||||
|
|
||||||
birth_ref = person.get_birth_ref()
|
birth = get_birth_or_fallback(self.database, person)
|
||||||
if birth_ref:
|
b = ""
|
||||||
birth = self.database.get_event_from_handle(birth_ref.ref)
|
if birth:
|
||||||
b = birth.get_date_object().to_calendar(self.calendar).get_year()
|
b = str(birth.get_date_object().to_calendar(self.calendar).get_year())
|
||||||
if b == 0:
|
if b == 0:
|
||||||
b = ""
|
b = ""
|
||||||
else:
|
elif birth.get_type() != gen.lib.EventType.BIRTH:
|
||||||
b = ""
|
b += '*'
|
||||||
|
|
||||||
death_ref = person.get_death_ref()
|
death = get_death_or_fallback(self.database, person)
|
||||||
if death_ref:
|
d = ""
|
||||||
death = self.database.get_event_from_handle(death_ref.ref)
|
if death:
|
||||||
d = death.get_date_object().to_calendar(self.calendar).get_year()
|
d = str(death.get_date_object().to_calendar(self.calendar).get_year())
|
||||||
if d == 0:
|
if d == 0:
|
||||||
d = ""
|
d = ""
|
||||||
else:
|
elif death.get_type() != gen.lib.EventType.DEATH:
|
||||||
d = ""
|
d += '*'
|
||||||
if b and d:
|
if b and d:
|
||||||
val = "%s - %s" % (str(b),str(d))
|
val = "%s - %s" % (str(b),str(d))
|
||||||
elif b:
|
elif b:
|
||||||
@ -440,7 +442,7 @@ class FanChartOptions(MenuReportOptions):
|
|||||||
|
|
||||||
#Paragraph Styles
|
#Paragraph Styles
|
||||||
f = FontStyle()
|
f = FontStyle()
|
||||||
f.set_size(20)
|
f.set_size(18)
|
||||||
f.set_bold(1)
|
f.set_bold(1)
|
||||||
f.set_type_face(FONT_SANS_SERIF)
|
f.set_type_face(FONT_SANS_SERIF)
|
||||||
p = ParagraphStyle()
|
p = ParagraphStyle()
|
||||||
|
Loading…
Reference in New Issue
Block a user