Skip to content

Commit

Permalink
Update configure.py
Browse files Browse the repository at this point in the history
Add options for input calendar
  • Loading branch information
DaveSch-gramps committed Dec 30, 2020
1 parent 13ba8eb commit e456286
Showing 1 changed file with 58 additions and 32 deletions.
90 changes: 58 additions & 32 deletions gramps/gui/configure.py
Expand Up @@ -559,7 +559,7 @@ class GrampsPreferences(ConfigureDialog):

def __init__(self, uistate, dbstate):
page_funcs = (
self.add_display_panel,
self.add_data_panel,
self.add_general_panel,
self.add_addons_panel,
self.add_famtree_panel,
Expand Down Expand Up @@ -1149,7 +1149,7 @@ def cb_grampletbar_close(self, obj):
"""
self.uistate.emit('grampletbar-close-changed')

def add_display_panel(self, configdialog):
def add_data_panel(self, configdialog):
"""
Config tab with user Appearance and format settings.
"""
Expand Down Expand Up @@ -1289,32 +1289,6 @@ def add_display_panel(self, configdialog):
grid.attach(lwidget, 0, row, 1, 1)
grid.attach(obox, 1, row, 2, 1)

row += 1
# Surname guessing:
obox = Gtk.ComboBoxText()
formats = _surname_styles
list(map(obox.append_text, formats))
obox.set_active(config.get('behavior.surname-guessing'))
obox.connect('changed',
lambda obj: config.set('behavior.surname-guessing',
obj.get_active()))
lwidget = BasicLabel(_("%s: ") % _('Surname guessing'))
grid.attach(lwidget, 0, row, 1, 1)
grid.attach(obox, 1, row, 2, 1)

row += 1
# Default Family Relationship
obox = Gtk.ComboBoxText()
formats = FamilyRelType().get_standard_names()
list(map(obox.append_text, formats))
obox.set_active(config.get('preferences.family-relation-type'))
obox.connect('changed',
lambda obj: config.set('preferences.family-relation-type',
obj.get_active()))
lwidget = BasicLabel(_("%s: ") % _('Default family relationship'))
grid.attach(lwidget, 0, row, 1, 1)
grid.attach(obox, 1, row, 2, 1)

row += 1
# Status bar:
obox = Gtk.ComboBoxText()
Expand Down Expand Up @@ -1356,13 +1330,59 @@ def add_display_panel(self, configdialog):
'For example: <u><b>%s</b></u>\n'
'will display <u><b>Underlined bold date</b></u>.\n'))

row += 1
label = self.add_text(
grid, _("\nUser Input"), row,
line_wrap=True, start=0, stop=3, bold=True,
justify=Gtk.Justification.CENTER, align=Gtk.Align.CENTER)
label.set_margin_top(10)

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, 0, row, 1, 1)
grid.attach(obox, 1, row, 2, 1)

row += 1
# Surname guessing:
obox = Gtk.ComboBoxText()
formats = _surname_styles
list(map(obox.append_text, formats))
obox.set_active(config.get('behavior.surname-guessing'))
obox.connect('changed',
lambda obj: config.set('behavior.surname-guessing',
obj.get_active()))
lwidget = BasicLabel(_("%s: ") % _('Surname guessing'))
grid.attach(lwidget, 0, row, 1, 1)
grid.attach(obox, 1, row, 2, 1)

row += 1
# Default Family Relationship
obox = Gtk.ComboBoxText()
formats = FamilyRelType().get_standard_names()
list(map(obox.append_text, formats))
obox.set_active(config.get('preferences.family-relation-type'))
obox.connect('changed',
lambda obj: config.set('preferences.family-relation-type',
obj.get_active()))
lwidget = BasicLabel(_("%s: ") % _('Default family relationship'))
grid.attach(lwidget, 0, row, 1, 1)
grid.attach(obox, 1, row, 2, 1)

row += 1
label = self.add_text(
grid, _("* Requires Restart"), row,
line_wrap=True, start=0, stop=3)
line_wrap=True, bold=True, start=0, stop=3)
label.set_margin_top(10)

return _('Display'), grid
return _('Data'), grid

def auto_title_changed(self, obj):
"""
Expand Down Expand Up @@ -1481,6 +1501,12 @@ def date_calendar_changed(self, obj):
"""
config.set('preferences.calendar-format-report', obj.get_active())

def date_calendar_for_input_changed(self, obj):
"""
Save "Date calendar for input" option.
"""
config.set('preferences.calendar-format-input', obj.get_active())

def autobackup_changed(self, obj):
"""
Save "Autobackup" option on change.
Expand Down Expand Up @@ -1542,7 +1568,7 @@ def add_general_panel(self, configdialog):
"""
grid = self.create_grid()

self.add_text(grid, _("Startup Display"), 0,
self.add_text(grid, _("Gramps\'s Environment Display"), 0,
line_wrap=True, start=0, stop=3, bold=True,
justify=Gtk.Justification.CENTER, align=Gtk.Align.CENTER)
row = 1
Expand Down Expand Up @@ -1610,7 +1636,7 @@ def add_general_panel(self, configdialog):
row += 1
label = self.add_text(
grid, _("* Requires Restart"), row,
line_wrap=True, start=0, stop=3)
line_wrap=True, bold=True, start=0, stop=3)
label.set_margin_top(10)

return _('General'), grid
Expand Down

0 comments on commit e456286

Please sign in to comment.