mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-29 05:41:05 -07:00
Move some convoluted logic from QML into Python
This commit is contained in:
parent
933ee408e4
commit
8d42f9c187
2 changed files with 35 additions and 38 deletions
|
|
@ -377,48 +377,11 @@ Cura.MachineAction
|
|||
currentIndex: machineExtruderCountProvider.properties.value - 1
|
||||
onActivated:
|
||||
{
|
||||
if(machineExtruderCountProvider.properties.value == index + 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var extruder_material;
|
||||
if(index == 0 && Cura.MachineManager.hasMaterials)
|
||||
{
|
||||
// setting back to single extrusion
|
||||
extruder_material = Cura.MachineManager.allActiveMaterialIds[Cura.MachineManager.activeStackId];
|
||||
}
|
||||
|
||||
machineExtruderCountProvider.setPropertyValue("value", index + 1);
|
||||
manager.forceUpdate();
|
||||
manager.setMachineExtruderCount(index + 1);
|
||||
base.extruderTabsCount = (index > 0) ? index + 1 : 0;
|
||||
|
||||
if(index > 0)
|
||||
{
|
||||
// multiextrusion; make sure one of these extruder stacks is active
|
||||
if(ExtruderManager.activeExtruderIndex == -1)
|
||||
{
|
||||
ExtruderManager.setActiveExtruderIndex(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// single extrusion; make sure the machine stack is active
|
||||
if(ExtruderManager.activeExtruderIndex != -1)
|
||||
{
|
||||
ExtruderManager.setActiveExtruderIndex(-1);
|
||||
}
|
||||
if(extruder_material)
|
||||
{
|
||||
// restore material on global stack
|
||||
// MachineManager._onGlobalContainerChanged removes the global material of multiextruder machines
|
||||
Cura.MachineManager.setActiveMaterial(extruder_material);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Nozzle size")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue