mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Save default material colour statically
So if you wish to change that colour, you only need to change it in one place. Contributes to issue CURA-340.
This commit is contained in:
parent
beb263025b
commit
9d618282ed
1 changed files with 6 additions and 2 deletions
|
@ -28,6 +28,10 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||
# containers.
|
||||
IndexRole = Qt.UserRole + 4
|
||||
|
||||
## Colour to display if there is no material or the material has no known
|
||||
# colour.
|
||||
defaultColour = "#FFFF00"
|
||||
|
||||
## Initialises the extruders model, defining the roles and listening for
|
||||
# changes in the data.
|
||||
#
|
||||
|
@ -71,7 +75,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||
|
||||
if self._add_global:
|
||||
material = global_container_stack.findContainer({ "type": "material" })
|
||||
colour = material.getMetaDataEntry("color_code", default = "#FFFF00") if material else "#FFFF00"
|
||||
colour = material.getMetaDataEntry("color_code", default = self.defaultColour) if material else self.defaultColour
|
||||
item = {
|
||||
"id": global_container_stack.getId(),
|
||||
"name": "Global",
|
||||
|
@ -82,7 +86,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||
|
||||
for extruder in manager.getMachineExtruders(global_container_stack.getBottom().getId()):
|
||||
material = extruder.findContainer({ "type": "material" })
|
||||
colour = material.getMetaDataEntry("color_code", default = "#FFFF00") if material else "#FFFF00"
|
||||
colour = material.getMetaDataEntry("color_code", default = self.defaultColour) if material else self.defaultColour
|
||||
position = extruder.getBottom().getMetaDataEntry("position", default = "0") #Position in the definition.
|
||||
try:
|
||||
position = int(position)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue