WPKG-GP-Client.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:wpkg-gp-client 作者: sonicnkt 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号