Skip to content

Commit

Permalink
Use the material name instead of brand + type + color
Browse files Browse the repository at this point in the history
CURA-8514
Fixes Ultimaker#10421
  • Loading branch information
nallath committed Oct 19, 2021
1 parent 89c5a38 commit 2baada8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion cura/Machines/Models/ExtrudersModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class ExtrudersModel(ListModel):
defaultColors = ["#ffc924", "#86ec21", "#22eeee", "#245bff", "#9124ff", "#ff24c8"]
"""List of colours to display if there is no material or the material has no known colour. """

MaterialNameRole = Qt.UserRole + 13

def __init__(self, parent = None):
"""Initialises the extruders model, defining the roles and listening for changes in the data.
Expand All @@ -79,6 +81,7 @@ def __init__(self, parent = None):
self.addRoleName(self.MaterialBrandRole, "material_brand")
self.addRoleName(self.ColorNameRole, "color_name")
self.addRoleName(self.MaterialTypeRole, "material_type")
self.addRoleName(self.MaterialNameRole, "material_name")
self._update_extruder_timer = QTimer()
self._update_extruder_timer.setInterval(100)
self._update_extruder_timer.setSingleShot(True)
Expand Down Expand Up @@ -199,8 +202,8 @@ def __updateExtruders(self):
"material_brand": material_brand,
"color_name": color_name,
"material_type": extruder.material.getMetaDataEntry("material") if extruder.material else "",
"material_name": extruder.material.getMetaDataEntry("name") if extruder.material else "",
}

items.append(item)
extruders_changed = True

Expand All @@ -224,6 +227,7 @@ def __updateExtruders(self):
"material_brand": "",
"color_name": "",
"material_type": "",
"material_label": ""
}
items.append(item)
if self._items != items:
Expand Down
12 changes: 6 additions & 6 deletions resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ Cura.ExpandablePopup
// Label for the brand of the material
Label
{
id: materialBrandColorTypeLabel
id: materialBrandNameLabel

text: model.material_brand == model.color_name ? model.color_name + " " + model.material_type : model.material_brand + " " + model.color_name + " " + model.material_type
text: model.material_brand + " " + model.material_name
elide: Text.ElideRight
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
Expand All @@ -92,15 +92,15 @@ Cura.ExpandablePopup

Label
{
id: materialColorTypeLabel
id: materialNameLabel

text: model.color_name + " " + model.material_type
text: model.material_name
elide: Text.ElideRight
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
renderType: Text.NativeRendering
width: parent.width
visible: !materialBrandColorTypeLabel.visible && !truncated
visible: !materialBrandNameLabel.visible && !truncated
}

Label
Expand All @@ -113,7 +113,7 @@ Cura.ExpandablePopup
color: UM.Theme.getColor("text")
renderType: Text.NativeRendering
width: parent.width
visible: !materialBrandColorTypeLabel.visible && !materialColorTypeLabel.visible
visible: !materialBrandNameLabel.visible && !materialNameLabel.visible
}
// Label that shows the name of the variant
Label
Expand Down

0 comments on commit 2baada8

Please sign in to comment.