mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 09:56:04 +08:00
Merge branch 'CURA-11377' of github.com:Ultimaker/Cura
This commit is contained in:
commit
d5574f36c0
@ -58,7 +58,6 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||||||
|
|
||||||
# The minimum version of firmware that support print job actions over cloud.
|
# The minimum version of firmware that support print job actions over cloud.
|
||||||
PRINT_JOB_ACTIONS_MIN_VERSION = Version("5.2.12")
|
PRINT_JOB_ACTIONS_MIN_VERSION = Version("5.2.12")
|
||||||
PRINT_JOB_ACTIONS_MIN_VERSION_METHOD = Version("2.700")
|
|
||||||
|
|
||||||
# Notify can only use signals that are defined by the class that they are in, not inherited ones.
|
# Notify can only use signals that are defined by the class that they are in, not inherited ones.
|
||||||
# Therefore, we create a private signal used to trigger the printersChanged signal.
|
# Therefore, we create a private signal used to trigger the printersChanged signal.
|
||||||
@ -214,7 +213,12 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Export the scene to the correct file type.
|
# Export the scene to the correct file type.
|
||||||
job = ExportFileJob(file_handler=file_handler, nodes=nodes, firmware_version=self.firmwareVersion)
|
job = ExportFileJob(
|
||||||
|
file_handler=file_handler,
|
||||||
|
nodes=nodes,
|
||||||
|
firmware_version=self.firmwareVersion,
|
||||||
|
print_type=self.printerType,
|
||||||
|
)
|
||||||
job.finished.connect(self._onPrintJobCreated)
|
job.finished.connect(self._onPrintJobCreated)
|
||||||
job.start()
|
job.start()
|
||||||
|
|
||||||
@ -319,19 +323,29 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||||||
PrintJobUploadErrorMessage(message).show()
|
PrintJobUploadErrorMessage(message).show()
|
||||||
self.writeError.emit()
|
self.writeError.emit()
|
||||||
|
|
||||||
|
@pyqtProperty(bool, notify=_cloudClusterPrintersChanged)
|
||||||
|
def isMethod(self) -> bool:
|
||||||
|
"""Whether the printer that this output device represents is a Method series printer."""
|
||||||
|
|
||||||
|
if not self._printers:
|
||||||
|
return False
|
||||||
|
|
||||||
|
[printer, *_] = self._printers
|
||||||
|
return printer.pinterType in ("ultimaker_methodx", "ultimaker_methodxl")
|
||||||
|
|
||||||
@pyqtProperty(bool, notify=_cloudClusterPrintersChanged)
|
@pyqtProperty(bool, notify=_cloudClusterPrintersChanged)
|
||||||
def supportsPrintJobActions(self) -> bool:
|
def supportsPrintJobActions(self) -> bool:
|
||||||
"""Whether the printer that this output device represents supports print job actions via the cloud."""
|
"""Whether the printer that this output device represents supports print job actions via the cloud."""
|
||||||
|
|
||||||
if not self._printers:
|
if not self._printers:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if self.isMethod:
|
||||||
|
return True
|
||||||
|
|
||||||
version_number = self.printers[0].firmwareVersion.split(".")
|
version_number = self.printers[0].firmwareVersion.split(".")
|
||||||
if len(version_number)> 2:
|
firmware_version = Version([version_number[0], version_number[1], version_number[2]])
|
||||||
firmware_version = Version([version_number[0], version_number[1], version_number[2]])
|
return firmware_version >= self.PRINT_JOB_ACTIONS_MIN_VERSION
|
||||||
return firmware_version >= self.PRINT_JOB_ACTIONS_MIN_VERSION
|
|
||||||
else:
|
|
||||||
firmware_version = Version([version_number[0], version_number[1]])
|
|
||||||
return firmware_version >= self.PRINT_JOB_ACTIONS_MIN_VERSION_METHOD
|
|
||||||
|
|
||||||
|
|
||||||
@pyqtProperty(bool, constant = True)
|
@pyqtProperty(bool, constant = True)
|
||||||
|
@ -16,9 +16,9 @@ from .MeshFormatHandler import MeshFormatHandler
|
|||||||
class ExportFileJob(WriteFileJob):
|
class ExportFileJob(WriteFileJob):
|
||||||
"""Job that exports the build plate to the correct file format for the target cluster."""
|
"""Job that exports the build plate to the correct file format for the target cluster."""
|
||||||
|
|
||||||
def __init__(self, file_handler: Optional[FileHandler], nodes: List[SceneNode], firmware_version: str) -> None:
|
def __init__(self, file_handler: Optional[FileHandler], nodes: List[SceneNode], firmware_version: str,
|
||||||
|
print_type: str) -> None:
|
||||||
self._mesh_format_handler = MeshFormatHandler(file_handler, firmware_version)
|
self._mesh_format_handler = MeshFormatHandler(file_handler, firmware_version, print_type)
|
||||||
if not self._mesh_format_handler.is_valid:
|
if not self._mesh_format_handler.is_valid:
|
||||||
Logger.log("e", "Missing file or mesh writer!")
|
Logger.log("e", "Missing file or mesh writer!")
|
||||||
return
|
return
|
||||||
|
@ -19,10 +19,9 @@ I18N_CATALOG = i18nCatalog("cura")
|
|||||||
class MeshFormatHandler:
|
class MeshFormatHandler:
|
||||||
"""This class is responsible for choosing the formats used by the connected clusters."""
|
"""This class is responsible for choosing the formats used by the connected clusters."""
|
||||||
|
|
||||||
|
def __init__(self, file_handler: Optional[FileHandler], firmware_version: str, printer_type: str) -> None:
|
||||||
def __init__(self, file_handler: Optional[FileHandler], firmware_version: str) -> None:
|
|
||||||
self._file_handler = file_handler or CuraApplication.getInstance().getMeshFileHandler()
|
self._file_handler = file_handler or CuraApplication.getInstance().getMeshFileHandler()
|
||||||
self._preferred_format = self._getPreferredFormat(firmware_version)
|
self._preferred_format = self._getPreferredFormat(firmware_version, printer_type)
|
||||||
self._writer = self._getWriter(self.mime_type) if self._preferred_format else None
|
self._writer = self._getWriter(self.mime_type) if self._preferred_format else None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -82,7 +81,7 @@ class MeshFormatHandler:
|
|||||||
value = value.encode()
|
value = value.encode()
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def _getPreferredFormat(self, firmware_version: str) -> Dict[str, Union[str, int, bool]]:
|
def _getPreferredFormat(self, firmware_version: str, printer_type: str) -> Dict[str, Union[str, int, bool]]:
|
||||||
"""Chooses the preferred file format for the given file handler.
|
"""Chooses the preferred file format for the given file handler.
|
||||||
|
|
||||||
:param firmware_version: The version of the firmware.
|
:param firmware_version: The version of the firmware.
|
||||||
@ -103,13 +102,11 @@ class MeshFormatHandler:
|
|||||||
machine_file_formats = [file_type.strip() for file_type in machine_file_formats]
|
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.
|
# 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"):
|
if printer_type in (
|
||||||
|
"ultimaker3", "ultimaker3_extended") and "application/x-ufp" not in machine_file_formats and Version(
|
||||||
|
firmware_version) >= Version("4.4"):
|
||||||
machine_file_formats = ["application/x-ufp"] + machine_file_formats
|
machine_file_formats = ["application/x-ufp"] + machine_file_formats
|
||||||
|
|
||||||
# Exception for makerbot firmware version >=2.700: makerbot is supported
|
|
||||||
elif "application/x-makerbot" not in machine_file_formats and Version(firmware_version >= Version("2.700")):
|
|
||||||
machine_file_formats = ["application/x-makerbot"] + machine_file_formats
|
|
||||||
|
|
||||||
# Take the intersection between file_formats and 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}
|
format_by_mimetype = {f["mime_type"]: f for f in file_formats}
|
||||||
|
|
||||||
|
@ -146,7 +146,12 @@ class LocalClusterOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||||||
self.writeStarted.emit(self)
|
self.writeStarted.emit(self)
|
||||||
|
|
||||||
# Export the scene to the correct file type.
|
# Export the scene to the correct file type.
|
||||||
job = ExportFileJob(file_handler=file_handler, nodes=nodes, firmware_version=self.firmwareVersion)
|
job = ExportFileJob(
|
||||||
|
file_handler=file_handler,
|
||||||
|
nodes=nodes,
|
||||||
|
firmware_version=self.firmwareVersion,
|
||||||
|
print_type=self.printerType,
|
||||||
|
)
|
||||||
job.finished.connect(self._onPrintJobCreated)
|
job.finished.connect(self._onPrintJobCreated)
|
||||||
job.start()
|
job.start()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user