From d8edc2d3cae32aeee18002c90cdb483c9b145142 Mon Sep 17 00:00:00 2001 From: alby128 Date: Fri, 6 Oct 2017 19:59:30 +0200 Subject: [PATCH] Fixed QDateTime compatibility with old versions --- syncplay/ui/GuiConfiguration.py | 4 +--- syncplay/ui/gui.py | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index a29b553..06c0e12 100755 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -279,10 +279,8 @@ class ConfigDialog(QtWidgets.QDialog): settings = QSettings("Syncplay", "Interface") settings.beginGroup("Update") self.lastCheckedForUpdates = settings.value("lastChecked", None) - if self.lastCheckedForUpdates: + if self.lastCheckedForUpdates and type(self.lastCheckedForUpdates).__name__ == 'QDateTime': if self.config["lastCheckedForUpdates"] is not None and self.config["lastCheckedForUpdates"] is not "": - if type(self.lastCheckedForUpdates).__name__ is 'datetime': - self.lastCheckedForUpdates = QDateTime.fromString(self.lastCheckedForUpdates.strftime('%Y-%m-%d %H:%M:%S'),'yyyy-MM-dd hh:mm:ss') if self.lastCheckedForUpdates.toPython() > datetime.strptime(self.config["lastCheckedForUpdates"], "%Y-%m-%d %H:%M:%S.%f"): self.config["lastCheckedForUpdates"] = self.lastCheckedForUpdates.toString("yyyy-MM-d HH:mm:ss.z") else: diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index db6e570..3764954 100755 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -1524,8 +1524,10 @@ class MainWindow(QtWidgets.QMainWindow): return if self.config['lastCheckedForUpdates']: configLastChecked = datetime.strptime(self.config["lastCheckedForUpdates"], "%Y-%m-%d %H:%M:%S.%f") + if type(self.lastCheckedForUpdates).__name__ != 'QDateTime': + self.lastCheckedForUpdates = None if self.lastCheckedForUpdates is None or configLastChecked > self.lastCheckedForUpdates.toPython(): - self.lastCheckedForUpdates = configLastChecked + self.lastCheckedForUpdates = QDateTime.fromString(self.config["lastCheckedForUpdates"],'yyyy-MM-dd HH-mm-ss') if self.lastCheckedForUpdates is None: self.checkForUpdates() else: