Beispiel #1
0
    def check_update(self, by_user=False, test=False):
        try:
            release = github.get_latest_release(Const.author, Const.app_name, timeout=5)
            Log.append(self.check_update, 'Info', release)

            have_new = test or common.compare_version(Const.version, release['tag_name'])

            if have_new:
                rumps.notification(
                    self.lang.noti_update_version % release['name'],
                    self.lang.noti_update_time % release['published_at'],
                    release['body'],
                )

            if by_user:
                if have_new:
                    if len(release['assets']) > 0:
                        system_api.open_url(release['assets'][0]['browser_download_url'])
                    else:
                        system_api.open_url(release['html_url'])
                else:
                    rumps.notification(self.lang.menu_check_update, self.lang.noti_update_none,
                                       self.lang.noti_update_star)
        except:
            Log.append(self.check_update, 'Warning', common.get_exception())
            if by_user:
                rumps.notification(self.lang.menu_check_update, '', self.lang.noti_network_error)
Beispiel #2
0
    def callback_exception(self):
        exc = common.get_exception()
        Log.append(self.callback_exception, 'Error', exc)

        if QMessageBox.warning(None, self.lang.title_crash,
                               self.lang.description_crash):
            self.export_log()
Beispiel #3
0
    def callback_exception(self, exc=None):
        need_restart = (time.time() - self.init_time) >= 10
        if exc is None:
            exc = common.get_exception()
        Log.append(self.callback_exception, 'Error', exc)
        if 'KeyboardInterrupt' in exc:
            self.quit()
        elif 'Too many open files in system' in exc:
            self.quit()

        if osa_api.alert(self.lang.title_crash, self.lang.description_crash):
            self.export_log()

        if need_restart:
            self.restart()
Beispiel #4
0
    def check_update(self, test=False):
        try:
            release = github.get_latest_release(Const.author,
                                                Const.app_name,
                                                timeout=5)
            Log.append(self.check_update, 'Info', release)

            if test or common.compare_version(Const.version,
                                              release['tag_name']):
                if len(release['assets']) > 0:
                    QMessageBox.information(
                        self.lang.title_check_update, '%s\n%s\n\n%s' %
                        (self.lang.description_new_version, release['body'],
                         release['assets'][0]['browser_download_url']))
                else:
                    QMessageBox.information(
                        self.lang.title_check_update, '%s\n%s\n\n%s' %
                        (self.lang.description_new_version, release['body'],
                         release['assets'][0]['browser_download_url']))
        except:
            Log.append(self.check_update, 'Warning', common.get_exception())