Merge branch 'mig5-fix_invalid_version_alert' into develop

This commit is contained in:
Micah Lee 2018-09-14 18:33:10 -07:00
commit 23415a43f2
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 7 additions and 7 deletions

View File

@ -634,8 +634,8 @@ class SettingsDialog(QtWidgets.QDialog):
Alert(self.common, strings._('update_error_check_error', True), QtWidgets.QMessageBox.Warning) Alert(self.common, strings._('update_error_check_error', True), QtWidgets.QMessageBox.Warning)
close_forced_update_thread() close_forced_update_thread()
def update_invalid_version(): def update_invalid_version(latest_version):
Alert(self.common, strings._('update_error_invalid_latest_version', True).format(e.latest_version), QtWidgets.QMessageBox.Warning) Alert(self.common, strings._('update_error_invalid_latest_version', True).format(latest_version), QtWidgets.QMessageBox.Warning)
close_forced_update_thread() close_forced_update_thread()
forced_update_thread = UpdateThread(self.common, self.onion, self.config, force=True) forced_update_thread = UpdateThread(self.common, self.onion, self.config, force=True)

View File

@ -53,7 +53,7 @@ class UpdateChecker(QtCore.QObject):
update_available = QtCore.pyqtSignal(str, str, str) update_available = QtCore.pyqtSignal(str, str, str)
update_not_available = QtCore.pyqtSignal() update_not_available = QtCore.pyqtSignal()
update_error = QtCore.pyqtSignal() update_error = QtCore.pyqtSignal()
update_invalid_version = QtCore.pyqtSignal() update_invalid_version = QtCore.pyqtSignal(str)
def __init__(self, common, onion, config=False): def __init__(self, common, onion, config=False):
super(UpdateChecker, self).__init__() super(UpdateChecker, self).__init__()
@ -136,7 +136,7 @@ class UpdateChecker(QtCore.QObject):
# This regex is: 1-3 dot-separated numeric components # This regex is: 1-3 dot-separated numeric components
version_re = r"^(\d+\.)?(\d+\.)?(\d+)$" version_re = r"^(\d+\.)?(\d+\.)?(\d+)$"
if not re.match(version_re, latest_version): if not re.match(version_re, latest_version):
self.update_invalid_version.emit() self.update_invalid_version.emit(latest_version)
raise UpdateCheckerInvalidLatestVersion(latest_version) raise UpdateCheckerInvalidLatestVersion(latest_version)
# Update the last checked timestamp (dropping the seconds and milliseconds) # Update the last checked timestamp (dropping the seconds and milliseconds)
@ -160,7 +160,7 @@ class UpdateThread(QtCore.QThread):
update_available = QtCore.pyqtSignal(str, str, str) update_available = QtCore.pyqtSignal(str, str, str)
update_not_available = QtCore.pyqtSignal() update_not_available = QtCore.pyqtSignal()
update_error = QtCore.pyqtSignal() update_error = QtCore.pyqtSignal()
update_invalid_version = QtCore.pyqtSignal() update_invalid_version = QtCore.pyqtSignal(str)
def __init__(self, common, onion, config=False, force=False): def __init__(self, common, onion, config=False, force=False):
super(UpdateThread, self).__init__() super(UpdateThread, self).__init__()
@ -203,7 +203,7 @@ class UpdateThread(QtCore.QThread):
self.active = False self.active = False
self.update_error.emit() self.update_error.emit()
def _update_invalid_version(self): def _update_invalid_version(self, latest_version):
self.common.log('UpdateThread', '_update_invalid_version') self.common.log('UpdateThread', '_update_invalid_version')
self.active = False self.active = False
self.update_invalid_version.emit() self.update_invalid_version.emit(latest_version)