mirror of https://github.com/Syncplay/syncplay
Fixed QDateTime compatibility with old versions
This commit is contained in:
parent
dff5138f54
commit
d8edc2d3ca
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue