Allow user to set default calendar in date editor

Fixes #11809
This commit is contained in:
SNoiraud 2020-12-31 19:34:11 +01:00 committed by Nick Hall
parent 677d09e578
commit 42b71b23d6
3 changed files with 18 additions and 0 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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.