Add extruder selection to Context menu

Contributes to CURA-3609
This commit is contained in:
Arjen Hiemstra 2017-04-20 17:40:50 +02:00
parent 9fd0239cd5
commit e108bd0627

View file

@ -13,11 +13,32 @@ Menu
{
id: base
property bool shouldShowExtruders: machineExtruderCount.properties.value > 1;
// Selection-related actions.
MenuItem { action: Cura.Actions.centerSelection; }
MenuItem { action: Cura.Actions.deleteSelection; }
MenuItem { action: Cura.Actions.multiplySelection; }
// Extruder selection - only visible if there is more than 1 extruder
MenuSeparator { visible: base.shouldShowExtruders }
MenuItem { id: extruderHeader; text: catalog.i18ncp("@label", "Print Selected Model With:", "Print Selected Models With:", UM.Selection.selectionCount); enabled: false; visible: base.shouldShowExtruders }
Instantiator
{
model: Cura.ExtrudersModel { id: extrudersModel }
MenuItem {
text: "%1: %2 - %3".arg(model.name).arg(model.material).arg(model.variant)
visible: base.shouldShowExtruders
enabled: UM.Selection.hasSelection
checkable: true
checked: ExtruderManager.selectedObjectExtruders.indexOf(model.id) != -1
onTriggered: CuraActions.setSelectionExtruder(model.id)
shortcut: "Ctrl+" + (model.index + 1)
}
onObjectAdded: base.insertItem(base.findItemIndex(extruderHeader) + index, object)
onObjectRemoved: base.removeItem(object)
}
// Global actions
MenuSeparator { }
MenuItem { action: Cura.Actions.selectAll; }
@ -45,6 +66,15 @@ Menu
onTriggered: multiplyDialog.open()
}
UM.SettingPropertyProvider
{
id: machineExtruderCount
containerStackId: Cura.MachineManager.activeMachineId
key: "machine_extruder_count"
watchedProperties: [ "value" ]
}
Dialog
{
id: multiplyDialog