Fix stuck extruder tabs when switching number of extruders

This commit is contained in:
fieldOfView 2017-04-07 11:55:07 +02:00
parent 7bc28a7e48
commit 5b37353b08

View file

@ -14,6 +14,23 @@ Cura.MachineAction
{
id: base
property var extrudersModel: Cura.ExtrudersModel{}
property int extruderTabsCount: 0
Component.onCompleted:
{
// Populate extruder tabs after a short delay, because otherwise the tabs that are added when
// the dialog is created are stuck.
extruderTabsCountDelay.start();
}
Timer
{
id: extruderTabsCountDelay
repeat: false
interval: 1
onTriggered: base.extruderTabsCount = (machineExtruderCountProvider.properties.value > 1) ? parseInt(machineExtruderCountProvider.properties.value) : 0
}
anchors.fill: parent;
Item
@ -377,6 +394,8 @@ Cura.MachineAction
{
machineExtruderCountProvider.setPropertyValue("value", index + 1);
manager.forceUpdate();
base.extruderTabsCount = (index > 0) ? index + 1 : 0;
if(index > 0)
{
// multiextrusion; make sure one of these extruder stacks is active
@ -384,10 +403,6 @@ Cura.MachineAction
{
ExtruderManager.setActiveExtruderIndex(0);
}
else if(ExtruderManager.activeExtruderIndex > index)
{
ExtruderManager.setActiveExtruderIndex(index);
}
}
else
{
@ -488,19 +503,22 @@ Cura.MachineAction
{
if(currentIndex > 0)
{
ExtruderManager.setActiveExtruderIndex(currentIndex - 1);
ExtruderManager.setActiveExtruderIndex(settingsTabs.getTab(currentIndex).extruderIndex);
}
}
Repeater
{
model: (machineExtruderCountProvider.properties.value > 1) ? parseInt(machineExtruderCountProvider.properties.value) : 0
id: extruderTabsRepeater
model: base.extruderTabsCount
Tab
{
title: base.extrudersModel.getItem(index).name
anchors.margins: UM.Theme.getSize("default_margin").width
property int extruderIndex: index
Column
{
spacing: UM.Theme.getSize("default_margin").width