diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 6ba1274a49..4dedf9db16 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -89,8 +89,12 @@ class PrintInformation(QObject): for index, amount in enumerate(material_amounts): ## Find the right extruder stack. As the list isn't sorted because it's a annoying generator, we do some # list comprehension filtering to solve this for us. - extruder_stack = [extruder for extruder in extruder_stacks if extruder.getMetaDataEntry("position") == str(index)][0] - density = extruder_stack.getMetaDataEntry("properties", {}).get("density", 0) + if extruder_stacks: # Multi extrusion machine + extruder_stack = [extruder for extruder in extruder_stacks if extruder.getMetaDataEntry("position") == str(index)][0] + density = extruder_stack.getMetaDataEntry("properties", {}).get("density", 0) + else: # Machine with no extruder stacks + density = Application.getInstance().getGlobalContainerStack().getMetaDataEntry("properties", {}).get("density", 0) + self._material_weights.append(float(amount) * float(density)) self._material_lengths.append(round((amount / (math.pi * r ** 2)) / 1000, 2)) self.materialLengthsChanged.emit() diff --git a/cura/Settings/ContainerSettingsModel.py b/cura/Settings/ContainerSettingsModel.py index 9ec19ed7fb..a0bdb7f41f 100644 --- a/cura/Settings/ContainerSettingsModel.py +++ b/cura/Settings/ContainerSettingsModel.py @@ -1,3 +1,6 @@ +# Copyright (c) 2016 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + from UM.Application import Application from UM.Qt.ListModel import ListModel diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index 5b715230e2..a726e239e0 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -174,18 +174,19 @@ class StartSliceJob(Job): def _buildExtruderMessage(self, stack): message = self._slice_message.addRepeatedMessage("extruders") message.id = int(stack.getMetaDataEntry("position")) + + material_instance_container = stack.findContainer({"type": "material"}) + for key in stack.getAllKeys(): setting = message.getMessage("settings").addRepeatedMessage("settings") setting.name = key - setting.value = str(stack.getProperty(key, "value")).encode("utf-8") + if key == "material_guid" and material_instance_container: + # Also send the material GUID. This is a setting in fdmprinter, but we have no interface for it. + setting.value = str(material_instance_container.getMetaDataEntry("GUID", "")).encode("utf-8") + else: + setting.value = str(stack.getProperty(key, "value")).encode("utf-8") Job.yieldThread() - # ALso send the material GUID as a setting. - material_instance_container = stack.findContainer({"type": "material"}) - if material_instance_container: - setting = message.getMessage("settings").addRepeatedMessage("settings") - setting.name = "material_GUID" - setting.value = str(material_instance_container.getMetaDataEntry("GUID", "")).encode("utf-8") ## Sends all global settings to the engine. # # The settings are taken from the global stack. This does not include any diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/VersionUpgrade21to22.py b/plugins/VersionUpgrade/VersionUpgrade21to22/VersionUpgrade21to22.py index a45a4a6e79..2493e23405 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/VersionUpgrade21to22.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/VersionUpgrade21to22.py @@ -18,7 +18,11 @@ _printer_translations = { _profile_translations = { "PLA": "generic_pla", "ABS": "generic_abs", - "CPE": "generic_cpe" + "CPE": "generic_cpe", + "Low Quality": "low", + "Normal Quality": "normal", + "High Quality": "high", + "Ulti Quality": "high" #This one doesn't have an equivalent. Map it to high. } ## How to translate setting names from the old version to the new. diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 8833c175f3..839811fe73 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -57,6 +57,14 @@ "settable_per_extruder": false, "settable_per_meshgroup": false }, + "material_guid": + { + "label": "Material GUID", + "description": "GUID of the material. This is set automatically. ", + "default_value": "", + "type": "str", + "enabled": false + }, "material_bed_temp_wait": { "label": "Wait for bed heatup", @@ -984,6 +992,29 @@ "value": "layer_height", "settable_per_mesh": true }, + "gradual_infill_steps": + { + "label": "Gradual Infill Steps", + "description": "Number of times to reduce the infill density by half when getting further below top surfaces. Areas which are closer to top surfaces get a higher density, up to the Infill Density.", + "default_value": 0, + "type": "int", + "minimum_value": "0", + "maximum_value_warning": "4", + "maximum_value": "17", + "settable_per_mesh": true + }, + "gradual_infill_step_height": + { + "label": "Gradual Infill Step Height", + "description": "The height of infill of a given density before switching to half the density.", + "unit": "mm", + "type": "float", + "default_value": 5.0, + "minimum_value": "0.0001", + "maximum_value_warning": "100", + "enabled": "gradual_infill_steps > 0", + "settable_per_mesh": true + }, "infill_before_walls": { "label": "Infill Before Walls", diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index f70dffa3cc..604f8e0b92 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -506,6 +506,75 @@ UM.MainWindow onTriggered: preferences.getCurrentItem().showProfileNameDialog() } + // BlurSettings is a way to force the focus away from any of the setting items. + // We need to do this in order to keep the bindings intact. + Connections + { + target: Cura.MachineManager + onBlurSettings: + { + contentItem.focus = true + } + } + + // Workaround for shortcuts not working for singletons. + // The main window eats all the events, so we need to pass them manually. + Action + { + shortcut: StandardKey.Undo + onTriggered: Cura.Actions.undo.trigger() + } + Action + { + shortcut: StandardKey.Redo + onTriggered: Cura.Actions.redo.trigger() + } + Action + { + shortcut: StandardKey.Quit + onTriggered: Cura.Actions.quit.trigger() + } + Action + { + shortcut: StandardKey.Help + onTriggered: Cura.Actions.help.trigger() + } + Action + { + shortcut: StandardKey.Delete + onTriggered: Cura.Actions.delete.trigger() + } + Action + { + shortcut: "Ctrl+G" + onTriggered: Cura.Actions.groupObjects.trigger() + } + Action + { + shortcut: "Ctrl+Shift+G" + onTriggered: Cura.Actions.unGroupObjects.trigger() + } + Action + { + shortcut: "Ctrl+Alt+G" + onTriggered: Cura.Actions.mergeObjects.trigger() + } + Action + { + shortcut: "Ctrl+D" + onTriggered: Cura.Actions.deleteAll.trigger() + } + Action + { + shortcut: StandardKey.Open + onTriggered: Cura.Actions.open.trigger() + } + Action + { + shortcut: StandardKey.WhatsThis + onTriggered: Cura.Actions.showEngineLog.trigger() + } + Menu { id: objectContextMenu; diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index 69272764c9..a7bdabb3c5 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -248,14 +248,5 @@ Item { } } - Connections - { - target: Cura.MachineManager - onBlurSettings: - { - revertButton.focus = true - } - } - UM.I18nCatalog { id: catalog; name: "cura" } }