diff --git a/cura/Machines/Models/ExtrudersModel.py b/cura/Machines/Models/ExtrudersModel.py index 98865ed37e..e979a1e848 100644 --- a/cura/Machines/Models/ExtrudersModel.py +++ b/cura/Machines/Models/ExtrudersModel.py @@ -53,6 +53,9 @@ class ExtrudersModel(ListModel): EnabledRole = Qt.UserRole + 11 """Is the extruder enabled?""" + MaterialTypeRole = Qt.UserRole + 12 + """The type of the material (e.g. PLA, ABS, PETG, etc.).""" + defaultColors = ["#ffc924", "#86ec21", "#22eeee", "#245bff", "#9124ff", "#ff24c8"] """List of colours to display if there is no material or the material has no known colour. """ @@ -75,6 +78,7 @@ class ExtrudersModel(ListModel): self.addRoleName(self.StackRole, "stack") self.addRoleName(self.MaterialBrandRole, "material_brand") self.addRoleName(self.ColorNameRole, "color_name") + self.addRoleName(self.MaterialTypeRole, "material_type") self._update_extruder_timer = QTimer() self._update_extruder_timer.setInterval(100) self._update_extruder_timer.setSingleShot(True) @@ -193,7 +197,8 @@ class ExtrudersModel(ListModel): "variant": extruder.variant.getName() if extruder.variant else "", # e.g. print core "stack": extruder, "material_brand": material_brand, - "color_name": color_name + "color_name": color_name, + "material_type": extruder.material.getMetaDataEntry("material") if extruder.material else "", } items.append(item) @@ -218,6 +223,7 @@ class ExtrudersModel(ListModel): "stack": None, "material_brand": "", "color_name": "", + "material_type": "", } items.append(item) if self._items != items: diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index d388bd7a7e..6f9f30e7e6 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -63,9 +63,9 @@ Cura.ExpandablePopup // Label for the brand of the material Label { - id: typeAndBrandNameLabel + id: materialBrandColorTypeLabel - text: model.material_brand + " " + model.material + text: model.material_brand == model.color_name ? model.color_name + " " + model.material_type : model.material_brand + " " + model.color_name + " " + model.material_type elide: Text.ElideRight font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") @@ -79,6 +79,50 @@ Cura.ExpandablePopup right: parent.right rightMargin: UM.Theme.getSize("default_margin").width } + visible: !truncated + } + + Label + { + id: materialColorTypeLabel + + text: model.color_name + " " + model.material_type + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + + anchors + { + top: extruderIcon.top + left: extruderIcon.right + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + } + + visible: !materialBrandColorTypeLabel.visible && !truncated + } + + Label + { + id: materialTypeLabel + + text: model.material_type + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + + anchors + { + top: extruderIcon.top + left: extruderIcon.right + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + } + visible: !materialBrandColorTypeLabel.visible && !materialColorTypeLabel.visible } // Label that shows the name of the variant Label @@ -97,7 +141,7 @@ Cura.ExpandablePopup { left: extruderIcon.right leftMargin: UM.Theme.getSize("default_margin").width - top: typeAndBrandNameLabel.bottom + top: materialBrandColorTypeLabel.bottom right: parent.right rightMargin: UM.Theme.getSize("default_margin").width }