From 44169fc02e608d657b645039700d1dbd8956c877 Mon Sep 17 00:00:00 2001 From: Tobias Kummer Date: Mon, 28 Aug 2017 14:14:49 +0200 Subject: [PATCH] implement update check --- BlenderUpdater.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/BlenderUpdater.py b/BlenderUpdater.py index cac6cd2..7424abd 100644 --- a/BlenderUpdater.py +++ b/BlenderUpdater.py @@ -29,10 +29,11 @@ import platform from distutils.version import StrictVersion import json +import webbrowser app = QtWidgets.QApplication(sys.argv) -appversion = '1.0' +appversion = '1.2' dir_ = '' config = configparser.ConfigParser() btn = {} @@ -179,16 +180,17 @@ def __init__(self, parent=None): self, "Error", "Please check your internet connection") sys.exit() # Check for new version on github - Appupdate = urllib.request.urlopen('https://api.github.com/repos/tobkum/BlenderUpdater/releases/latest') + try: + Appupdate = urllib.request.urlopen('https://api.github.com/repos/tobkum/BlenderUpdater/releases/latest') + except Exception: + QtWidgets.QMessageBox.critical( + self, "Error", "Unable to get update information") UpdateData = json.load(Appupdate) applatestversion = UpdateData['tag_name'] print(UpdateData['tag_name']) if StrictVersion(applatestversion) > StrictVersion(appversion): + self.btn_newVersion.clicked.connect(self.getAppUpdate) self.btn_newVersion.show() - print(applatestversion) - - - def select_path(self): global dir_ @@ -200,6 +202,10 @@ def select_path(self): else: pass + def getAppUpdate(self): + webbrowser.open("https://github.com/tobkum/BlenderUpdater/releases/latest") + + def about(self): aboutText = '

Utility to update Blender to the latest buildbot version available at \ \