#2385 #3452 #2371 add options for selecting date format and calendars on reports

svn: r13846
This commit is contained in:
Jérôme Rapinat 2009-12-18 18:03:44 +00:00
parent 7b9bd62734
commit 25db37841c
3 changed files with 51 additions and 0 deletions

View File

@ -80,3 +80,12 @@ def get_date(date_base) :
def get_date_valid(date_base):
date_obj = date_base.get_date_object()
return date_obj.get_valid()
def get_calendar_formats():
"""
Return the list of supported calendars.
"""
try:
return LANG_TO_DISPLAY[LANG].calendar
except:
return LANG_TO_DISPLAY["C"].calendar

View File

@ -55,6 +55,7 @@ from gui.widgets import MarkupLabel, BasicLabel
from QuestionDialog import ErrorDialog, QuestionDialog2
from Errors import NameDisplayError
from glade import Glade
from QuestionDialog import OkDialog
#-------------------------------------------------------------------------
#
@ -686,6 +687,37 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
table.attach(obox, 1, 3, row, row+1, yoptions=0)
row += 1
# Date format on reports:
obox = gtk.combo_box_new_text()
#formats = GrampsLocale.tformat
formats = DateHandler.get_date_formats()
for item in formats:
obox.append_text(item)
active = config.get('preferences.date-format-report')
if active >= len(formats):
active = 0
obox.set_active(active)
obox.connect('changed', self.date_format_report_changed)
lwidget = BasicLabel("%s: " % _('Date format on reports'))
table.attach(lwidget, 0, 1, row, row+1, yoptions=0)
table.attach(obox, 1, 3, row, row+1, yoptions=0)
row += 1
# Calendar format on report:
obox = gtk.combo_box_new_text()
formats = DateHandler.get_calendar_formats()
for item in formats:
obox.append_text(item)
active = config.get('preferences.calendar-format-report')
if active >= len(formats):
active = 0
obox.set_active(active)
obox.connect('changed', self.date_calendar_changed)
lwidget = BasicLabel("%s: " % _('Calendar format on reports'))
table.attach(lwidget, 0, 1, row, row+1, yoptions=0)
table.attach(obox, 1, 3, row, row+1, yoptions=0)
row += 1
# Surname guessing:
obox = gtk.combo_box_new_text()
formats = _surname_styles
@ -765,6 +797,14 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
_('Changing the data format will not take '
'effect until the next time Gramps is started.'))
def date_calendar_changed(self, obj):
config.set('preferences.calendar-format-report', obj.get_active())
def date_format_report_changed(self, obj):
config.set('preferences.date-format-report', obj.get_active())
def add_date_panel(self):
table = gtk.Table(2, 7)
table.set_border_width(12)

View File

@ -622,6 +622,8 @@ register('paths.website-directory', const.USER_HOME)
register('preferences.complete-color', '#008b00')
register('preferences.custom-marker-color', '#8b008b')
register('preferences.date-format', 0)
register('preferences.date-format-report', 0)
register('preferences.calendar-format-report', 0)
register('preferences.default-source', False)
register('preferences.eprefix', 'E%04d')
register('preferences.family-details', True)