Fixed QDateTime compatibility with old versions

This commit is contained in:
alby128 2017-10-06 14:38:15 +02:00
parent a76a53945d
commit a63b8f6d22
3 changed files with 5 additions and 5 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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: