updater fixes
This commit is contained in:
parent
ecf045182a
commit
1e6201b3fa
4 changed files with 20 additions and 2 deletions
|
@ -260,7 +260,7 @@ class Toxygen:
|
||||||
self.tray.activated.connect(tray_activated)
|
self.tray.activated.connect(tray_activated)
|
||||||
|
|
||||||
updating = False
|
updating = False
|
||||||
if settings['update']: # auto update
|
if settings['update'] and updater.connection_available(): # auto update
|
||||||
version = updater.check_for_updates()
|
version = updater.check_for_updates()
|
||||||
if version is not None:
|
if version is not None:
|
||||||
if settings['update'] == 2:
|
if settings['update'] == 2:
|
||||||
|
|
|
@ -950,6 +950,16 @@ class UpdateSettings(CenteredWidget):
|
||||||
settings.save()
|
settings.save()
|
||||||
|
|
||||||
def update_client(self):
|
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()
|
version = updater.check_for_updates()
|
||||||
if version is not None:
|
if version is not None:
|
||||||
updater.download(version)
|
updater.download(version)
|
||||||
|
|
|
@ -68,7 +68,6 @@ class PluginLoader(util.Singleton):
|
||||||
"""
|
"""
|
||||||
New incoming custom lossless packet (callback)
|
New incoming custom lossless packet (callback)
|
||||||
"""
|
"""
|
||||||
print('Custom', data)
|
|
||||||
l = data[0] - pl.LOSSLESS_FIRST_BYTE
|
l = data[0] - pl.LOSSLESS_FIRST_BYTE
|
||||||
name = ''.join(chr(x) for x in data[1:l + 1])
|
name = ''.join(chr(x) for x in data[1:l + 1])
|
||||||
if name in self._plugins and self._plugins[name][1]:
|
if name in self._plugins and self._plugins[name][1]:
|
||||||
|
|
|
@ -2,6 +2,7 @@ import util
|
||||||
import os
|
import os
|
||||||
import settings
|
import settings
|
||||||
import platform
|
import platform
|
||||||
|
import urllib
|
||||||
try:
|
try:
|
||||||
from PySide import QtNetwork, QtCore
|
from PySide import QtNetwork, QtCore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -9,6 +10,14 @@ except ImportError:
|
||||||
import subprocess
|
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():
|
def check_for_updates():
|
||||||
current_version = util.program_version
|
current_version = util.program_version
|
||||||
major, minor, patch = list(map(lambda x: int(x), current_version.split('.')))
|
major, minor, patch = list(map(lambda x: int(x), current_version.split('.')))
|
||||||
|
|
Loading…
Reference in a new issue