mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 07:03:56 -06:00
Merge branch 'master' into feature_sync_button
This commit is contained in:
commit
2bf6d071d1
44 changed files with 678 additions and 317 deletions
|
@ -143,10 +143,42 @@ Column
|
|||
exclusiveGroup: extruderMenuGroup
|
||||
checked: base.currentExtruderIndex == index
|
||||
|
||||
onClicked:
|
||||
property bool extruder_enabled: true
|
||||
|
||||
MouseArea
|
||||
{
|
||||
forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values.
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(index);
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onClicked: {
|
||||
switch (mouse.button) {
|
||||
case Qt.LeftButton:
|
||||
forceActiveFocus(); // Changing focus applies the currently-being-typed values so it can change the displayed setting values.
|
||||
Cura.ExtruderManager.setActiveExtruderIndex(index);
|
||||
break;
|
||||
case Qt.RightButton:
|
||||
extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled
|
||||
extruderMenu.popup();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Menu
|
||||
{
|
||||
id: extruderMenu
|
||||
|
||||
MenuItem {
|
||||
text: catalog.i18nc("@action:inmenu", "Enable Extruder")
|
||||
onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true)
|
||||
visible: !extruder_enabled // using an intermediate variable prevents an empty popup that occured now and then
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: catalog.i18nc("@action:inmenu", "Disable Extruder")
|
||||
onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false)
|
||||
visible: extruder_enabled
|
||||
}
|
||||
}
|
||||
|
||||
style: ButtonStyle
|
||||
|
@ -166,6 +198,18 @@ Column
|
|||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
}
|
||||
|
||||
function buttonColor(index) {
|
||||
var extruder = Cura.MachineManager.getExtruder(index);
|
||||
if (extruder.isEnabled) {
|
||||
return (
|
||||
control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") :
|
||||
control.hovered ? UM.Theme.getColor("action_button_hovered_text") :
|
||||
UM.Theme.getColor("action_button_text");
|
||||
} else {
|
||||
return UM.Theme.getColor("action_button_disabled_text");
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: extruderButtonFace
|
||||
|
@ -183,9 +227,7 @@ Column
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
|
||||
color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") :
|
||||
control.hovered ? UM.Theme.getColor("action_button_hovered_text") :
|
||||
UM.Theme.getColor("action_button_text")
|
||||
color: buttonColor(index)
|
||||
|
||||
font: UM.Theme.getFont("large_nonbold")
|
||||
text: catalog.i18nc("@label", "Extruder")
|
||||
|
@ -228,9 +270,7 @@ Column
|
|||
id: extruderNumberText
|
||||
anchors.centerIn: parent
|
||||
text: index + 1;
|
||||
color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") :
|
||||
control.hovered ? UM.Theme.getColor("action_button_hovered_text") :
|
||||
UM.Theme.getColor("action_button_text")
|
||||
color: buttonColor(index)
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue