mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-07 17:05:16 -04:00
Refactor UpdateChecker into a class that's a QObject, and make it use signals and slots to communicate
This commit is contained in:
parent
ca16600d29
commit
47c1488512
2 changed files with 74 additions and 57 deletions
|
@ -381,9 +381,17 @@ class SettingsDialog(QtWidgets.QDialog):
|
|||
bundled_tor_func = None
|
||||
|
||||
# Check for updates
|
||||
def update_available(update_url, installed_version, latest_version):
|
||||
Alert(strings._("update_available", True).format(update_url, installed_version, latest_version))
|
||||
def update_not_available():
|
||||
Alert(strings._('update_not_available', True))
|
||||
|
||||
u = UpdateChecker()
|
||||
u.update_available.connect(update_available)
|
||||
u.update_not_available.connect(update_not_available)
|
||||
|
||||
try:
|
||||
if not check_for_updates(force=True, bundled_tor_func=bundled_tor_func):
|
||||
Alert(strings._('update_not_available', True))
|
||||
u.check(force=True, bundled_tor_func=bundled_tor_func)
|
||||
except UpdateCheckerTorError:
|
||||
Alert(strings._('update_error_tor', True), QtWidgets.QMessageBox.Warning)
|
||||
except UpdateCheckerSOCKSHTTPError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue