From 39d9ab7afb7f56da5cc4652129fe552621888751 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 17 Jul 2024 18:05:33 +0200 Subject: [PATCH] Allow DigitalFactory bundled-plugin to autoselect format on save. There was an earlier implementation of this, which was hacky, and didn't work anymore. CURA-11958 --- cura/Settings/GlobalStack.py | 9 +++++++++ .../resources/qml/SaveProjectFilesPage.qml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index 25fc74b28f..1bef64f7aa 100755 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -83,6 +83,15 @@ class GlobalStack(CuraContainerStack): """ return self.getMetaDataEntry("supports_material_export", False) + @pyqtProperty("QVariantList", constant = True) + def getOutputFileFormats(self) -> List[str]: + """ + Which output formats the printer supports. + :return: A list of strings with MIME-types. + """ + all_formats_str = self.getMetaDataEntry("file_formats", "") + return all_formats_str.split(";") + @classmethod def getLoadingPriority(cls) -> int: return 2 diff --git a/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml b/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml index 0b79b77a08..ee827a6d68 100644 --- a/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml +++ b/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml @@ -208,7 +208,7 @@ Item anchors.rightMargin: UM.Theme.getSize("thin_margin").height enabled: UM.Backend.state == UM.Backend.Done - currentIndex: UM.Backend.state == UM.Backend.Done ? dfFilenameTextfield.text.startsWith("MM")? 1 : 0 : 2 + currentIndex: UM.Backend.state == UM.Backend.Done ? (Cura.MachineManager.activeMachine.getOutputFileFormats.includes("application/x-makerbot") ? 1 : 0) : 2 textRole: "text" valueRole: "value"