MCPcopy Create free account
hub / github.com/Syncplay/syncplay / automaticUpdateCheck

Method automaticUpdateCheck

syncplay/ui/gui.py:1921–1938  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1919 self.autoplayPushButton.setIcon(QtGui.QPixmap(resourcespath + 'empty_checkbox.png'))
1920
1921 def automaticUpdateCheck(self):
1922 currentDateTimeValue = QDateTime.currentDateTime()
1923 if not self.config['checkForUpdatesAutomatically']:
1924 return
1925 try:
1926 if self.config['lastCheckedForUpdates']:
1927 configLastChecked = datetime.strptime(self.config["lastCheckedForUpdates"], "%Y-%m-%d %H:%M:%S.%f")
1928 if self.lastCheckedForUpdates is None or configLastChecked > self.lastCheckedForUpdates.toPython():
1929 self.lastCheckedForUpdates = QDateTime.fromString(self.config["lastCheckedForUpdates"], 'yyyy-MM-dd HH-mm-ss')
1930 if self.lastCheckedForUpdates is None:
1931 self.checkForUpdates()
1932 else:
1933 timeDelta = currentDateTimeValue.toPython() - self.lastCheckedForUpdates.toPython()
1934 if timeDelta.total_seconds() > constants.AUTOMATIC_UPDATE_CHECK_FREQUENCY:
1935 self.checkForUpdates()
1936 except Exception as e:
1937 self.showDebugMessage("Automatic check for updates failed. An update check was manually trigggered. Reason: {}".format(str(e)))
1938 self.checkForUpdates()
1939
1940 def userCheckForUpdates(self):
1941 self.checkForUpdates(userInitiated=True)

Callers 1

addClientMethod · 0.95

Calls 2

checkForUpdatesMethod · 0.95
showDebugMessageMethod · 0.95

Tested by

no test coverage detected