From 3b16b6be79490f3580a7d1b8e418beb39565aa73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?syst=C3=A8me?= Date: Thu, 29 Dec 2016 07:53:44 +0100 Subject: [PATCH] 9851 --- gramps/gen/config.py | 2 ++ gramps/gen/display/place.py | 6 ++++- gramps/gui/configure.py | 33 +++++++++++++++++++++++ gramps/gui/views/treemodels/placemodel.py | 7 +++-- 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/gramps/gen/config.py b/gramps/gen/config.py index 098c9f6b7..64d61e274 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -250,6 +250,8 @@ register('preferences.place-number', False) register('preferences.place-reverse', False) register('preferences.place-restrict', 0) register('preferences.place-lang', '') +register('preferences.place-name-column', True) +register('preferences.place-separator', 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/display/place.py b/gramps/gen/display/place.py index dd5cff250..b9d3569e2 100644 --- a/gramps/gen/display/place.py +++ b/gramps/gen/display/place.py @@ -30,6 +30,8 @@ Class handling displaying of places. from ..config import config from ..utils.location import get_location_list from ..lib import PlaceType +from gramps.gen.const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext #------------------------------------------------------------------------- # @@ -80,7 +82,9 @@ class PlaceDisplay: if config.get('preferences.place-reverse'): names.reverse() - return ", ".join(names) + user_choice_number = config.get('preferences.place-separator') + entries = [_(", "), _("|"), _("/")] + return entries[user_choice_number].join(names) def _find_populated_place(places): populated_place = None diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index da941f4bc..963eac55e 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -1161,6 +1161,36 @@ class GrampsPreferences(ConfigureDialog): self.auto_title_changed(auto) + grid3 = Gtk.Grid() + grid3.set_border_width(12) + grid3.set_column_spacing(6) + grid3.set_row_spacing(6) + grid.attach(grid3, 1, 2, 1, 1) + + pnbox = self.add_checkbox( + grid3, + _("Display alternate place names on place view and selector"), + row, + 'preferences.place-name-column', + start=0) + row += 1 + + #self.add_entry(grid, _('Separator for hierarchy levels'), 7, + #'preferences.place-separator') + + sepbox = Gtk.ComboBoxText() + entries = [_(", "), _("|"), _("/")] + list(map(sepbox.append_text, entries)) + active = config.get('preferences.place-separator') + if active >= len(entries): + active = 0 + sepbox.set_active(active) + sepbox.connect('changed', self.place_separator_changed) + lwidget = BasicLabel(_("%s: ") % _('Separator for hierarchy levels')) + grid3.attach(lwidget, 0, row, 1, 1) + grid3.attach(sepbox, 1, row, 2, 1) + row += 1 + return _('Places'), grid def auto_title_changed(self, obj): @@ -1171,6 +1201,9 @@ class GrampsPreferences(ConfigureDialog): for widget in self.place_widgets: widget.set_sensitive(active) + def place_separator_changed(self, obj): + config.set('preferences.place-separator', obj.get_active()) + def add_text_panel(self, configdialog): row = 0 grid = Gtk.Grid() diff --git a/gramps/gui/views/treemodels/placemodel.py b/gramps/gui/views/treemodels/placemodel.py index a04e2748b..1de2619d6 100644 --- a/gramps/gui/views/treemodels/placemodel.py +++ b/gramps/gui/views/treemodels/placemodel.py @@ -48,6 +48,7 @@ from gramps.gen.lib import Place, PlaceType from gramps.gen.datehandler import format_time from gramps.gen.utils.place import conv_lat_lon from gramps.gen.display.place import displayer as place_displayer +from gramps.gen.config import config from .flatbasemodel import FlatBaseModel from .treebasemodel import TreeBaseModel @@ -126,8 +127,10 @@ class PlaceBaseModel: return value def column_name(self, data): - # need for spacing on the french translation - return _(',').join([data[6][0]] + [name[0] for name in data[7]]) + if config.get("preferences.place-name-column"): + return '|'.join([data[6][0]] + [name[0] for name in data[7]]) + else: + return data[6][0] def column_longitude(self, data): if not data[3]: