ExtruderIcon will now display that it's disabled correctly

CURA-5785
This commit is contained in:
Jaime van Kessel 2018-11-16 16:04:11 +01:00
parent d661a8e626
commit 7f99ed1af3
4 changed files with 24 additions and 6 deletions

View file

@ -24,8 +24,6 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
## Human-readable name of the extruder. ## Human-readable name of the extruder.
NameRole = Qt.UserRole + 2 NameRole = Qt.UserRole + 2
## Is the extruder enabled?
EnabledRole = Qt.UserRole + 9
## Colour of the material loaded in the extruder. ## Colour of the material loaded in the extruder.
ColorRole = Qt.UserRole + 3 ColorRole = Qt.UserRole + 3
@ -50,6 +48,9 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
MaterialBrandRole = Qt.UserRole + 9 MaterialBrandRole = Qt.UserRole + 9
ColorNameRole = Qt.UserRole + 10 ColorNameRole = Qt.UserRole + 10
## Is the extruder enabled?
EnabledRole = Qt.UserRole + 11
## List of colours to display if there is no material or the material has no known ## List of colours to display if there is no material or the material has no known
# colour. # colour.
defaultColors = ["#ffc924", "#86ec21", "#22eeee", "#245bff", "#9124ff", "#ff24c8"] defaultColors = ["#ffc924", "#86ec21", "#22eeee", "#245bff", "#9124ff", "#ff24c8"]

View file

@ -23,6 +23,7 @@ Button
{ {
width: UM.Theme.getSize("button_icon").width width: UM.Theme.getSize("button_icon").width
materialColor: model.color materialColor: model.color
extruderEnabled: extruder.stack.isEnabled
property int index: extruder.index property int index: extruder.index
} }

View file

@ -13,9 +13,9 @@ Item
implicitHeight: implicitWidth implicitHeight: implicitWidth
property bool checked: true property bool checked: true
property alias materialColor: mainIcon.color property color materialColor
property alias textColor: extruderNumberText.color property alias textColor: extruderNumberText.color
property bool extruderEnabled: true
UM.RecolorImage UM.RecolorImage
{ {
id: mainIcon id: mainIcon
@ -24,6 +24,7 @@ Item
sourceSize.width: parent.width sourceSize.width: parent.width
sourceSize.height: parent.width sourceSize.height: parent.width
source: UM.Theme.getIcon("extruder_button") source: UM.Theme.getIcon("extruder_button")
color: extruderEnabled ? materialColor: "gray"
} }
Rectangle Rectangle
@ -31,9 +32,9 @@ Item
id: extruderNumberCircle id: extruderNumberCircle
width: height width: height
height: parent.height / 2 height: Math.round(parent.height / 2)
radius: Math.round(width / 2) radius: Math.round(width / 2)
color: "white" color: UM.Theme.getColor("toolbar_background")
anchors anchors
{ {
@ -51,6 +52,19 @@ Item
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
width: contentWidth width: contentWidth
height: contentHeight height: contentHeight
visible: extruderEnabled
}
UM.RecolorImage
{
id: disabledIcon
anchors.fill: parent
anchors.margins: UM.Theme.getSize("thick_lining").width
sourceSize.width: width
sourceSize.height: width
source: UM.Theme.getIcon("cross1")
visible: !extruderEnabled
color: "black"
} }
} }
} }

View file

@ -49,6 +49,7 @@ Cura.ExpandableComponent
{ {
id: extruderIcon id: extruderIcon
materialColor: model.color materialColor: model.color
extruderEnabled: model.enabled
height: parent.height height: parent.height
width: height width: height
} }
@ -118,6 +119,7 @@ Cura.ExpandableComponent
{ {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
materialColor: model.color materialColor: model.color
extruderEnabled: model.enabled
width: parent.height width: parent.height
height: parent.height height: parent.height
} }