From b4292bf8cd43df00e3dd9d89e7b4397f8e3ca7a7 Mon Sep 17 00:00:00 2001 From: albertosottile Date: Fri, 15 Jun 2018 09:42:13 +0200 Subject: [PATCH] Manually check for updates if automaticUpdateCheck fails --- syncplay/ui/gui.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index e5e8037..a34f182 100755 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -1555,16 +1555,20 @@ class MainWindow(QtWidgets.QMainWindow): currentDateTimeValue = QDateTime.currentDateTime() if not self.config['checkForUpdatesAutomatically']: return - if self.config['lastCheckedForUpdates']: - configLastChecked = datetime.strptime(self.config["lastCheckedForUpdates"], "%Y-%m-%d %H:%M:%S.%f") - if self.lastCheckedForUpdates is None or configLastChecked > self.lastCheckedForUpdates.toPython(): - self.lastCheckedForUpdates = QDateTime.fromString(self.config["lastCheckedForUpdates"],'yyyy-MM-dd HH-mm-ss') - if self.lastCheckedForUpdates is None: - self.checkForUpdates() - else: - timeDelta = currentDateTimeValue.toPython() - self.lastCheckedForUpdates.toPython() - if timeDelta.total_seconds() > constants.AUTOMATIC_UPDATE_CHECK_FREQUENCY: + try: + if self.config['lastCheckedForUpdates']: + configLastChecked = datetime.strptime(self.config["lastCheckedForUpdates"], "%Y-%m-%d %H:%M:%S.%f") + if self.lastCheckedForUpdates is None or configLastChecked > self.lastCheckedForUpdates.toPython(): + self.lastCheckedForUpdates = QDateTime.fromString(self.config["lastCheckedForUpdates"],'yyyy-MM-dd HH-mm-ss') + if self.lastCheckedForUpdates is None: self.checkForUpdates() + else: + timeDelta = currentDateTimeValue.toPython() - self.lastCheckedForUpdates.toPython() + if timeDelta.total_seconds() > constants.AUTOMATIC_UPDATE_CHECK_FREQUENCY: + self.checkForUpdates() + except: + self.showDebugMessage("Automatic check for updates failed. An update check was manually trigggered.") + self.checkForUpdates() def userCheckForUpdates(self): self.checkForUpdates(userInitiated=True)