Merge branch 'master' into CURA-8055_export_all_materials_usb_redone

This commit is contained in:
Ghostkeeper 2021-07-23 15:11:07 +02:00
commit 82c7f19164
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
487 changed files with 4988 additions and 2890 deletions

View file

@ -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)
@ -210,7 +215,7 @@ class ExtrudersModel(ListModel):
"id": "",
"name": catalog.i18nc("@menuitem", "Not overridden"),
"enabled": True,
"color": "#ffffff",
"color": "transparent",
"index": -1,
"definition": "",
"material": "",
@ -218,6 +223,7 @@ class ExtrudersModel(ListModel):
"stack": None,
"material_brand": "",
"color_name": "",
"material_type": "",
}
items.append(item)
if self._items != items: