From 25db37841cf1e756362b25ce2ff5df0120992d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Fri, 18 Dec 2009 18:03:44 +0000 Subject: [PATCH] #2385 #3452 #2371 add options for selecting date format and calendars on reports svn: r13846 --- src/DateHandler/_DateUtils.py | 9 ++++++++ src/GrampsCfg.py | 40 +++++++++++++++++++++++++++++++++++ src/config.py | 2 ++ 3 files changed, 51 insertions(+) diff --git a/src/DateHandler/_DateUtils.py b/src/DateHandler/_DateUtils.py index 7b86932bf..9bd4ec5fe 100644 --- a/src/DateHandler/_DateUtils.py +++ b/src/DateHandler/_DateUtils.py @@ -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 diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index a44e0048f..b68f7d3e5 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -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) diff --git a/src/config.py b/src/config.py index 570409ab9..be8b4b966 100644 --- a/src/config.py +++ b/src/config.py @@ -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)