3473: To dynamicaly change calendar option on the Gramps session

svn: r14008
This commit is contained in:
Jérôme Rapinat 2010-01-09 17:51:58 +00:00
parent 7dd624d657
commit f56402cf37
3 changed files with 14 additions and 9 deletions

View File

@ -782,9 +782,6 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
def date_calendar_changed(self, obj):
config.set('preferences.calendar-format-report', obj.get_active())
OkDialog(_('Change is not immediate'),
_('Changing the data format will not take '
'effect until the next time Gramps is started.'))
def add_date_panel(self):
table = gtk.Table(2, 7)

View File

@ -166,6 +166,8 @@ class FanChart(Report):
self.background_style.append(background_style_name)
text_style_name = 'text_style' + '%d' % i
self.text_style.append(text_style_name)
self.calendar = 0
Report.__init__(self, database, options_class)
@ -268,11 +270,12 @@ class FanChart(Report):
def get_info(self,person_handle,generation):
person = self.database.get_person_from_handle(person_handle)
pn = person.get_primary_name()
self.calendar = config.get('preferences.calendar-format-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().to_calendar(cal).get_year()
b = birth.get_date_object().to_calendar(self.calendar).get_year()
if b == 0:
b = ""
else:
@ -281,7 +284,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().to_calendar(cal).get_year()
d = death.get_date_object().to_calendar(self.calendar).get_year()
if d == 0:
d = ""
else:

View File

@ -104,6 +104,7 @@ class TimeLine(Report):
sort_functions = _get_sort_functions(Sort.Sort(database))
self.sort_name = sort_functions[sort_func_num][0]
self.sort_func = sort_functions[sort_func_num][1]
self.calendar = 0
def write_report(self):
self.progress = ProgressMeter(_('Timeline'))
@ -143,18 +144,20 @@ class TimeLine(Report):
self.plist.sort(key=self.sort_func)
self.progress.set_pass(_('Calculating timeline...'), len(self.plist))
self.calendar = config.get('preferences.calendar-format-report')
for p_id in self.plist:
self.progress.step()
p = self.database.get_person_from_handle(p_id)
birth = get_birth_or_fallback(self.database, p)
if birth:
b = birth.get_date_object().to_calendar(cal).get_year()
b = birth.get_date_object().to_calendar(self.calendar).get_year()
else:
b = None
death = get_death_or_fallback(self.database, p)
if death:
d = death.get_date_object().to_calendar(cal).get_year()
d = death.get_date_object().to_calendar(self.calendar).get_year()
else:
d = None
@ -244,18 +247,20 @@ class TimeLine(Report):
self.plist = self.filter.apply(self.database,
self.database.iter_person_handles())
self.calendar = config.get('preferences.calendar-format-report')
for p_id in self.plist:
p = self.database.get_person_from_handle(p_id)
birth = get_birth_or_fallback(self.database, p)
if birth:
b = birth.get_date_object().to_calendar(cal).get_year()
b = birth.get_date_object().to_calendar(self.calendar).get_year()
else:
b = None
death = get_death_or_fallback(self.database, p)
if death:
d = death.get_date_object().to_calendar(cal).get_year()
d = death.get_date_object().to_calendar(self.calendar).get_year()
else:
d = None