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.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)

View File

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

View File

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

View File

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

View File

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