Fix typing for cluster list

This commit is contained in:
ChrisTerBeke 2018-11-26 14:54:24 +01:00
parent 856276d8b7
commit 269d596f5d
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
import json import json
from typing import Dict, Optional from typing import Dict, Optional, List
from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply
@ -76,7 +76,7 @@ class CloudOutputDeviceManager(NetworkClient):
# self._addCloudOutputDevice({ "cluster_id": "LJ0tciiuZZjarrXAvFLEZ6ox4Cvx8FvtXUlQv4vIhV6w" }) # self._addCloudOutputDevice({ "cluster_id": "LJ0tciiuZZjarrXAvFLEZ6ox4Cvx8FvtXUlQv4vIhV6w" })
@staticmethod @staticmethod
def _parseStatusResponse(reply: QNetworkReply) -> Optional[Cluster]: def _parseStatusResponse(reply: QNetworkReply) -> List[CloudCluster]:
try: try:
return [CloudCluster(**c) for c in json.loads(reply.readAll().data().decode("utf-8"))] return [CloudCluster(**c) for c in json.loads(reply.readAll().data().decode("utf-8"))]
except UnicodeDecodeError: except UnicodeDecodeError:
@ -85,7 +85,7 @@ class CloudOutputDeviceManager(NetworkClient):
Logger.logException("w", "Unable to decode JSON from reply.") Logger.logException("w", "Unable to decode JSON from reply.")
except ValueError: except ValueError:
Logger.logException("w", "Response was missing values.") Logger.logException("w", "Response was missing values.")
return None return []
## Adds a CloudOutputDevice for each entry in the remote cluster list from the API. ## Adds a CloudOutputDevice for each entry in the remote cluster list from the API.
def _addCloudOutputDevice(self, cluster: CloudCluster): def _addCloudOutputDevice(self, cluster: CloudCluster):

View file

@ -34,7 +34,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
self._zero_conf = None self._zero_conf = None
self._zero_conf_browser = None self._zero_conf_browser = None
# Create a cloud output device manager that abstract all cloud connection logic away. # Create a cloud output device manager that abstracts all cloud connection logic away.
self._cloud_output_device_manager = CloudOutputDeviceManager() self._cloud_output_device_manager = CloudOutputDeviceManager()
# Because the model needs to be created in the same thread as the QMLEngine, we use a signal. # Because the model needs to be created in the same thread as the QMLEngine, we use a signal.