diff --git a/plugins/UM3NetworkPrinting/src/MeshFormatHandler.py b/plugins/UM3NetworkPrinting/src/MeshFormatHandler.py index c3cd82a86d..2f01743dd6 100644 --- a/plugins/UM3NetworkPrinting/src/MeshFormatHandler.py +++ b/plugins/UM3NetworkPrinting/src/MeshFormatHandler.py @@ -90,9 +90,11 @@ class MeshFormatHandler: machine_file_formats = global_stack.getMetaDataEntry("file_formats").split(";") machine_file_formats = [file_type.strip() for file_type in machine_file_formats] - # Exception for UM3 firmware version >=4.4: UFP is now supported and should be the preferred file format. - if "application/x-ufp" not in machine_file_formats and Version(firmware_version) >= Version("4.4"): - machine_file_formats = ["application/x-ufp"] + machine_file_formats + + # TODO: re-enable UFP after Cura master branch works again + # # Exception for UM3 firmware version >=4.4: UFP is now supported and should be the preferred file format. + # if "application/x-ufp" not in machine_file_formats and Version(firmware_version) >= Version("4.4"): + # machine_file_formats = ["application/x-ufp"] + machine_file_formats # Take the intersection between file_formats and machine_file_formats. format_by_mimetype = {f["mime_type"]: f for f in file_formats} diff --git a/plugins/UM3NetworkPrinting/src/Network/NetworkOutputDevice.py b/plugins/UM3NetworkPrinting/src/Network/NetworkOutputDevice.py index 5e66bdacf8..7249683f4b 100644 --- a/plugins/UM3NetworkPrinting/src/Network/NetworkOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Network/NetworkOutputDevice.py @@ -4,6 +4,7 @@ from typing import Optional, Dict, List, Any from PyQt5.QtGui import QDesktopServices from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty +from PyQt5.QtNetwork import QNetworkReply from UM.FileHandler.FileHandler import FileHandler from UM.FileHandler.WriteFileJob import WriteFileJob @@ -167,11 +168,15 @@ class NetworkOutputDevice(UltimakerNetworkedPrinterOutputDevice): # It can now be sent over the network. def _onPrintJobCreated(self, job: WriteFileJob) -> None: self._progress.show() + # TODO: extract multi-part stuff parts = [] parts.append(self._createFormPart("name=owner", bytes(self._getUserName(), "utf-8"), "text/plain")) output = job.getStream().getvalue() + if isinstance(output, str): + # Ensure that our output is bytes + output = output.encode("utf-8") parts.append(self._createFormPart("name=\"file\"; filename=\"%s\"" % job.getFileName(), output)) - self.postFormWithParts("print_jobs/", parts, on_finished=self._onPrintUploadCompleted, + self.postFormWithParts("/cluster-api/v1/print_jobs/", parts, on_finished=self._onPrintUploadCompleted, on_progress=self._onPrintJobUploadProgress) ## Handler for print job upload progress. @@ -181,7 +186,7 @@ class NetworkOutputDevice(UltimakerNetworkedPrinterOutputDevice): self.writeProgress.emit() ## Handler for when the print job was fully uploaded to the cluster. - def _onPrintUploadCompleted(self) -> None: + def _onPrintUploadCompleted(self, reply: QNetworkReply) -> None: self._progress.hide() Message( text=I18N_CATALOG.i18nc("@info:status", "Print job was successfully sent to the printer."),