check if updater exists
This commit is contained in:
parent
56d8fa1cad
commit
c4843148e4
@ -9,7 +9,7 @@ except ImportError:
|
|||||||
from bootstrap import node_generator
|
from bootstrap import node_generator
|
||||||
from mainscreen import MainWindow
|
from mainscreen import MainWindow
|
||||||
from callbacks import init_callbacks, stop, start
|
from callbacks import init_callbacks, stop, start
|
||||||
from util import curr_directory, program_version
|
from util import curr_directory, program_version, remove
|
||||||
import styles.style
|
import styles.style
|
||||||
import platform
|
import platform
|
||||||
import toxencryptsave
|
import toxencryptsave
|
||||||
@ -22,7 +22,7 @@ class Toxygen:
|
|||||||
|
|
||||||
def __init__(self, path_or_uri=None):
|
def __init__(self, path_or_uri=None):
|
||||||
super(Toxygen, self).__init__()
|
super(Toxygen, self).__init__()
|
||||||
self.tox = self.ms = self.init = self.mainloop = self.avloop = None
|
self.tox = self.ms = self.init = self.app = self.tray = self.mainloop = self.avloop = None
|
||||||
if path_or_uri is None:
|
if path_or_uri is None:
|
||||||
self.uri = self.path = None
|
self.uri = self.path = None
|
||||||
elif path_or_uri.startswith('tox:'):
|
elif path_or_uri.startswith('tox:'):
|
||||||
@ -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'] and updater.connection_available(): # auto update
|
if settings['update'] and updater.updater_available() 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:
|
||||||
@ -440,9 +440,7 @@ class Toxygen:
|
|||||||
def clean():
|
def clean():
|
||||||
"""Removes all windows libs from libs folder"""
|
"""Removes all windows libs from libs folder"""
|
||||||
d = curr_directory() + '/libs/'
|
d = curr_directory() + '/libs/'
|
||||||
for fl in ('libtox64.dll', 'libtox.dll', 'libsodium64.a', 'libsodium.a'):
|
remove(d)
|
||||||
if os.path.exists(d + fl):
|
|
||||||
os.remove(d + fl)
|
|
||||||
|
|
||||||
|
|
||||||
def configure():
|
def configure():
|
||||||
|
@ -960,6 +960,16 @@ class UpdateSettings(CenteredWidget):
|
|||||||
msgBox.setText(text)
|
msgBox.setText(text)
|
||||||
msgBox.exec_()
|
msgBox.exec_()
|
||||||
return
|
return
|
||||||
|
if not updater.updater_available():
|
||||||
|
msgBox = QtGui.QMessageBox()
|
||||||
|
msgBox.setWindowTitle(
|
||||||
|
QtGui.QApplication.translate("updateSettingsForm", "Error", None,
|
||||||
|
QtGui.QApplication.UnicodeUTF8))
|
||||||
|
text = (QtGui.QApplication.translate("updateSettingsForm", 'Updater not found', 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)
|
||||||
|
@ -18,6 +18,15 @@ def connection_available():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def updater_available():
|
||||||
|
if is_from_sources():
|
||||||
|
return os.path.exists(util.curr_directory() + '/toxygen_updater.py')
|
||||||
|
elif platform.system() == 'Windows':
|
||||||
|
return os.path.exists(util.curr_directory() + '/toxygen_updater.exe')
|
||||||
|
else:
|
||||||
|
return os.path.exists(util.curr_directory() + '/toxygen_updater')
|
||||||
|
|
||||||
|
|
||||||
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('.')))
|
||||||
|
@ -30,6 +30,10 @@ def copy(src, dest):
|
|||||||
copy(full_file_name, os.path.join(dest, file_name))
|
copy(full_file_name, os.path.join(dest, file_name))
|
||||||
|
|
||||||
|
|
||||||
|
def remove(folder):
|
||||||
|
shutil.rmtree(folder)
|
||||||
|
|
||||||
|
|
||||||
def convert_time(t):
|
def convert_time(t):
|
||||||
offset = time.timezone - time.daylight * 3600
|
offset = time.timezone - time.daylight * 3600
|
||||||
sec = int(t) - offset
|
sec = int(t) - offset
|
||||||
|
Loading…
Reference in New Issue
Block a user