def update_check_done(self, result):
# Update check function ended
r = result.get()
self.checking_updates = False
if isinstance(r, basestring):
# Error returned
self.updates_available = False
if self.upd_error_count < 2 and not self.show_no_updates:
# only display update errors on automatic check after the third error in a row
self.upd_error_count += 1
else:
error_str = _(u"Could not load updates:") + "\n" + r
self.ShowBalloon(title=_(u'Update Error'), text=error_str, msec=20*1000, flags=wx.ICON_ERROR)
# reset update error counter
self.upd_error_count = 0
elif r:
self.upd_error_count = 0
action_dict = {'update': _(u'UPD:') + '\t',
'install': _(u'NEW:') + '\t',
'remove': _(u'REM:') + '\t',
'downgrade': _(u'DOW:') + '\t'}
# Updates Found
self.updates_available = True
text = ''
for action, name, version in r:
text += action_dict[action] + name + ', v. ' + version + '\n'
self.ShowBalloon(title=_(u"Update(s) available:"), text=text, msec=20*1000, flags=wx.ICON_INFORMATION)
else:
# No Updates Found
self.upd_error_count = 0
self.updates_available = False
if self.show_no_updates:
self.ShowBalloon(title=_(u"No Updates"), text=" ", msec=5*1000, flags=wx.ICON_INFORMATION)
self.show_no_updates = False
评论列表
文章目录