From 42b71b23d6b3e163197bcc3b8d580b469447917e Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Thu, 31 Dec 2020 19:34:11 +0100 Subject: [PATCH] Allow user to set default calendar in date editor Fixes #11809 --- gramps/gen/config.py | 1 + gramps/gui/configure.py | 13 +++++++++++++ gramps/gui/editors/editdate.py | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/gramps/gen/config.py b/gramps/gen/config.py index 7e660ce9c..d53141685 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -240,6 +240,7 @@ register('paths.quick-backup-filename', register('preferences.quick-backup-include-mode', False) register('preferences.date-format', 0) register('preferences.calendar-format-report', 0) +register('preferences.calendar-format-input', 0) register('preferences.cprefix', 'C%04d') register('preferences.default-source', False) register('preferences.tag-on-import', False) diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index 38d1e394e..2e0f8db47 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -1311,6 +1311,19 @@ class GrampsPreferences(ConfigureDialog): grid.attach(lwidget, 1, row, 1, 1) grid.attach(obox, 2, row, 2, 1) + row += 1 + # Calendar format on input: + obox = Gtk.ComboBoxText() + list(map(obox.append_text, Date.ui_calendar_names)) + active = config.get('preferences.calendar-format-input') + if active >= len(formats): + active = 0 + obox.set_active(active) + obox.connect('changed', self.date_calendar_for_input_changed) + lwidget = BasicLabel(_("%s: ") % _('Calendar on input')) + grid.attach(lwidget, 1, row, 1, 1) + grid.attach(obox, 2, row, 2, 1) + row += 1 # Status bar: obox = Gtk.ComboBoxText() diff --git a/gramps/gui/editors/editdate.py b/gramps/gui/editors/editdate.py index 3c7ced14a..1cbe5a07c 100644 --- a/gramps/gui/editors/editdate.py +++ b/gramps/gui/editors/editdate.py @@ -60,6 +60,7 @@ from gi.repository import Gtk #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.sgettext +from gramps.gen.config import config from gramps.gen.lib.date import Date, DateError, calendar_has_fixed_newyear from gramps.gen.datehandler import displayer from gramps.gen.const import URL_MANUAL_SECT1 @@ -199,6 +200,9 @@ class EditDate(ManagedWindow): self.calendar_box.set_active(Date.CAL_JULIAN) self.dual_dated.connect('toggled', self.switch_dual_dated) + cal = config.get('preferences.calendar-format-input') + self.calendar_box.set_active(cal) + # The dialog is modal -- since dates don't have names, we don't # want to have several open dialogs, since then the user will # loose track of which is which. Much like opening files.