Move cloud flow checks back to UM3OutputDevice

Contributes to CL-1222
This commit is contained in:
Ian Paschal 2019-02-04 11:51:27 +01:00
parent 1244e30500
commit 2a3a1d6e35
2 changed files with 45 additions and 36 deletions

View file

@ -32,8 +32,6 @@ class CloudOutputDeviceManager:
# The translation catalog for this device.
I18N_CATALOG = i18nCatalog("cura")
cloudFlowIsPossible = Signal()
def __init__(self) -> None:
# Persistent dict containing the remote clusters for the authenticated user.
self._remote_clusters = {} # type: Dict[str, CloudOutputDevice]
@ -44,9 +42,6 @@ class CloudOutputDeviceManager:
self._account = self._application.getCuraAPI().account # type: Account
self._api = CloudApiClient(self._account, self._onApiError)
self._account.loginStateChanged.connect(self.checkCloudFlowIsPossible)
self.cloudFlowIsPossible.connect(self._onCloudFlowPossible)
# Create a timer to update the remote cluster list
self._update_timer = QTimer()
self._update_timer.setInterval(int(self.CHECK_CLUSTER_INTERVAL * 1000))
@ -173,34 +168,3 @@ class CloudOutputDeviceManager:
self._application.globalContainerStackChanged.disconnect(self._connectToActiveMachine)
self._update_timer.timeout.disconnect(self._getRemoteClusters)
self._onLoginStateChanged(is_logged_in = False)
## Check if the prerequsites are in place to start the cloud flow
def checkCloudFlowIsPossible(self):
Logger.log("d", "Checking if cloud connection is possible...")
# Check #1: User is logged in with an Ultimaker account
if not self._account.isLoggedIn:
Logger.log("d", "Cloud Flow not possible: User not logged in!")
return
# Check #2: Machine has a network connection
if not self._application.getMachineManager().activeMachineHasActiveNetworkConnection:
Logger.log("d", "Cloud Flow not possible: Machine is not connected!")
# TODO: This should only be network connections, not cloud connections
return
# Check #3: Machine has correct firmware version
# Logger.log("d", "Cloud Flow not possible: Machine does not have necessary firmware!")
# return
# TODO: Check if machine is already set up to be cloud
self.cloudFlowIsPossible.emit()
Logger.log("d", "Cloud flow is ready to go!")
def _onCloudFlowPossible(self):
# Cloud flow is possible, so show the message
self._start_cloud_flow_message = Message(self.I18N_CATALOG.i18nc("@info:status", "Chain so thin when a breeze roll by, man it flow... man it flow..."))
self._start_cloud_flow_message.show()
return