Do not show previously notified addons
svn: r15772
This commit is contained in:
parent
0fa7b97cf9
commit
88a4bbb926
@ -130,6 +130,8 @@ register('behavior.betawarn', False)
|
|||||||
register('behavior.check-for-updates', 2)
|
register('behavior.check-for-updates', 2)
|
||||||
register('behavior.check-for-update-types', ["update", "new"])
|
register('behavior.check-for-update-types', ["update", "new"])
|
||||||
register('behavior.last-check-for-updates', "1970/01/01")
|
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.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)
|
||||||
register('behavior.date-after-range', 50)
|
register('behavior.date-after-range', 50)
|
||||||
|
@ -979,6 +979,11 @@ class GrampsPreferences(ConfigureDialog):
|
|||||||
elif active == 2: # update
|
elif active == 2: # update
|
||||||
config.set('behavior.check-for-update-types', ["update", "new"])
|
config.set('behavior.check-for-update-types', ["update", "new"])
|
||||||
|
|
||||||
|
def toggle_hide_previous_addons(self, obj):
|
||||||
|
active = obj.get_active()
|
||||||
|
config.set('behavior.do-not-show-previously-seen-updates',
|
||||||
|
bool(active))
|
||||||
|
|
||||||
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-updates', active)
|
||||||
@ -1084,10 +1089,16 @@ class GrampsPreferences(ConfigureDialog):
|
|||||||
table.attach(lwidget, 1, 2, 7, 8, yoptions=0)
|
table.attach(lwidget, 1, 2, 7, 8, yoptions=0)
|
||||||
table.attach(self.whattype_box, 2, 3, 7, 8, yoptions=0)
|
table.attach(self.whattype_box, 2, 3, 7, 8, yoptions=0)
|
||||||
|
|
||||||
|
checkbutton = gtk.CheckButton(
|
||||||
|
_("Do not ask about previously notified addons"))
|
||||||
|
checkbutton.set_active(config.get('behavior.do-not-show-previously-seen-updates'))
|
||||||
|
checkbutton.connect("toggled", self.toggle_hide_previous_addons)
|
||||||
|
|
||||||
|
table.attach(checkbutton, 0, 3, 8, 9, yoptions=0)
|
||||||
button = gtk.Button(_("Check now"))
|
button = gtk.Button(_("Check now"))
|
||||||
button.connect("clicked", lambda obj: \
|
button.connect("clicked", lambda obj: \
|
||||||
self.uistate.viewmanager.check_for_updates(force=True))
|
self.uistate.viewmanager.check_for_updates(force=True))
|
||||||
table.attach(button, 3, 4, 7, 8, yoptions=0)
|
table.attach(button, 3, 4, 8, 9, yoptions=0)
|
||||||
|
|
||||||
return _('General'), table
|
return _('General'), table
|
||||||
|
|
||||||
|
@ -342,21 +342,27 @@ class ViewManager(CLIManager):
|
|||||||
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:
|
||||||
addon_update_list.append(("Updated",
|
if ((not config.get('behavior.do-not-show-previously-seen-updates')) or
|
||||||
"%s/download/%s" %
|
(config.get('behavior.do-not-show-previously-seen-updates') and
|
||||||
(ADDONS_URL,
|
plugin_dict["i"] not in config.get('behavior.previously-seen-updates'))):
|
||||||
plugin_dict["z"]),
|
addon_update_list.append(("Updated",
|
||||||
plugin_dict))
|
"%s/download/%s" %
|
||||||
|
(ADDONS_URL,
|
||||||
|
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"])
|
||||||
if "new" in whattypes:
|
if "new" in whattypes:
|
||||||
addon_update_list.append(("New",
|
if ((not config.get('behavior.do-not-show-previously-seen-updates')) or
|
||||||
"%s/download/%s" %
|
(config.get('behavior.do-not-show-previously-seen-updates') and
|
||||||
(ADDONS_URL,
|
plugin_dict["i"] not in config.get('behavior.previously-seen-updates'))):
|
||||||
plugin_dict["z"]),
|
addon_update_list.append(("New",
|
||||||
plugin_dict))
|
"%s/download/%s" %
|
||||||
|
(ADDONS_URL,
|
||||||
|
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"))
|
||||||
count += 1
|
count += 1
|
||||||
@ -372,7 +378,6 @@ class ViewManager(CLIManager):
|
|||||||
_("' and '").join(config.get('behavior.check-for-update-types')),
|
_("' and '").join(config.get('behavior.check-for-update-types')),
|
||||||
self.window)
|
self.window)
|
||||||
|
|
||||||
|
|
||||||
def update_addons(self, addon_update_list):
|
def update_addons(self, addon_update_list):
|
||||||
from glade import Glade
|
from glade import Glade
|
||||||
import ManagedWindow
|
import ManagedWindow
|
||||||
@ -392,13 +397,14 @@ class ViewManager(CLIManager):
|
|||||||
cancel_button.connect("clicked",
|
cancel_button.connect("clicked",
|
||||||
lambda obj: self.update_dialog.destroy())
|
lambda obj: self.update_dialog.destroy())
|
||||||
self.list = ListModel.ListModel(glade.get_object("list"),
|
self.list = ListModel.ListModel(glade.get_object("list"),
|
||||||
[
|
[
|
||||||
# name, click?, width, toggle
|
# name, click?, width, toggle
|
||||||
(_('Select'), -1, 60, 1),
|
(_('Select'), -1, 60, 1), # 0 selected?
|
||||||
(_('Type'), 1, 120),
|
(_('Type'), 1, 120), # 1 new gramplet
|
||||||
(_('Name'), 1, 200),
|
(_('Name'), 1, 200), # 2 name (version)
|
||||||
(_('Description'), 1, 200),
|
(_('Description'), 1, 200), # 3 description
|
||||||
('', 1, 0),
|
('', 1, 0), # 4 url
|
||||||
|
('', 1, 0), # 5 id
|
||||||
])
|
])
|
||||||
pos = None
|
pos = None
|
||||||
for (status,plugin_url,plugin_dict) in addon_update_list:
|
for (status,plugin_url,plugin_dict) in addon_update_list:
|
||||||
@ -407,7 +413,8 @@ class ViewManager(CLIManager):
|
|||||||
"%s (%s)" % (plugin_dict["n"],
|
"%s (%s)" % (plugin_dict["n"],
|
||||||
plugin_dict["v"]),
|
plugin_dict["v"]),
|
||||||
plugin_dict["d"],
|
plugin_dict["d"],
|
||||||
plugin_url])
|
plugin_url, plugin_dict["i"],
|
||||||
|
])
|
||||||
if pos is None:
|
if pos is None:
|
||||||
pos = iter
|
pos = iter
|
||||||
if pos:
|
if pos:
|
||||||
@ -445,12 +452,18 @@ class ViewManager(CLIManager):
|
|||||||
("Title", self.window, gtk.DIALOG_MODAL))
|
("Title", self.window, gtk.DIALOG_MODAL))
|
||||||
pm.add_op(longop)
|
pm.add_op(longop)
|
||||||
count = 0
|
count = 0
|
||||||
|
if not config.get('behavior.do-not-show-previously-seen-updates'):
|
||||||
|
# reset list
|
||||||
|
config.get('behavior.previously-seen-updates')[:] = []
|
||||||
for row in self.list.model: # treemodelrow
|
for row in self.list.model: # treemodelrow
|
||||||
if longop.should_cancel():
|
if longop.should_cancel():
|
||||||
break
|
break
|
||||||
elif row[0]: # toggle on
|
elif row[0]: # toggle on
|
||||||
load_addon_file(row[4], callback=LOG.debug)
|
load_addon_file(row[4], callback=LOG.debug)
|
||||||
count += 1
|
count += 1
|
||||||
|
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])
|
||||||
longop.heartbeat()
|
longop.heartbeat()
|
||||||
pm._get_dlg()._process_events()
|
pm._get_dlg()._process_events()
|
||||||
if not longop.was_cancelled():
|
if not longop.was_cancelled():
|
||||||
|
Loading…
Reference in New Issue
Block a user