From a63b8f6d224102ae2976ff56ccd7b62ad7426b5e Mon Sep 17 00:00:00 2001 From: alby128 Date: Fri, 6 Oct 2017 14:38:15 +0200 Subject: [PATCH] Fixed QDateTime compatibility with old versions --- .appveyor.yml | 2 +- syncplay/ui/GuiConfiguration.py | 4 +--- syncplay/ui/gui.py | 4 +++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index f590e35..93beaf2 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -34,7 +34,7 @@ build: off artifacts: path: 'syncplay_v1.5.0' type: zip - name: Syncplay_win + name: Syncplay_win_pyside2 # Push artefact to S3 bucket and list all before_deploy: 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: