Remove place format preference setting

This commit is contained in:
Nick Hall
2015-05-31 11:01:06 +01:00
parent 966551385b
commit fec5a5dab0
6 changed files with 10 additions and 43 deletions

View File

@ -292,8 +292,7 @@ register('preferences.hide-ep-msg', False)
register('preferences.invalid-date-format', "<b>%s</b>") register('preferences.invalid-date-format', "<b>%s</b>")
register('preferences.iprefix', 'I%04d') register('preferences.iprefix', 'I%04d')
register('preferences.name-format', 1) register('preferences.name-format', 1)
register('preferences.place-format', 0) register('preferences.place-auto', True)
register('preferences.place-title', False)
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

@ -27,14 +27,9 @@ Class handling displaying of places.
# Gramps modules # Gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from ..config import config
from ..utils.location import get_location_list from ..utils.location import get_location_list
try:
from ..config import config
WITH_GRAMPS_CONFIG=True
except ImportError:
WITH_GRAMPS_CONFIG=False
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# PlaceDisplay class # PlaceDisplay class
@ -42,12 +37,6 @@ except ImportError:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class PlaceDisplay(object): class PlaceDisplay(object):
def __init__(self):
if WITH_GRAMPS_CONFIG:
self.default_format = config.get('preferences.place-format')
else:
self.default_format = 0
def display_event(self, db, event): def display_event(self, db, event):
if not event: if not event:
return "" return ""
@ -61,9 +50,9 @@ class PlaceDisplay(object):
def display(self, db, place, date=None): def display(self, db, place, date=None):
if not place: if not place:
return "" return ""
if self.default_format == 0: if not config.get('preferences.place-auto'):
return place.title return place.title
elif self.default_format == 1: else:
names = [item[0] for item in get_location_list(db, place, date)] names = [item[0] for item in get_location_list(db, place, date)]
return ", ".join(names) return ", ".join(names)

View File

@ -998,24 +998,10 @@ class GrampsPreferences(ConfigureDialog):
grid.attach(obox, 1, row, 2, 1) grid.attach(obox, 1, row, 2, 1)
row += 1 row += 1
# Place format: # Automatic place title generation
obox = Gtk.ComboBoxText()
formats = [_('Title'), _('Automatic')]
list(map(obox.append_text, formats))
active = config.get('preferences.place-format')
if active >= len(formats):
active = 0
obox.set_active(active)
obox.connect('changed', self.place_format_changed)
lwidget = BasicLabel("%s: " % _('Place format'))
grid.attach(lwidget, 0, row, 1, 1)
grid.attach(obox, 1, row, 2, 1)
row += 1
# Legacy place title mode
self.add_checkbox(grid, self.add_checkbox(grid,
_("Display legacy place title field in editors"), _("Enable automatic place title generation"),
row, 'preferences.place-title', stop=3) row, 'preferences.place-auto', stop=3)
row += 1 row += 1
# Age precision: # Age precision:
@ -1179,13 +1165,6 @@ class GrampsPreferences(ConfigureDialog):
'effect until the next time Gramps is started.'), 'effect until the next time Gramps is started.'),
parent=self.window) parent=self.window)
def place_format_changed(self, obj):
config.set('preferences.place-format', obj.get_active())
OkDialog(_('Change is not immediate'),
_('Changing the place format will not take '
'effect until the next time Gramps is started.'),
parent=self.window)
def date_calendar_changed(self, obj): def date_calendar_changed(self, obj):
config.set('preferences.calendar-format-report', obj.get_active()) config.set('preferences.calendar-format-report', obj.get_active())

View File

@ -105,7 +105,7 @@ class EditPlace(EditPrimary):
def _setup_fields(self): def _setup_fields(self):
if config.get('preferences.place-title'): if not config.get('preferences.place-auto'):
self.top.get_object("place_title").show() self.top.get_object("place_title").show()
self.top.get_object("place_title_label").show() self.top.get_object("place_title_label").show()
self.title = MonitoredEntry(self.top.get_object("place_title"), self.title = MonitoredEntry(self.top.get_object("place_title"),

View File

@ -105,7 +105,7 @@ class EditPlaceRef(EditReference):
self.uistate, self.track, self.uistate, self.track,
self.db.readonly) self.db.readonly)
if config.get('preferences.place-title'): if not config.get('preferences.place-auto'):
self.top.get_object("place_title").show() self.top.get_object("place_title").show()
self.top.get_object("place_title_label").show() self.top.get_object("place_title_label").show()
self.title = MonitoredEntry(self.top.get_object("place_title"), self.title = MonitoredEntry(self.top.get_object("place_title"),

View File

@ -78,7 +78,7 @@ class MergePlace(ManagedWindow):
_("Merge Places")) _("Merge Places"))
# Detailed selection widgets # Detailed selection widgets
if config.get('preferences.place-title'): if not config.get('preferences.place-auto'):
title1 = self.pl1.get_title() title1 = self.pl1.get_title()
title2 = self.pl2.get_title() title2 = self.pl2.get_title()
entry1 = self.get_widget("title1") entry1 = self.get_widget("title1")