diff --git a/toxygen/main.py b/toxygen/main.py index 73ac63c..436b5d3 100644 --- a/toxygen/main.py +++ b/toxygen/main.py @@ -260,7 +260,7 @@ class Toxygen: self.tray.activated.connect(tray_activated) updating = False - if settings['update']: # auto update + if settings['update'] and updater.connection_available(): # auto update version = updater.check_for_updates() if version is not None: if settings['update'] == 2: diff --git a/toxygen/menu.py b/toxygen/menu.py index c60b1df..5102e9b 100644 --- a/toxygen/menu.py +++ b/toxygen/menu.py @@ -950,6 +950,16 @@ class UpdateSettings(CenteredWidget): settings.save() def update_client(self): + if not updater.connection_available(): + msgBox = QtGui.QMessageBox() + msgBox.setWindowTitle( + QtGui.QApplication.translate("updateSettingsForm", "Error", None, + QtGui.QApplication.UnicodeUTF8)) + text = (QtGui.QApplication.translate("updateSettingsForm", 'Problems with internet connection', None, + QtGui.QApplication.UnicodeUTF8)) + msgBox.setText(text) + msgBox.exec_() + return version = updater.check_for_updates() if version is not None: updater.download(version) diff --git a/toxygen/plugin_support.py b/toxygen/plugin_support.py index 9ae33c2..2424f4a 100644 --- a/toxygen/plugin_support.py +++ b/toxygen/plugin_support.py @@ -68,7 +68,6 @@ class PluginLoader(util.Singleton): """ New incoming custom lossless packet (callback) """ - print('Custom', data) l = data[0] - pl.LOSSLESS_FIRST_BYTE name = ''.join(chr(x) for x in data[1:l + 1]) if name in self._plugins and self._plugins[name][1]: diff --git a/toxygen/updater.py b/toxygen/updater.py index 23a5c55..2620562 100644 --- a/toxygen/updater.py +++ b/toxygen/updater.py @@ -2,6 +2,7 @@ import util import os import settings import platform +import urllib try: from PySide import QtNetwork, QtCore except ImportError: @@ -9,6 +10,14 @@ except ImportError: import subprocess +def connection_available(): + try: + urllib.request.urlopen('http://216.58.192.142', timeout=1) # google.com + return True + except: + return False + + def check_for_updates(): current_version = util.program_version major, minor, patch = list(map(lambda x: int(x), current_version.split('.')))