diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 301dff3d20..4800950fab 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -199,7 +199,7 @@ class CuraApplication(QtApplication): self._message_box_callback = None self._message_box_callback_arguments = [] - + self._preferred_mimetype = "" self._i18n_catalog = i18nCatalog("cura") self.getController().getScene().sceneChanged.connect(self.updatePlatformActivity) @@ -314,6 +314,9 @@ class CuraApplication(QtApplication): self.applicationShuttingDown.connect(self.saveSettings) self.engineCreatedSignal.connect(self._onEngineCreated) + + self.globalContainerStackChanged.connect(self._onGlobalContainerChanged) + self._onGlobalContainerChanged() self._recent_files = [] files = Preferences.getInstance().getValue("cura/recent_files").split(";") for f in files: @@ -731,14 +734,30 @@ class CuraApplication(QtApplication): self._camera_animation.setTarget(Selection.getSelectedObject(0).getWorldPosition()) self._camera_animation.start() + def _onGlobalContainerChanged(self): + if self._global_container_stack is not None: + machine_file_formats = [file_type.strip() for file_type in self._global_container_stack.getMetaDataEntry("file_formats").split(";")] + new_preferred_mimetype = "" + if machine_file_formats: + new_preferred_mimetype = machine_file_formats[0] + + if new_preferred_mimetype != self._preferred_mimetype: + self._preferred_mimetype = new_preferred_mimetype + self.preferredOutputMimetypeChanged.emit() + requestAddPrinter = pyqtSignal() activityChanged = pyqtSignal() sceneBoundingBoxChanged = pyqtSignal() + preferredOutputMimetypeChanged = pyqtSignal() @pyqtProperty(bool, notify = activityChanged) def platformActivity(self): return self._platform_activity + @pyqtProperty(str, notify=preferredOutputMimetypeChanged) + def preferredOutputMimetype(self): + return self._preferred_mimetype + @pyqtProperty(str, notify = sceneBoundingBoxChanged) def getSceneBoundingBoxString(self): return self._i18n_catalog.i18nc("@info", "%(width).1f x %(depth).1f x %(height).1f mm") % {'width' : self._scene_bounding_box.width.item(), 'depth': self._scene_bounding_box.depth.item(), 'height' : self._scene_bounding_box.height.item()} diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index bbc40b6627..fef4f3780d 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -215,7 +215,7 @@ Item { text: UM.OutputDeviceManager.activeDeviceShortDescription onClicked: { - UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName, { "filter_by_machine": true }) + UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName, { "filter_by_machine": true, "preferred_mimetype":Printer.preferredOutputMimetype }) } style: ButtonStyle {