Make simple mode extruder selection work with settings_rework

CURA-1278 & CURA-790
This commit is contained in:
fieldOfView 2016-05-25 14:56:05 +02:00
parent a0c09063ee
commit f349221fa6

View File

@ -268,15 +268,13 @@ Item
function populateExtruderModel() function populateExtruderModel()
{ {
// extruderModel.clear() extruderModel.clear();
// var extruder_count = UM.MachineManager.getSettingValue("machine_extruder_count"); for(var extruder = 0; extruder < machineExtruderCount.properties.value ; extruder++) {
// for(var extruder = 0; extruder < extruder_count ; extruder++) { print(catalog.i18nc("@label", "Extruder %1").arg(extruder));
// extruderModel.append({ extruderModel.append({
// name: catalog.i18nc("@label", "Extruder %1").arg(extruder), text: catalog.i18nc("@label", "Extruder %1").arg(extruder)
// text: catalog.i18nc("@label", "Extruder %1").arg(extruder), })
// value: extruder }
// })
// }
} }
Rectangle { Rectangle {
@ -286,8 +284,7 @@ Item
anchors.left: parent.left anchors.left: parent.left
width: parent.width width: parent.width
height: childrenRect.height height: childrenRect.height
// Use both UM.ActiveProfile and UM.MachineManager to force UM.MachineManager.getSettingValue() to be reevaluated visible: machineExtruderCount.properties.value > 1
// visible: UM.ActiveProfile.settingValues.getValue("machine_extruder_count") || (UM.MachineManager.getSettingValue("machine_extruder_count") > 1)
Label { Label {
id: mainExtruderLabel id: mainExtruderLabel
@ -305,9 +302,9 @@ Item
anchors.top: parent.top anchors.top: parent.top
anchors.left: supportExtruderLabel.right anchors.left: supportExtruderLabel.right
style: UM.Theme.styles.combobox style: UM.Theme.styles.combobox
// currentIndex: UM.ActiveProfile.valid ? UM.ActiveProfile.settingValues.getValue("extruder_nr") : 0 currentIndex: mainExtruderNr.properties.value
onActivated: { onActivated: {
// UM.MachineManager.setSettingValue("extruder_nr", index) mainExtruderNr.setPropertyValue("value", index)
} }
} }
@ -328,9 +325,9 @@ Item
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.left: supportExtruderLabel.right anchors.left: supportExtruderLabel.right
style: UM.Theme.styles.combobox style: UM.Theme.styles.combobox
// currentIndex: UM.ActiveProfile.valid ? UM.ActiveProfile.settingValues.getValue("support_extruder_nr") : 0 currentIndex: supportExtruderNr.properties.value
onActivated: { onActivated: {
UM.MachineManager.setSettingValue("support_extruder_nr", index) supportExtruderNr.setPropertyValue("value", index)
} }
} }
@ -338,12 +335,12 @@ Item
id: extruderModel id: extruderModel
Component.onCompleted: populateExtruderModel() Component.onCompleted: populateExtruderModel()
} }
// Connections Connections
// { {
// id: machineChange id: machineChange
// target: UM.MachineManager target: Cura.MachineManager
// onActiveMachineInstanceChanged: populateExtruderModel() onGlobalContainerChanged: populateExtruderModel()
// } }
} }
Rectangle { Rectangle {
@ -400,4 +397,32 @@ Item
watchedProperties: [ "value" ] watchedProperties: [ "value" ]
storeIndex: 0 storeIndex: 0
} }
UM.SettingPropertyProvider
{
id: machineExtruderCount
containerStackId: Cura.MachineManager.activeMachineId
key: "machine_extruder_count"
watchedProperties: [ "value" ]
storeIndex: 0
}
UM.SettingPropertyProvider
{
id: supportExtruderNr
containerStackId: Cura.MachineManager.activeMachineId
key: "support_extruder_nr"
watchedProperties: [ "value" ]
storeIndex: 0
}
UM.SettingPropertyProvider
{
id: mainExtruderNr
containerStackId: Cura.MachineManager.activeMachineId
key: "extruder_nr"
watchedProperties: [ "value" ]
storeIndex: 0
}
} }