Merge pull request #306 from sam-m888/ChangeConfigKeysForAddons

Change config keys to mention addon
This commit is contained in:
Sam Manzi 2016-12-30 13:38:26 +11:00 committed by GitHub
commit dde84ed8bc
5 changed files with 29 additions and 29 deletions

View File

@ -133,11 +133,11 @@ register('behavior.addmedia-relative-path', False)
register('behavior.autoload', False) register('behavior.autoload', False)
register('behavior.avg-generation-gap', 20) register('behavior.avg-generation-gap', 20)
register('behavior.betawarn', False) register('behavior.betawarn', False)
register('behavior.check-for-updates', 0) register('behavior.check-for-addon-updates', 0)
register('behavior.check-for-update-types', ["new"]) register('behavior.check-for-addon-update-types', ["new"])
register('behavior.last-check-for-updates', "1970/01/01") register('behavior.last-check-for-addon-updates', "1970/01/01")
register('behavior.previously-seen-updates', []) register('behavior.previously-seen-addon-updates', [])
register('behavior.do-not-show-previously-seen-updates', True) register('behavior.do-not-show-previously-seen-addon-updates', True)
register('behavior.date-about-range', 50) register('behavior.date-about-range', 50)
register('behavior.date-after-range', 50) register('behavior.date-after-range', 50)
register('behavior.date-before-range', 50) register('behavior.date-before-range', 50)

View File

