#2385: Fan chart and multiple calendars (like TimeLine.py)

svn: r13725
This commit is contained in:
Jérôme Rapinat 2009-12-06 09:38:10 +00:00
parent 1d86ecd6fb
commit 927ac824b9

View File

@ -39,6 +39,7 @@ from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
from gen.plug.menu import EnumeratedListOption, NumberOption, PersonOption
from ReportBase import Report, ReportUtils, MenuReportOptions
from SubstKeywords import SubstKeywords
import gen.lib
#------------------------------------------------------------------------
#
@ -88,6 +89,7 @@ class FanChart(Report):
self.circle = menu.get_option_by_name('circle').get_value()
self.background = menu.get_option_by_name('background').get_value()
self.radial = menu.get_option_by_name('radial').get_value()
self.calendar = gen.lib.date.Date.ui_calendar_names[menu.get_option_by_name('calendar').get_value()]
pid = menu.get_option_by_name('pid').get_value()
self.center_person = database.get_person_from_gramps_id(pid)
if (self.center_person == None) :
@ -209,7 +211,7 @@ class FanChart(Report):
birth_ref = person.get_birth_ref()
if birth_ref:
birth = self.database.get_event_from_handle(birth_ref.ref)
b = birth.get_date_object().get_year()
b = birth.get_date_object().to_calendar(self.calendar).get_year()
if b == 0:
b = ""
else:
@ -218,7 +220,7 @@ class FanChart(Report):
death_ref = person.get_death_ref()
if death_ref:
death = self.database.get_event_from_handle(death_ref.ref)
d = death.get_date_object().get_year()
d = death.get_date_object().to_calendar(self.calendar).get_year()
if d == 0:
d = ""
else:
@ -371,6 +373,14 @@ class FanChartOptions(MenuReportOptions):
radial.add_item(RADIAL_ROUNDABOUT,_('roundabout'))
radial.set_help(_("Print radial texts upright or roundabout"))
menu.add_option(category_name,"radial",radial)
self.__calendar = EnumeratedListOption(_("Calendar"), 0)
self.__calendar.set_help(_("The calendar which determines the year span"))
idx = 0
for calendar in gen.lib.date.Date.ui_calendar_names:
self.__calendar.add_item(idx, calendar)
idx += 1
menu.add_option(category_name, "calendar", self.__calendar)
def make_default_style(self,default_style):
"""Make the default output style for the Fan Chart report."""