Added stub for AbstractCloudOutputDevice

It doesn't actually allow you to send a print, but it does ask some info from the API

CURA-8463
This commit is contained in:
Jaime van Kessel 2022-08-30 15:48:10 +02:00
parent 38e4ca1e0f
commit 6fed6b824c
No known key found for this signature in database
GPG key ID: C85F7A3AF1BAA7C4
4 changed files with 146 additions and 16 deletions

View file

@ -61,7 +61,6 @@ class CloudApiClient:
@property
def account(self) -> Account:
"""Gets the account used for the API."""
return self._account
def getClusters(self, on_finished: Callable[[List[CloudClusterResponse]], Any], failed: Callable) -> None:
@ -77,6 +76,24 @@ class CloudApiClient:
error_callback = failed,
timeout = self.DEFAULT_REQUEST_TIMEOUT)
def getClustersByMachineType(self, machine_type, on_finished: Callable[[List[CloudClusterResponse]], Any], failed: Callable) -> None:
# HACK: There is something weird going on with the API, as it reports printer types in formats like
# "ultimaker_s3", but wants "Ultimaker S3" when using the machine_variant filter query. So we need to do some
# conversion!
machine_type = machine_type.replace("_plus", "+")
machine_type = machine_type.replace("_", " ")
machine_type = machine_type.replace("ultimaker", "ultimaker ")
machine_type = machine_type.replace(" ", " ")
machine_type = machine_type.title()
url = f"{self.CLUSTER_API_ROOT}/clusters?machine_variant={machine_type}"
self._http.get(url,
scope=self._scope,
callback=self._parseCallback(on_finished, CloudClusterResponse, failed),
error_callback=failed,
timeout=self.DEFAULT_REQUEST_TIMEOUT)
def getClusterStatus(self, cluster_id: str, on_finished: Callable[[CloudClusterStatus], Any]) -> None:
"""Retrieves the status of the given cluster.