@ -194,7 +194,7 @@ def urlopen_maybe_no_check_cert(URL):
return fp return fp
def available_updates(): 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...") LOG.debug("Checking for updated addons...")
langs = glocale.get_language_list() langs = glocale.get_language_list()
@ -245,8 +245,8 @@ def available_updates():
version_str_to_tup(plugin.version, 3)): version_str_to_tup(plugin.version, 3)):
LOG.debug(" Downloading '%s'..." % plugin_dict["z"]) LOG.debug(" Downloading '%s'..." % plugin_dict["z"])
if "update" in whattypes: if "update" in whattypes:
if (not config.get('behavior.do-not-show-previously-seen-updates') or if (not config.get('behavior.do-not-show-previously-seen-addon-updates') or
plugin_dict["i"] not in config.get('behavior.previously-seen-updates')): plugin_dict["i"] not in config.get('behavior.previously-seen-addon-updates')):
addon_update_list.append((_("Updated"), addon_update_list.append((_("Updated"),
"%s/download/%s" % "%s/download/%s" %
(config.get("behavior.addons-url"), (config.get("behavior.addons-url"),
@ -257,14 +257,14 @@ def available_updates():
else: else:
LOG.debug(" '%s' is not installed" % plugin_dict["n"]) LOG.debug(" '%s' is not installed" % plugin_dict["n"])
if "new" in whattypes: if "new" in whattypes:
if (not config.get('behavior.do-not-show-previously-seen-updates') or if (not config.get('behavior.do-not-show-previously-seen-addon-updates') or
plugin_dict["i"] not in config.get('behavior.previously-seen-updates')): plugin_dict["i"] not in config.get('behavior.previously-seen-addon-updates')):
addon_update_list.append((_("updates|New"), addon_update_list.append((_("updates|New"),
"%s/download/%s" % "%s/download/%s" %
(config.get("behavior.addons-url"), (config.get("behavior.addons-url"),
plugin_dict["z"]), plugin_dict["z"]),
plugin_dict)) plugin_dict))
config.set("behavior.last-check-for-updates", config.set("behavior.last-check-for-addon-updates",
datetime.date.today().strftime("%Y/%m/%d")) datetime.date.today().strftime("%Y/%m/%d"))
count += 1 count += 1
if fp: if fp:

View File

@ -1208,15 +1208,15 @@ class GrampsPreferences(ConfigureDialog):
def check_for_type_changed(self, obj): def check_for_type_changed(self, obj):
active = obj.get_active() active = obj.get_active()
if active == 0: # update 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 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 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): def toggle_hide_previous_addons(self, obj):
active = obj.get_active() 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)) bool(active))
def toggle_tag_on_import(self, obj): def toggle_tag_on_import(self, obj):
@ -1226,7 +1226,7 @@ class GrampsPreferences(ConfigureDialog):
def check_for_updates_changed(self, obj): def check_for_updates_changed(self, obj):
active = obj.get_active() 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): def place_restrict_changed(self, obj):
active = obj.get_active() active = obj.get_active()
@ -1361,7 +1361,7 @@ class GrampsPreferences(ConfigureDialog):
self.set_mediapath, self.select_mediapath) self.set_mediapath, self.select_mediapath)
current_line += 1 current_line += 1
# Check for updates: # Check for addon updates:
obox = Gtk.ComboBoxText() obox = Gtk.ComboBoxText()
formats = [_("Never"), formats = [_("Never"),
_("Once a month"), _("Once a month"),
@ -1369,10 +1369,10 @@ class GrampsPreferences(ConfigureDialog):
_("Once a day"), _("Once a day"),
_("Always"), ] _("Always"), ]
list(map(obox.append_text, formats)) 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.set_active(active)
obox.connect('changed', self.check_for_updates_changed) 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(lwidget, 1, current_line, 1, 1)
grid.attach(obox, 2, current_line, 1, 1) grid.attach(obox, 2, current_line, 1, 1)
@ -1382,7 +1382,7 @@ class GrampsPreferences(ConfigureDialog):
_("New addons only"), _("New addons only"),
_("New and updated addons"),] _("New and updated addons"),]
list(map(self.whattype_box.append_text, formats)) 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: if "new" in whattype and "update" in whattype:
self.whattype_box.set_active(2) self.whattype_box.set_active(2)
elif "new" in whattype: elif "new" in whattype:
@ -1400,11 +1400,11 @@ class GrampsPreferences(ConfigureDialog):
current_line += 1 current_line += 1
checkbutton = Gtk.CheckButton( checkbutton = Gtk.CheckButton(
label=_("Do not ask about previously notified addons")) 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) checkbutton.connect("toggled", self.toggle_hide_previous_addons)
grid.attach(checkbutton, 1, current_line, 1, 1) 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) button.connect("clicked", self.check_for_updates)
grid.attach(button, 3, current_line, 1, 1) grid.attach(button, 3, current_line, 1, 1)
@ -1423,7 +1423,7 @@ class GrampsPreferences(ConfigureDialog):
if len(addon_update_list) > 0: if len(addon_update_list) > 0:
PluginWindows.UpdateAddons(addon_update_list, self.window) PluginWindows.UpdateAddons(addon_update_list, self.window)
else: else:
check_types = config.get('behavior.check-for-update-types') check_types = config.get('behavior.check-for-addon-update-types')
OkDialog( OkDialog(
_("There are no available addons of this type"), _("There are no available addons of this type"),
_("Checked for '%s'") % _("Checked for '%s'") %

View File

@ -1179,9 +1179,9 @@ class UpdateAddons:
("Title", self.window, Gtk.DialogFlags.MODAL)) ("Title", self.window, Gtk.DialogFlags.MODAL))
pm.add_op(longop) pm.add_op(longop)
count = 0 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 # reset list
config.get('behavior.previously-seen-updates')[:] = [] config.get('behavior.previously-seen-addon-updates')[:] = []
iter = model.get_iter_first() iter = model.get_iter_first()
errors = [] errors = []
@ -1198,8 +1198,8 @@ class UpdateAddons:
else: else:
errors.append(row[2]) errors.append(row[2])
else: # add to list of previously seen, but not installed else: # add to list of previously seen, but not installed
if row[5] not in config.get('behavior.previously-seen-updates'): if row[5] not in config.get('behavior.previously-seen-addon-updates'):
config.get('behavior.previously-seen-updates').append(row[5]) config.get('behavior.previously-seen-addon-updates').append(row[5])
longop.heartbeat() longop.heartbeat()
pm._get_dlg()._process_events() pm._get_dlg()._process_events()
iter = model.iter_next(iter) iter = model.iter_next(iter)

View File

@ -322,11 +322,11 @@ class ViewManager(CLIManager):
""" """
Check for add-on updates. Check for add-on updates.
""" """
howoften = config.get("behavior.check-for-updates") howoften = config.get("behavior.check-for-addon-updates")
update = False update = False
if howoften != 0: # update never if zero if howoften != 0: # update never if zero
year, mon, day = list(map( 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 days = (datetime.date.today() - datetime.date(year, mon, day)).days
if howoften == 1 and days >= 30: # once a month if howoften == 1 and days >= 30: # once a month
update = True update = True