From b70087fd78c560794536efb3833225692513726b Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Tue, 23 May 2023 13:43:36 +0200 Subject: [PATCH] Add coordinates format with description Fixes #11248 --- gramps/gen/config.py | 1 + gramps/gen/plug/report/stdoptions.py | 6 +++--- gramps/gen/utils/place.py | 7 +++++++ gramps/gui/configure.py | 8 +++----- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/gramps/gen/config.py b/gramps/gen/config.py index faf9e11b3ca..6ea404ab85b 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -263,6 +263,7 @@ def emit(key): register('preferences.name-format', 1) register('preferences.place-format', 0) register('preferences.place-auto', True) +register('preferences.coord-format', 0) register('preferences.patronimic-surname', False) register('preferences.no-given-text', "[%s]" % _("Missing Given Name")) register('preferences.no-record-text', "[%s]" % _("Missing Record")) diff --git a/gramps/gen/plug/report/stdoptions.py b/gramps/gen/plug/report/stdoptions.py index 638dcd050d8..a712c76252b 100644 --- a/gramps/gen/plug/report/stdoptions.py +++ b/gramps/gen/plug/report/stdoptions.py @@ -37,7 +37,7 @@ from ...proxy import PrivateProxyDb, LivingProxyDb from ...utils.grampslocale import GrampsLocale 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 # _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 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): - 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")) menu.add_option(category, "coord_format", coord_format) return coord_format diff --git a/gramps/gen/utils/place.py b/gramps/gen/utils/place.py index 82622f22bd5..df8e39f040c 100644 --- a/gramps/gen/utils/place.py +++ b/gramps/gen/utils/place.py @@ -98,6 +98,13 @@ def _T_(value, context=''): # enable deferred translations # '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"), + ) #------------------ # diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index 0405700d164..8d45c8bc2ad 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -57,7 +57,7 @@ from gramps.gen.display.place import displayer as _pd from gramps.gen.utils.alive import update_constants 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, get_translation_from_keyword, get_keyword_from_translation) @@ -1145,8 +1145,8 @@ def cb_coord_fmt_rebuild(self): Called to rebuild the coordinates format list. """ model = Gtk.ListStore(str) - for fmt in coord_formats: - model.append([fmt]) + for number, fmt in enumerate(coord_formats): + model.append([fmt + '\t' + coord_formats_desc[number]]) self.cformat.set_model(model) self.cformat.set_active(0) @@ -1244,8 +1244,6 @@ def add_data_panel(self, configdialog): self.cformat.pack_start(renderer, True) self.cformat.add_attribute(renderer, "text", 0) 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') self.cformat.set_active(active) self.cformat.connect('changed', self.cb_coord_fmt_changed)