diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index ef8bdb86dc..f273f537e3 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -9,7 +9,6 @@ from PyQt5.QtGui import QDesktopServices from UM import i18nCatalog from UM.Backend.Backend import BackendState from UM.FileHandler.FileHandler import FileHandler -from UM.FileHandler.WriteFileJob import WriteFileJob from UM.Logger import Logger from UM.Message import Message from UM.Scene.SceneNode import SceneNode @@ -191,11 +190,12 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): ## Handler for when the print job was created locally. # It can now be sent over the cloud. - def _onPrintJobCreated(self, job: WriteFileJob) -> None: - self._tool_path = job.getOutput() + def _onPrintJobCreated(self, job: ExportFileJob) -> None: + output = job.getOutput() + self._tool_path = output # store the tool path to prevent re-uploading when printing the same file again request = CloudPrintJobUploadRequest( job_name=job.getFileName(), - file_size=len(self._tool_path), + file_size=len(output), content_type=job.getMimeType(), ) self._api.requestUpload(request, self._uploadPrintJob) @@ -203,6 +203,8 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): ## Uploads the mesh when the print job was registered with the cloud API. # \param job_response: The response received from the cloud API. def _uploadPrintJob(self, job_response: CloudPrintJobResponse) -> None: + if not self._tool_path: + return self._onUploadError() self._progress.show() self._uploaded_print_job = job_response # store the last uploaded job to prevent re-upload of the same file self._api.uploadToolPath(job_response, self._tool_path, self._onPrintJobUploaded, self._progress.update, diff --git a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py index 6f48fa26a4..47a7df7faf 100644 --- a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py @@ -46,7 +46,7 @@ class LocalClusterOutputDeviceManager: self._zero_conf_client.removedNetworkCluster.connect(self._onDiscoveredDeviceRemoved) # Persistent dict containing manually connected clusters. - self._manual_instances = {} # type: Dict[str, Callable] + self._manual_instances = {} # type: Dict[str, Optional[Callable]] ## Start the network discovery. def start(self) -> None: