Add coordinates format with description

Fixes #11248
This commit is contained in:
SNoiraud 2023-05-23 13:43:36 +02:00 committed by Nick Hall
parent 974d4bae18
commit b70087fd78
4 changed files with 14 additions and 8 deletions

View File

@ -263,6 +263,7 @@ register('preferences.iprefix', 'I%04d')
register('preferences.name-format', 1) register('preferences.name-format', 1)
register('preferences.place-format', 0) register('preferences.place-format', 0)
register('preferences.place-auto', True) register('preferences.place-auto', True)
register('preferences.coord-format', 0)
register('preferences.patronimic-surname', False) register('preferences.patronimic-surname', False)
register('preferences.no-given-text', "[%s]" % _("Missing Given Name")) register('preferences.no-given-text', "[%s]" % _("Missing Given Name"))
register('preferences.no-record-text', "[%s]" % _("Missing Record")) register('preferences.no-record-text', "[%s]" % _("Missing Record"))

View File

@ -37,7 +37,7 @@ from ..menu import EnumeratedListOption, BooleanOption, NumberOption
from ...proxy import PrivateProxyDb, LivingProxyDb from ...proxy import PrivateProxyDb, LivingProxyDb
from ...utils.grampslocale import GrampsLocale from ...utils.grampslocale import GrampsLocale
from ...const import GRAMPS_LOCALE as glocale from ...const import GRAMPS_LOCALE as glocale
from ...utils.place import coord_formats from ...utils.place import coord_formats, coord_formats_desc
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
# _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh # _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh
@ -383,9 +383,9 @@ def add_coordinates_format_option(menu, category):
Insert an option for changing the report's coordinates format to a Insert an option for changing the report's coordinates format to a
report-specific format instead of the user's Edit=>Preferences choice report-specific format instead of the user's Edit=>Preferences choice
""" """
coord_format = EnumeratedListOption(_("Coordinates format"), -1) coord_format = EnumeratedListOption(_("Coordinates format"), 0)
for number, fmt in enumerate(coord_formats): for number, fmt in enumerate(coord_formats):
coord_format.add_item(number, fmt) coord_format.add_item(number, fmt + '\t' + coord_formats_desc[number])
coord_format.set_help(_("Select the format to display coordinates")) coord_format.set_help(_("Select the format to display coordinates"))
menu.add_option(category, "coord_format", coord_format) menu.add_option(category, "coord_format", coord_format)
return coord_format return coord_format

View File

@ -98,6 +98,13 @@ coord_formats = (
# 'ISO-DMS' ISO 6709 degree, minutes, seconds notation # 'ISO-DMS' ISO 6709 degree, minutes, seconds notation
) )
coord_formats_desc = (
_("Degree, minutes, seconds notation"),
_("Degree, minutes, seconds notation with :"),
_("Degree notation, 4 decimals"),
_("Degree notation, 8 decimals (precision like ISO-DMS)"),
_("Output format for the Swedish coordinate system RT90"),
)
#------------------ #------------------
# #

View File

@ -57,7 +57,7 @@ from gramps.gen.display.name import NameDisplayError
from gramps.gen.display.place import displayer as _pd from gramps.gen.display.place import displayer as _pd
from gramps.gen.utils.alive import update_constants from gramps.gen.utils.alive import update_constants
from gramps.gen.utils.file import media_path from gramps.gen.utils.file import media_path
from gramps.gen.utils.place import coord_formats from gramps.gen.utils.place import coord_formats, coord_formats_desc
from gramps.gen.utils.keyword import (get_keywords, get_translations, from gramps.gen.utils.keyword import (get_keywords, get_translations,
get_translation_from_keyword, get_translation_from_keyword,
get_keyword_from_translation) get_keyword_from_translation)
@ -1145,8 +1145,8 @@ class GrampsPreferences(ConfigureDialog):
Called to rebuild the coordinates format list. Called to rebuild the coordinates format list.
""" """
model = Gtk.ListStore(str) model = Gtk.ListStore(str)
for fmt in coord_formats: for number, fmt in enumerate(coord_formats):
model.append([fmt]) model.append([fmt + '\t' + coord_formats_desc[number]])
self.cformat.set_model(model) self.cformat.set_model(model)
self.cformat.set_active(0) self.cformat.set_active(0)
@ -1244,8 +1244,6 @@ class GrampsPreferences(ConfigureDialog):
self.cformat.pack_start(renderer, True) self.cformat.pack_start(renderer, True)
self.cformat.add_attribute(renderer, "text", 0) self.cformat.add_attribute(renderer, "text", 0)
self.cb_coord_fmt_rebuild() self.cb_coord_fmt_rebuild()
if not config.is_set('preferences.coord-format'):
config.register('preferences.coord-format', 0)
active = config.get('preferences.coord-format') active = config.get('preferences.coord-format')
self.cformat.set_active(active) self.cformat.set_active(active)
self.cformat.connect('changed', self.cb_coord_fmt_changed) self.cformat.connect('changed', self.cb_coord_fmt_changed)