Skip to content

Commit

Permalink
Add coordinates format with description
Browse files Browse the repository at this point in the history
Fixes #11248
  • Loading branch information
SNoiraud authored and Nick-Hall committed Jul 24, 2023
1 parent 974d4ba commit b70087f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions gramps/gen/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
6 changes: 3 additions & 3 deletions gramps/gen/plug/report/stdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
7 changes: 7 additions & 0 deletions gramps/gen/utils/place.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)

#------------------
#
Expand Down
8 changes: 3 additions & 5 deletions gramps/gui/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b70087f

Please sign in to comment.