From 043ebaba651e4d27f52dadef45709751b316527d Mon Sep 17 00:00:00 2001 From: Sam Manzi Date: Fri, 30 Dec 2016 13:23:24 +1100 Subject: [PATCH] Change config keys to mention addon Renaming config keys to make their use clearer --- gramps/gen/config.py | 10 +++++----- gramps/gen/plug/utils.py | 12 ++++++------ gramps/gui/configure.py | 24 ++++++++++++------------ gramps/gui/plug/_windows.py | 8 ++++---- gramps/gui/viewmanager.py | 4 ++-- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/gramps/gen/config.py b/gramps/gen/config.py index 198717968..098c9f6b7 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -133,11 +133,11 @@ register('behavior.addmedia-relative-path', False) register('behavior.autoload', False) register('behavior.avg-generation-gap', 20) register('behavior.betawarn', False) -register('behavior.check-for-updates', 0) -register('behavior.check-for-update-types', ["new"]) -register('behavior.last-check-for-updates', "1970/01/01") -register('behavior.previously-seen-updates', []) -register('behavior.do-not-show-previously-seen-updates', True) +register('behavior.check-for-addon-updates', 0) +register('behavior.check-for-addon-update-types', ["new"]) +register('behavior.last-check-for-addon-updates', "1970/01/01") +register('behavior.previously-seen-addon-updates', []) +register('behavior.do-not-show-previously-seen-addon-updates', True) register('behavior.date-about-range', 50) register('behavior.date-after-range', 50) register('behavior.date-before-range', 50) diff --git a/gramps/gen/plug/utils.py b/gramps/gen/plug/utils.py index cb541a055..5750fe8e9 100644 --- a/gramps/gen/plug/utils.py +++ b/gramps/gen/plug/utils.py @@ -194,7 +194,7 @@ def urlopen_maybe_no_check_cert(URL): return fp def available_updates(): - whattypes = config.get('behavior.check-for-update-types') + whattypes = config.get('behavior.check-for-addon-update-types') LOG.debug("Checking for updated addons...") langs = glocale.get_language_list() @@ -245,8 +245,8 @@ def available_updates(): version_str_to_tup(plugin.version, 3)): LOG.debug(" Downloading '%s'..." % plugin_dict["z"]) if "update" in whattypes: - if (not config.get('behavior.do-not-show-previously-seen-updates') or - plugin_dict["i"] not in config.get('behavior.previously-seen-updates')): + if (not config.get('behavior.do-not-show-previously-seen-addon-updates') or + plugin_dict["i"] not in config.get('behavior.previously-seen-addon-updates')): addon_update_list.append((_("Updated"), "%s/download/%s" % (config.get("behavior.addons-url"), @@ -257,14 +257,14 @@ def available_updates(): else: LOG.debug(" '%s' is not installed" % plugin_dict["n"]) if "new" in whattypes: - if (not config.get('behavior.do-not-show-previously-seen-updates') or - plugin_dict["i"] not in config.get('behavior.previously-seen-updates')): + if (not config.get('behavior.do-not-show-previously-seen-addon-updates') or + plugin_dict["i"] not in config.get('behavior.previously-seen-addon-updates')): addon_update_list.append((_("updates|New"), "%s/download/%s" % (config.get("behavior.addons-url"), plugin_dict["z"]), plugin_dict)) - config.set("behavior.last-check-for-updates", + config.set("behavior.last-check-for-addon-updates", datetime.date.today().strftime("%Y/%m/%d")) count += 1 if fp: diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index e100ede5c..da941f4bc 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -1208,15 +1208,15 @@ class GrampsPreferences(ConfigureDialog): def check_for_type_changed(self, obj): active = obj.get_active() if active == 0: # update - config.set('behavior.check-for-update-types', ["update"]) + config.set('behavior.check-for-addon-update-types', ["update"]) elif active == 1: # update - config.set('behavior.check-for-update-types', ["new"]) + config.set('behavior.check-for-addon-update-types', ["new"]) elif active == 2: # update - config.set('behavior.check-for-update-types', ["update", "new"]) + config.set('behavior.check-for-addon-update-types', ["update", "new"]) def toggle_hide_previous_addons(self, obj): active = obj.get_active() - config.set('behavior.do-not-show-previously-seen-updates', + config.set('behavior.do-not-show-previously-seen-addon-updates', bool(active)) def toggle_tag_on_import(self, obj): @@ -1226,7 +1226,7 @@ class GrampsPreferences(ConfigureDialog): def check_for_updates_changed(self, obj): active = obj.get_active() - config.set('behavior.check-for-updates', active) + config.set('behavior.check-for-addon-updates', active) def place_restrict_changed(self, obj): active = obj.get_active() @@ -1361,7 +1361,7 @@ class GrampsPreferences(ConfigureDialog): self.set_mediapath, self.select_mediapath) current_line += 1 - # Check for updates: + # Check for addon updates: obox = Gtk.ComboBoxText() formats = [_("Never"), _("Once a month"), @@ -1369,10 +1369,10 @@ class GrampsPreferences(ConfigureDialog): _("Once a day"), _("Always"), ] list(map(obox.append_text, formats)) - active = config.get('behavior.check-for-updates') + active = config.get('behavior.check-for-addon-updates') obox.set_active(active) obox.connect('changed', self.check_for_updates_changed) - lwidget = BasicLabel(_("%s: ") % _('Check for updates')) + lwidget = BasicLabel(_("%s: ") % _('Check for addon updates')) grid.attach(lwidget, 1, current_line, 1, 1) grid.attach(obox, 2, current_line, 1, 1) @@ -1382,7 +1382,7 @@ class GrampsPreferences(ConfigureDialog): _("New addons only"), _("New and updated addons"),] list(map(self.whattype_box.append_text, formats)) - whattype = config.get('behavior.check-for-update-types') + whattype = config.get('behavior.check-for-addon-update-types') if "new" in whattype and "update" in whattype: self.whattype_box.set_active(2) elif "new" in whattype: @@ -1400,11 +1400,11 @@ class GrampsPreferences(ConfigureDialog): current_line += 1 checkbutton = Gtk.CheckButton( label=_("Do not ask about previously notified addons")) - checkbutton.set_active(config.get('behavior.do-not-show-previously-seen-updates')) + checkbutton.set_active(config.get('behavior.do-not-show-previously-seen-addon-updates')) checkbutton.connect("toggled", self.toggle_hide_previous_addons) grid.attach(checkbutton, 1, current_line, 1, 1) - button = Gtk.Button(label=_("Check now")) + button = Gtk.Button(label=_("Check for updated addons now")) button.connect("clicked", self.check_for_updates) grid.attach(button, 3, current_line, 1, 1) @@ -1423,7 +1423,7 @@ class GrampsPreferences(ConfigureDialog): if len(addon_update_list) > 0: PluginWindows.UpdateAddons(addon_update_list, self.window) else: - check_types = config.get('behavior.check-for-update-types') + check_types = config.get('behavior.check-for-addon-update-types') OkDialog( _("There are no available addons of this type"), _("Checked for '%s'") % diff --git a/gramps/gui/plug/_windows.py b/gramps/gui/plug/_windows.py index 71212fc33..9ae750f25 100644 --- a/gramps/gui/plug/_windows.py +++ b/gramps/gui/plug/_windows.py @@ -1179,9 +1179,9 @@ class UpdateAddons: ("Title", self.window, Gtk.DialogFlags.MODAL)) pm.add_op(longop) count = 0 - if not config.get('behavior.do-not-show-previously-seen-updates'): + if not config.get('behavior.do-not-show-previously-seen-addon-updates'): # reset list - config.get('behavior.previously-seen-updates')[:] = [] + config.get('behavior.previously-seen-addon-updates')[:] = [] iter = model.get_iter_first() errors = [] @@ -1198,8 +1198,8 @@ class UpdateAddons: else: errors.append(row[2]) else: # add to list of previously seen, but not installed - if row[5] not in config.get('behavior.previously-seen-updates'): - config.get('behavior.previously-seen-updates').append(row[5]) + if row[5] not in config.get('behavior.previously-seen-addon-updates'): + config.get('behavior.previously-seen-addon-updates').append(row[5]) longop.heartbeat() pm._get_dlg()._process_events() iter = model.iter_next(iter) diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index ebefb203a..50e94a2c1 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -322,11 +322,11 @@ class ViewManager(CLIManager): """ Check for add-on updates. """ - howoften = config.get("behavior.check-for-updates") + howoften = config.get("behavior.check-for-addon-updates") update = False if howoften != 0: # update never if zero year, mon, day = list(map( - int, config.get("behavior.last-check-for-updates").split("/"))) + int, config.get("behavior.last-check-for-addon-updates").split("/"))) days = (datetime.date.today() - datetime.date(year, mon, day)).days if howoften == 1 and days >= 30: # once a month update = True