tkgui.py 文件源码

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

项目:sorter 作者: giantas 项目源码 文件源码
def _github_connect(self, msg_widget, user_checked, window):
        link = 'https://api.github.com/repos/giantas/sorter/releases/latest'
        try:
            with urllib.request.urlopen(link, timeout=5) as response:
                html = response.read()
        except urllib.request.URLError:
            message = 'Update check failed. Could not connect to the Internet.'
            msg_widget.config(text=message, relief=SUNKEN)
            self.logger.warning(message)
        else:
            items = json.loads(html.decode('utf-8'))
            latest_tag = items.get('tag_name')
            if latest_tag.strip('v') > SORTER_VERSION:
                items.get('html_url')
                body = items.get('body')
                features = body.replace('*', '')
                message = 'Update available!\n\nSorter {tag}.\n\n{feat} ....\n\nMore information on the'.format(
                    tag=latest_tag, feat=features[:500])
                msg_widget.config(text=message)
                self._official_website_label(master=window, window=window)
            else:
                if user_checked:
                    message = 'No update found.\n\nYou have the latest version installed. Always stay up-to-date with fixes and new features.\n\nStay tuned for more!'
                    msg_widget.config(text=message, relief=FLAT)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号