mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 06:23:59 -06:00
Add buttons to select the extruder for the selection to the toolbar
Contributes to CURA-3577
This commit is contained in:
parent
48baf272b4
commit
89e6313143
2 changed files with 107 additions and 1 deletions
86
resources/qml/ExtruderButton.qml
Normal file
86
resources/qml/ExtruderButton.qml
Normal file
|
@ -0,0 +1,86 @@
|
|||
// Copyright (c) 2017 Ultimaker B.V.
|
||||
// Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Button
|
||||
{
|
||||
id: base
|
||||
|
||||
property var extruder;
|
||||
|
||||
text: catalog.i18ncp("@label", "Print Selected Model with %1", "Print Selected Models With %1", UM.Selection.selectionCount).arg(extruder.name)
|
||||
|
||||
style: UM.Theme.styles.tool_button;
|
||||
iconSource: checked ? UM.Theme.getIcon("material_selected") : UM.Theme.getIcon("material_not_selected");
|
||||
|
||||
checkable: true;
|
||||
checked: ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1
|
||||
enabled: UM.Selection.hasSelection
|
||||
|
||||
property color customColor: base.hovered ? UM.Theme.getColor("button_hover") : UM.Theme.getColor("button");
|
||||
|
||||
Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.margins: UM.Theme.getSize("default_lining").width;
|
||||
|
||||
color: "transparent"
|
||||
|
||||
border.width: base.checked ? UM.Theme.getSize("default_lining").width : 0;
|
||||
border.color: UM.Theme.getColor("button_text")
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
anchors
|
||||
{
|
||||
right: parent.right;
|
||||
top: parent.top;
|
||||
margins: UM.Theme.getSize("default_lining").width * 3
|
||||
}
|
||||
width: UM.Theme.getSize("default_margin").width
|
||||
height: UM.Theme.getSize("default_margin").height
|
||||
|
||||
Text
|
||||
{
|
||||
anchors.centerIn: parent;
|
||||
text: index + 1;
|
||||
color: parent.enabled ? UM.Theme.getColor("button_text") : UM.Theme.getColor("button_disabled_text")
|
||||
font: UM.Theme.getFont("default_bold");
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
anchors
|
||||
{
|
||||
left: parent.left;
|
||||
top: parent.top;
|
||||
margins: UM.Theme.getSize("default_lining").width * 3
|
||||
}
|
||||
|
||||
color: model.color
|
||||
|
||||
width: UM.Theme.getSize("default_margin").width
|
||||
height: UM.Theme.getSize("default_margin").height
|
||||
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: UM.Theme.getColor("lining");
|
||||
}
|
||||
|
||||
// See line 51, same workaround
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent;
|
||||
onClicked:
|
||||
{
|
||||
forceActiveFocus() //First grab focus, so all the text fields are updated
|
||||
CuraActions.setExtruderForSelection(extruder.id);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,7 +6,8 @@ import QtQuick.Controls 1.1
|
|||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Item
|
||||
{
|
||||
|
@ -67,6 +68,14 @@ Item
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item { height: UM.Theme.getSize("default_margin").height; width: 1; visible: machineExtruderCount.properties.value > 1 }
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: Cura.ExtrudersModel { id: extrudersModel }
|
||||
ExtruderButton { extruder: model }
|
||||
}
|
||||
}
|
||||
|
||||
UM.PointingRectangle
|
||||
|
@ -147,4 +156,15 @@ Item
|
|||
|
||||
visible: toolHint.text != "";
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
}
|
||||
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue