Implement printer cloud sync error state

CURA-7290
This commit is contained in:
Nino van Hooff 2020-05-04 13:19:16 +02:00
parent 4e7f446fe1
commit 81d02d5d58
3 changed files with 25 additions and 14 deletions

View file

@ -103,8 +103,8 @@ class CloudOutputDeviceManager:
self._update_timer.stop()
self._syncing = True
self._account.isSyncingChanged.emit(True)
self._api.getClusters(self._onGetRemoteClustersFinished)
self._account.isSyncingChanged.emit("syncing")
self._api.getClusters(self._onGetRemoteClustersFinished, self._onGetRemoteClusterFailed)
def _onGetRemoteClustersFinished(self, clusters: List[CloudClusterResponse]) -> None:
"""Callback for when the request for getting the clusters is finished."""
@ -133,7 +133,13 @@ class CloudOutputDeviceManager:
self._connectToActiveMachine()
self._syncing = False
self._account.isSyncingChanged.emit(False)
self._account.isSyncingChanged.emit("success")
# Schedule a new update
self._update_timer.start()
def _onGetRemoteClusterFailed(self):
self._syncing = False
self._account.isSyncingChanged.emit("error")
# Schedule a new update
self._update_timer.start()