From fec5a5dab03914d7db348d07f823d2fd06f674cd Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sun, 31 May 2015 11:01:06 +0100 Subject: [PATCH] Remove place format preference setting --- gramps/gen/config.py | 3 +-- gramps/gen/display/place.py | 17 +++-------------- gramps/gui/configure.py | 27 +++------------------------ gramps/gui/editors/editplace.py | 2 +- gramps/gui/editors/editplaceref.py | 2 +- gramps/gui/merge/mergeplace.py | 2 +- 6 files changed, 10 insertions(+), 43 deletions(-) diff --git a/gramps/gen/config.py b/gramps/gen/config.py index a36413b71..76a4092f0 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -292,8 +292,7 @@ register('preferences.hide-ep-msg', False) register('preferences.invalid-date-format', "%s") register('preferences.iprefix', 'I%04d') register('preferences.name-format', 1) -register('preferences.place-format', 0) -register('preferences.place-title', False) +register('preferences.place-auto', True) 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 8371e7537..a070884f5 100644 --- a/gramps/gen/display/place.py +++ b/gramps/gen/display/place.py @@ -27,14 +27,9 @@ Class handling displaying of places. # Gramps modules # #------------------------------------------------------------------------- +from ..config import config from ..utils.location import get_location_list -try: - from ..config import config - WITH_GRAMPS_CONFIG=True -except ImportError: - WITH_GRAMPS_CONFIG=False - #------------------------------------------------------------------------- # # PlaceDisplay class @@ -42,12 +37,6 @@ except ImportError: #------------------------------------------------------------------------- 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): if not event: return "" @@ -61,9 +50,9 @@ class PlaceDisplay(object): def display(self, db, place, date=None): if not place: return "" - if self.default_format == 0: + if not config.get('preferences.place-auto'): return place.title - elif self.default_format == 1: + else: names = [item[0] for item in get_location_list(db, place, date)] return ", ".join(names) diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index 2565a037e..1ddc3c7dc 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -998,24 +998,10 @@ class GrampsPreferences(ConfigureDialog): grid.attach(obox, 1, row, 2, 1) row += 1 - # Place format: - 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 + # Automatic place title generation self.add_checkbox(grid, - _("Display legacy place title field in editors"), - row, 'preferences.place-title', stop=3) + _("Enable automatic place title generation"), + row, 'preferences.place-auto', stop=3) row += 1 # Age precision: @@ -1179,13 +1165,6 @@ class GrampsPreferences(ConfigureDialog): 'effect until the next time Gramps is started.'), 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): config.set('preferences.calendar-format-report', obj.get_active()) diff --git a/gramps/gui/editors/editplace.py b/gramps/gui/editors/editplace.py index 5e7e4fd80..9bf84cbc3 100644 --- a/gramps/gui/editors/editplace.py +++ b/gramps/gui/editors/editplace.py @@ -105,7 +105,7 @@ class EditPlace(EditPrimary): 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_label").show() self.title = MonitoredEntry(self.top.get_object("place_title"), diff --git a/gramps/gui/editors/editplaceref.py b/gramps/gui/editors/editplaceref.py index 5238ea0b9..15b031ea3 100644 --- a/gramps/gui/editors/editplaceref.py +++ b/gramps/gui/editors/editplaceref.py @@ -105,7 +105,7 @@ class EditPlaceRef(EditReference): self.uistate, self.track, 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_label").show() self.title = MonitoredEntry(self.top.get_object("place_title"), diff --git a/gramps/gui/merge/mergeplace.py b/gramps/gui/merge/mergeplace.py index 86b24e66a..5507b9927 100644 --- a/gramps/gui/merge/mergeplace.py +++ b/gramps/gui/merge/mergeplace.py @@ -78,7 +78,7 @@ class MergePlace(ManagedWindow): _("Merge Places")) # Detailed selection widgets - if config.get('preferences.place-title'): + if not config.get('preferences.place-auto'): title1 = self.pl1.get_title() title2 = self.pl2.get_title() entry1 = self.get_widget("title1")