From d8acdbe444bb0b41ebb5b6a49dad0c9b93036695 Mon Sep 17 00:00:00 2001 From: alby128 Date: Sat, 16 Sep 2017 18:10:16 +0200 Subject: [PATCH] Fixed lastChecked storage in QSettings --- syncplay/ui/GuiConfiguration.py | 4 ++-- syncplay/ui/gui.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index 7878096..f2a66e7 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -280,9 +280,9 @@ class ConfigDialog(QtWidgets.QDialog): if self.lastCheckedForUpdates: if self.config["lastCheckedForUpdates"] is not None and self.config["lastCheckedForUpdates"] is not "": if self.lastCheckedForUpdates > datetime.strptime(self.config["lastCheckedForUpdates"], "%Y-%m-%d %H:%M:%S.%f"): - self.config["lastCheckedForUpdates"] = str(self.lastCheckedForUpdates) + self.config["lastCheckedForUpdates"] = self.lastCheckedForUpdates.toString("yyyy-MM-d HH:mm:ss.z") else: - self.config["lastCheckedForUpdates"] = str(self.lastCheckedForUpdates) + self.config["lastCheckedForUpdates"] = self.lastCheckedForUpdates.toString("yyyy-MM-d HH:mm:ss.z") def loadSavedPublicServerList(self): settings = QSettings("Syncplay", "Interface") diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index cb22972..5f50419 100644 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -1,5 +1,5 @@ from PySide2 import QtWidgets, QtGui -from PySide2.QtCore import Qt, QSettings, QSize, QPoint, QUrl, QLine, QStandardPaths +from PySide2.QtCore import Qt, QSettings, QSize, QPoint, QUrl, QLine, QStandardPaths, QDateTime from syncplay import utils, constants, version from syncplay.messages import getMessage import sys @@ -1440,7 +1440,7 @@ class MainWindow(QtWidgets.QMainWindow): self.autoplayPushButton.setIcon(QtGui.QPixmap(self.resourcespath + 'empty_checkbox.png')) def automaticUpdateCheck(self): - currentDateTime = datetime.utcnow() + currentDateTimeValue = QDateTime.currentDateTime() if not self.config['checkForUpdatesAutomatically']: return if self.config['lastCheckedForUpdates']: @@ -1450,7 +1450,7 @@ class MainWindow(QtWidgets.QMainWindow): if self.lastCheckedForUpdates is None: self.checkForUpdates() else: - timeDelta = currentDateTime - self.lastCheckedForUpdates + timeDelta = currentDateTimeValue - self.lastCheckedForUpdates if timeDelta.total_seconds() > constants.AUTOMATIC_UPDATE_CHECK_FREQUENCY: self.checkForUpdates() @@ -1459,7 +1459,7 @@ class MainWindow(QtWidgets.QMainWindow): @needsClient def checkForUpdates(self, userInitiated=False): - self.lastCheckedForUpdates = datetime.utcnow() + self.lastCheckedForUpdates = QDateTime.currentDateTime() updateStatus, updateMessage, updateURL, self.publicServerList = self._syncplayClient.checkForUpdate(userInitiated) if updateMessage is None: