Manually check for updates if automaticUpdateCheck fails

This commit is contained in:
albertosottile 2018-06-15 09:42:13 +02:00
parent 33c816fc56
commit b4292bf8cd

View File

@ -1555,6 +1555,7 @@ class MainWindow(QtWidgets.QMainWindow):
currentDateTimeValue = QDateTime.currentDateTime() currentDateTimeValue = QDateTime.currentDateTime()
if not self.config['checkForUpdatesAutomatically']: if not self.config['checkForUpdatesAutomatically']:
return return
try:
if self.config['lastCheckedForUpdates']: if self.config['lastCheckedForUpdates']:
configLastChecked = datetime.strptime(self.config["lastCheckedForUpdates"], "%Y-%m-%d %H:%M:%S.%f") configLastChecked = datetime.strptime(self.config["lastCheckedForUpdates"], "%Y-%m-%d %H:%M:%S.%f")
if self.lastCheckedForUpdates is None or configLastChecked > self.lastCheckedForUpdates.toPython(): if self.lastCheckedForUpdates is None or configLastChecked > self.lastCheckedForUpdates.toPython():
@ -1565,6 +1566,9 @@ class MainWindow(QtWidgets.QMainWindow):
timeDelta = currentDateTimeValue.toPython() - self.lastCheckedForUpdates.toPython() timeDelta = currentDateTimeValue.toPython() - self.lastCheckedForUpdates.toPython()
if timeDelta.total_seconds() > constants.AUTOMATIC_UPDATE_CHECK_FREQUENCY: if timeDelta.total_seconds() > constants.AUTOMATIC_UPDATE_CHECK_FREQUENCY:
self.checkForUpdates() self.checkForUpdates()
except:
self.showDebugMessage("Automatic check for updates failed. An update check was manually trigggered.")
self.checkForUpdates()
def userCheckForUpdates(self): def userCheckForUpdates(self):
self.checkForUpdates(userInitiated=True) self.checkForUpdates(userInitiated=True)