This commit is contained in:
système 2016-12-29 07:53:44 +01:00
parent 998c5f4bee
commit 3b16b6be79
4 changed files with 45 additions and 3 deletions

View File

@ -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"))

View File

@ -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

View File

@ -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()

View File

@ -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]: