Added option of what addons to check (new, updated, or both)
svn: r15727
This commit is contained in:
@@ -128,6 +128,7 @@ 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-updates', 0)
|
||||||
|
register('behavior.check-for-update-types', ["update"])
|
||||||
register('behavior.last-check-for-updates', "1970/01/01")
|
register('behavior.last-check-for-updates', "1970/01/01")
|
||||||
register('behavior.database-path', os.path.join( const.HOME_DIR, 'grampsdb'))
|
register('behavior.database-path', os.path.join( const.HOME_DIR, 'grampsdb'))
|
||||||
register('behavior.date-about-range', 50)
|
register('behavior.date-about-range', 50)
|
||||||
|
@@ -970,8 +970,18 @@ class GrampsPreferences(ConfigureDialog):
|
|||||||
self.old_format = the_list.get_value(the_iter, COL_FMT)
|
self.old_format = the_list.get_value(the_iter, COL_FMT)
|
||||||
win = DisplayNameEditor(self.uistate, self.dbstate, self.track, self)
|
win = DisplayNameEditor(self.uistate, self.dbstate, self.track, self)
|
||||||
|
|
||||||
|
def check_for_type_changed(self, obj):
|
||||||
|
active = obj.get_active()
|
||||||
|
if active == 0: # update
|
||||||
|
config.set('behavior.check-for-update-types', ["update"])
|
||||||
|
elif active == 1: # update
|
||||||
|
config.set('behavior.check-for-update-types', ["new"])
|
||||||
|
elif active == 2: # update
|
||||||
|
config.set('behavior.check-for-update-types', ["update", "new"])
|
||||||
|
|
||||||
def check_for_updates_changed(self, obj):
|
def check_for_updates_changed(self, obj):
|
||||||
config.set('behavior.check-for-updates', obj.get_active())
|
active = obj.get_active()
|
||||||
|
config.set('behavior.check-for-updates', active)
|
||||||
|
|
||||||
def date_format_changed(self, obj):
|
def date_format_changed(self, obj):
|
||||||
config.set('preferences.date-format', obj.get_active())
|
config.set('preferences.date-format', obj.get_active())
|
||||||
@@ -1057,6 +1067,28 @@ class GrampsPreferences(ConfigureDialog):
|
|||||||
table.attach(lwidget, 1, 2, 6, 7, yoptions=0)
|
table.attach(lwidget, 1, 2, 6, 7, yoptions=0)
|
||||||
table.attach(obox, 2, 4, 6, 7, yoptions=0)
|
table.attach(obox, 2, 4, 6, 7, yoptions=0)
|
||||||
|
|
||||||
|
self.whattype_box = gtk.combo_box_new_text()
|
||||||
|
formats = [_("Updated addons only"),
|
||||||
|
_("New addons only"),
|
||||||
|
_("New and updated addons"),]
|
||||||
|
map(self.whattype_box.append_text, formats)
|
||||||
|
whattype = config.get('behavior.check-for-update-types')
|
||||||
|
if "new" in whattype and "update" in whattype:
|
||||||
|
self.whattype_box.set_active(2)
|
||||||
|
elif "new" in whattype:
|
||||||
|
self.whattype_box.set_active(1)
|
||||||
|
elif "update" in whattype:
|
||||||
|
self.whattype_box.set_active(0)
|
||||||
|
self.whattype_box.connect('changed', self.check_for_type_changed)
|
||||||
|
lwidget = BasicLabel("%s: " % _('What to check'))
|
||||||
|
table.attach(lwidget, 1, 2, 7, 8, yoptions=0)
|
||||||
|
table.attach(self.whattype_box, 2, 3, 7, 8, yoptions=0)
|
||||||
|
|
||||||
|
button = gtk.Button(_("Check now"))
|
||||||
|
button.connect("clicked", lambda obj: \
|
||||||
|
self.uistate.viewmanager.check_for_updates(force=True))
|
||||||
|
table.attach(button, 3, 4, 7, 8, yoptions=0)
|
||||||
|
|
||||||
return _('General'), table
|
return _('General'), table
|
||||||
|
|
||||||
def add_database_panel(self, configdialog):
|
def add_database_panel(self, configdialog):
|
||||||
|
@@ -275,12 +275,15 @@ class ViewManager(CLIManager):
|
|||||||
# Need to call after plugins have been registered
|
# Need to call after plugins have been registered
|
||||||
self.check_for_updates()
|
self.check_for_updates()
|
||||||
|
|
||||||
def check_for_updates(self):
|
def check_for_updates(self, force=False):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
howoften = config.get("behavior.check-for-updates")
|
howoften = config.get("behavior.check-for-updates")
|
||||||
|
whattypes = config.get('behavior.check-for-update-types')
|
||||||
update = False
|
update = False
|
||||||
if howoften != 0: # update never if zero
|
if force:
|
||||||
|
update = True
|
||||||
|
elif howoften != 0: # update never if zero
|
||||||
y,m,d = map(int,
|
y,m,d = map(int,
|
||||||
config.get("behavior.last-check-for-updates").split("/"))
|
config.get("behavior.last-check-for-updates").split("/"))
|
||||||
days = (datetime.date.today() - datetime.date(y, m, d)).days
|
days = (datetime.date.today() - datetime.date(y, m, d)).days
|
||||||
@@ -333,20 +336,22 @@ class ViewManager(CLIManager):
|
|||||||
if (version_str_to_tup(plugin_dict["v"], 3) >
|
if (version_str_to_tup(plugin_dict["v"], 3) >
|
||||||
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"])
|
||||||
addon_update_list.append(("update",
|
if "update" in whattypes:
|
||||||
"%s/download/%s" %
|
addon_update_list.append(("update",
|
||||||
(ADDONS_URL,
|
"%s/download/%s" %
|
||||||
plugin_dict["z"]),
|
(ADDONS_URL,
|
||||||
plugin_dict))
|
plugin_dict["z"]),
|
||||||
|
plugin_dict))
|
||||||
else:
|
else:
|
||||||
LOG.debug(" '%s' is ok" % plugin_dict["n"])
|
LOG.debug(" '%s' is ok" % plugin_dict["n"])
|
||||||
else:
|
else:
|
||||||
LOG.debug(" '%s' is not installed" % plugin_dict["n"])
|
LOG.debug(" '%s' is not installed" % plugin_dict["n"])
|
||||||
#addon_update_list.append(("new",
|
if "new" in whattypes:
|
||||||
# "%s/download/%s" %
|
addon_update_list.append(("new",
|
||||||
# (ADDONS_URL,
|
"%s/download/%s" %
|
||||||
# plugin_dict["z"]),
|
(ADDONS_URL,
|
||||||
# plugin_dict))
|
plugin_dict["z"]),
|
||||||
|
plugin_dict))
|
||||||
config.set("behavior.last-check-for-updates",
|
config.set("behavior.last-check-for-updates",
|
||||||
datetime.date.today().strftime("%Y/%m/%d"))
|
datetime.date.today().strftime("%Y/%m/%d"))
|
||||||
if fp:
|
if fp:
|
||||||
|
Reference in New Issue
Block a user