mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-05 07:55:23 -04:00
Made automatic check for update in a separate thread work
This commit is contained in:
parent
da70c71d8a
commit
dff13d9568
2 changed files with 25 additions and 23 deletions
|
@ -24,7 +24,6 @@ from onionshare.settings import Settings
|
|||
from onionshare.onion import Onion
|
||||
|
||||
from . import strings, helpers
|
||||
from .alert import Alert
|
||||
|
||||
class UpdateCheckerTorError(Exception):
|
||||
"""
|
||||
|
@ -149,17 +148,24 @@ class UpdateChecker(QtCore.QObject):
|
|||
self.tor_status_update.emit(message)
|
||||
|
||||
class UpdateThread(QtCore.QThread):
|
||||
update_available = QtCore.pyqtSignal(str, str, str)
|
||||
tor_status_update = QtCore.pyqtSignal(str)
|
||||
|
||||
def __init__(self):
|
||||
super(UpdateThread, self).__init__()
|
||||
|
||||
def run(self):
|
||||
u = UpdateChecker()
|
||||
u.update_available.connect(self.update_available)
|
||||
u.update_available.connect(self._update_available)
|
||||
u.tor_status_update.connect(self._tor_status_update)
|
||||
try:
|
||||
u.check()
|
||||
except:
|
||||
# If update check fails, silently ignore
|
||||
pass
|
||||
|
||||
def update_available(update_url, installed_version, latest_version):
|
||||
Alert(strings._("update_available", True).format(update_url, installed_version, latest_version))
|
||||
def _update_available(self, update_url, installed_version, latest_version):
|
||||
self.update_available.emit(update_url, installed_version, latest_version)
|
||||
|
||||
def _tor_status_update(self, message):
|
||||
self.tor_status_update.emit(message)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue