#2385: Fan chart and multiple calendars (only for years on french calendar; < 15)

svn: r13744
This commit is contained in:
Jérôme Rapinat 2009-12-09 08:37:08 +00:00
parent f271154b59
commit 9a23a34ff1

View File

@ -40,7 +40,6 @@ from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
from gen.plug.menu import EnumeratedListOption, NumberOption, PersonOption from gen.plug.menu import EnumeratedListOption, NumberOption, PersonOption
from ReportBase import Report, ReportUtils, MenuReportOptions from ReportBase import Report, ReportUtils, MenuReportOptions
from SubstKeywords import SubstKeywords from SubstKeywords import SubstKeywords
import gen.lib
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -149,8 +148,6 @@ class FanChart(Report):
self.circle = menu.get_option_by_name('circle').get_value() self.circle = menu.get_option_by_name('circle').get_value()
self.background = menu.get_option_by_name('background').get_value() self.background = menu.get_option_by_name('background').get_value()
self.radial = menu.get_option_by_name('radial').get_value() self.radial = menu.get_option_by_name('radial').get_value()
selected_cal = menu.get_option_by_name('calendar').get_value()
self.calendar = gen.lib.date.Date.ui_calendar_names[selected_cal]
pid = menu.get_option_by_name('pid').get_value() pid = menu.get_option_by_name('pid').get_value()
self.center_person = database.get_person_from_gramps_id(pid) self.center_person = database.get_person_from_gramps_id(pid)
if (self.center_person == None) : if (self.center_person == None) :
@ -272,7 +269,7 @@ class FanChart(Report):
birth_ref = person.get_birth_ref() birth_ref = person.get_birth_ref()
if birth_ref: if birth_ref:
birth = self.database.get_event_from_handle(birth_ref.ref) birth = self.database.get_event_from_handle(birth_ref.ref)
b = birth.get_date_object().to_calendar(self.calendar).get_year() b = birth.get_date_object().get_year()
if b == 0: if b == 0:
b = "" b = ""
else: else:
@ -281,12 +278,16 @@ class FanChart(Report):
death_ref = person.get_death_ref() death_ref = person.get_death_ref()
if death_ref: if death_ref:
death = self.database.get_event_from_handle(death_ref.ref) death = self.database.get_event_from_handle(death_ref.ref)
d = death.get_date_object().to_calendar(self.calendar).get_year() d = death.get_date_object().get_year()
if d == 0: if d == 0:
d = "" d = ""
else: else:
d = "" d = ""
# french calendar years < 15
if b < 15:
b = birth.get_date_object().to_calendar("gregorian").get_year()
if d < 15:
d = death.get_date_object().to_calendar("gregorian").get_year()
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:
@ -434,14 +435,6 @@ class FanChartOptions(MenuReportOptions):
radial.add_item(RADIAL_ROUNDABOUT,_('roundabout')) radial.add_item(RADIAL_ROUNDABOUT,_('roundabout'))
radial.set_help(_("Print radial texts upright or roundabout")) radial.set_help(_("Print radial texts upright or roundabout"))
menu.add_option(category_name,"radial",radial) 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): def make_default_style(self,default_style):
"""Make the default output style for the Fan Chart report.""" """Make the default output style for the Fan Chart report."""