mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Fix more review comments
This commit is contained in:
parent
3c10cca0de
commit
7bbd43928a
5 changed files with 7 additions and 7 deletions
|
@ -11,7 +11,7 @@ from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply, QNetworkAccessManage
|
|||
from UM.Logger import Logger
|
||||
from cura import UltimakerCloudAuthentication
|
||||
from cura.API import Account
|
||||
from .MeshUploader import MeshUploader
|
||||
from .ToolPathUploader import ToolPathUploader
|
||||
from ..Models import BaseModel
|
||||
from .Models.CloudClusterResponse import CloudClusterResponse
|
||||
from .Models.CloudError import CloudError
|
||||
|
@ -42,7 +42,7 @@ class CloudApiClient:
|
|||
self._manager = QNetworkAccessManager()
|
||||
self._account = account
|
||||
self._on_error = on_error
|
||||
self._upload = None # type: Optional[MeshUploader]
|
||||
self._upload = None # type: Optional[ToolPathUploader]
|
||||
# In order to avoid garbage collection we keep the callbacks in this list.
|
||||
self._anti_gc_callbacks = [] # type: List[Callable[[], None]]
|
||||
|
||||
|
@ -84,7 +84,7 @@ class CloudApiClient:
|
|||
# \param on_error: A function to be called if the upload fails.
|
||||
def uploadToolPath(self, print_job: CloudPrintJobResponse, mesh: bytes, on_finished: Callable[[], Any],
|
||||
on_progress: Callable[[int], Any], on_error: Callable[[], Any]):
|
||||
self._upload = MeshUploader(self._manager, print_job, mesh, on_finished, on_progress, on_error)
|
||||
self._upload = ToolPathUploader(self._manager, print_job, mesh, on_finished, on_progress, on_error)
|
||||
self._upload.start()
|
||||
|
||||
# Requests a cluster to print the given print job.
|
||||
|
|
|
@ -100,6 +100,8 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
|
|||
|
||||
## Connects this device.
|
||||
def connect(self) -> None:
|
||||
if self.isConnected():
|
||||
return
|
||||
super().connect()
|
||||
Logger.log("i", "Connected to cluster %s", self.key)
|
||||
CuraApplication.getInstance().getBackend().backendStateChange.connect(self._onBackendStateChange)
|
||||
|
|
|
@ -131,7 +131,6 @@ class CloudOutputDeviceManager:
|
|||
|
||||
## Connects to an output device and makes sure it is registered in the output device manager.
|
||||
def _connectToOutputDevice(self, device: CloudOutputDevice) -> None:
|
||||
if not device.isConnected():
|
||||
device.connect()
|
||||
self._output_device_manager.addOutputDevice(device)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ from .Models.CloudPrintJobResponse import CloudPrintJobResponse
|
|||
|
||||
|
||||
## Class responsible for uploading meshes to the cloud in separate requests.
|
||||
class MeshUploader:
|
||||
class ToolPathUploader:
|
||||
|
||||
# The maximum amount of times to retry if the server returns one of the RETRY_HTTP_CODES
|
||||
MAX_RETRIES = 10
|
|
@ -125,5 +125,4 @@ class TestCloudOutputDeviceManager(TestCase):
|
|||
}
|
||||
self.network.prepareReply("GET", self.URL, 200, self.clusters_response)
|
||||
self._loadData()
|
||||
message_mock.assert_called_once_with(text='Not found!', title='Error', lifetime=10, dismissable=True)
|
||||
message_mock.return_value.show.assert_called_once_with()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue