Fixed lastChecked storage in QSettings
This commit is contained in:
parent
fda0331662
commit
d8acdbe444
@ -280,9 +280,9 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
if self.lastCheckedForUpdates:
|
if self.lastCheckedForUpdates:
|
||||||
if self.config["lastCheckedForUpdates"] is not None and self.config["lastCheckedForUpdates"] is not "":
|
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"):
|
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:
|
else:
|
||||||
self.config["lastCheckedForUpdates"] = str(self.lastCheckedForUpdates)
|
self.config["lastCheckedForUpdates"] = self.lastCheckedForUpdates.toString("yyyy-MM-d HH:mm:ss.z")
|
||||||
|
|
||||||
def loadSavedPublicServerList(self):
|
def loadSavedPublicServerList(self):
|
||||||
settings = QSettings("Syncplay", "Interface")
|
settings = QSettings("Syncplay", "Interface")
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from PySide2 import QtWidgets, QtGui
|
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 import utils, constants, version
|
||||||
from syncplay.messages import getMessage
|
from syncplay.messages import getMessage
|
||||||
import sys
|
import sys
|
||||||
@ -1440,7 +1440,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.autoplayPushButton.setIcon(QtGui.QPixmap(self.resourcespath + 'empty_checkbox.png'))
|
self.autoplayPushButton.setIcon(QtGui.QPixmap(self.resourcespath + 'empty_checkbox.png'))
|
||||||
|
|
||||||
def automaticUpdateCheck(self):
|
def automaticUpdateCheck(self):
|
||||||
currentDateTime = datetime.utcnow()
|
currentDateTimeValue = QDateTime.currentDateTime()
|
||||||
if not self.config['checkForUpdatesAutomatically']:
|
if not self.config['checkForUpdatesAutomatically']:
|
||||||
return
|
return
|
||||||
if self.config['lastCheckedForUpdates']:
|
if self.config['lastCheckedForUpdates']:
|
||||||
@ -1450,7 +1450,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
if self.lastCheckedForUpdates is None:
|
if self.lastCheckedForUpdates is None:
|
||||||
self.checkForUpdates()
|
self.checkForUpdates()
|
||||||
else:
|
else:
|
||||||
timeDelta = currentDateTime - self.lastCheckedForUpdates
|
timeDelta = currentDateTimeValue - self.lastCheckedForUpdates
|
||||||
if timeDelta.total_seconds() > constants.AUTOMATIC_UPDATE_CHECK_FREQUENCY:
|
if timeDelta.total_seconds() > constants.AUTOMATIC_UPDATE_CHECK_FREQUENCY:
|
||||||
self.checkForUpdates()
|
self.checkForUpdates()
|
||||||
|
|
||||||
@ -1459,7 +1459,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
@needsClient
|
@needsClient
|
||||||
def checkForUpdates(self, userInitiated=False):
|
def checkForUpdates(self, userInitiated=False):
|
||||||
self.lastCheckedForUpdates = datetime.utcnow()
|
self.lastCheckedForUpdates = QDateTime.currentDateTime()
|
||||||
updateStatus, updateMessage, updateURL, self.publicServerList = self._syncplayClient.checkForUpdate(userInitiated)
|
updateStatus, updateMessage, updateURL, self.publicServerList = self._syncplayClient.checkForUpdate(userInitiated)
|
||||||
|
|
||||||
if updateMessage is None:
|
if updateMessage is None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user