From e598d027eb830e609d0efb3be464c256df4ac7b1 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sat, 29 Oct 2016 21:30:39 +0300 Subject: [PATCH] fixes for updater --- toxygen/main.py | 6 +++--- toxygen/updater.py | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/toxygen/main.py b/toxygen/main.py index 2405199..586775c 100644 --- a/toxygen/main.py +++ b/toxygen/main.py @@ -259,6 +259,8 @@ class Toxygen: self.tray.show() self.tray.activated.connect(tray_activated) + self.ms.show() + updating = False if settings['update'] and updater.updater_available() and updater.connection_available(): # auto update version = updater.check_for_updates() @@ -268,7 +270,7 @@ class Toxygen: updating = True else: reply = QtGui.QMessageBox.question(None, - '', + 'Toxygen', QtGui.QApplication.translate("login", 'Update for Toxygen was found. Download and install it?', None, @@ -286,8 +288,6 @@ class Toxygen: del self.tox return - self.ms.show() - plugin_helper = PluginLoader(self.tox, settings) # plugin support plugin_helper.load() diff --git a/toxygen/updater.py b/toxygen/updater.py index c25cadf..5684359 100644 --- a/toxygen/updater.py +++ b/toxygen/updater.py @@ -50,14 +50,14 @@ def get_url(version): return 'https://github.com/toxygen-project/toxygen/archive/v' + version + '.zip' else: name = 'toxygen_windows.zip' if platform.system() == 'Windows' else 'toxygen_linux.tar.gz' - return 'https://github.com/toxygen-project/toxygen/releases/tag/v{}/{}'.format(version, name) + return 'https://github.com/toxygen-project/toxygen/releases/download/v{}/{}'.format(version, name) def get_params(url, version): if is_from_sources(): return ['python3', 'toxygen_updater.py', url, version] elif platform.system() == 'Windows': - return ['run', 'toxygen_updater.exe', url, version] + return [util.curr_directory() + '/toxygen_updater.exe', url, version] else: return ['./toxygen_updater', url, version] @@ -66,6 +66,7 @@ def download(version): os.chdir(util.curr_directory()) url = get_url(version) params = get_params(url, version) + print('Updating Toxygen') try: subprocess.Popen(params) except Exception as ex: @@ -89,7 +90,7 @@ def send_request(version): QtCore.QThread.msleep(1) QtCore.QCoreApplication.processEvents() attr = reply.attribute(QtNetwork.QNetworkRequest.HttpStatusCodeAttribute) - return 200 <= attr < 300 + return attr is not None and 200 <= attr < 300 except Exception as ex: util.log('TOXYGEN UPDATER ERROR: ' + str(ex)) return False