mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 09:59:00 +08:00
Fix stuck extruder tabs when switching number of extruders
This commit is contained in:
parent
7bc28a7e48
commit
5b37353b08
@ -14,6 +14,23 @@ Cura.MachineAction
|
|||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
property var extrudersModel: Cura.ExtrudersModel{}
|
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;
|
anchors.fill: parent;
|
||||||
Item
|
Item
|
||||||
@ -377,6 +394,8 @@ Cura.MachineAction
|
|||||||
{
|
{
|
||||||
machineExtruderCountProvider.setPropertyValue("value", index + 1);
|
machineExtruderCountProvider.setPropertyValue("value", index + 1);
|
||||||
manager.forceUpdate();
|
manager.forceUpdate();
|
||||||
|
base.extruderTabsCount = (index > 0) ? index + 1 : 0;
|
||||||
|
|
||||||
if(index > 0)
|
if(index > 0)
|
||||||
{
|
{
|
||||||
// multiextrusion; make sure one of these extruder stacks is active
|
// multiextrusion; make sure one of these extruder stacks is active
|
||||||
@ -384,10 +403,6 @@ Cura.MachineAction
|
|||||||
{
|
{
|
||||||
ExtruderManager.setActiveExtruderIndex(0);
|
ExtruderManager.setActiveExtruderIndex(0);
|
||||||
}
|
}
|
||||||
else if(ExtruderManager.activeExtruderIndex > index)
|
|
||||||
{
|
|
||||||
ExtruderManager.setActiveExtruderIndex(index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -488,19 +503,22 @@ Cura.MachineAction
|
|||||||
{
|
{
|
||||||
if(currentIndex > 0)
|
if(currentIndex > 0)
|
||||||
{
|
{
|
||||||
ExtruderManager.setActiveExtruderIndex(currentIndex - 1);
|
ExtruderManager.setActiveExtruderIndex(settingsTabs.getTab(currentIndex).extruderIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
model: (machineExtruderCountProvider.properties.value > 1) ? parseInt(machineExtruderCountProvider.properties.value) : 0
|
id: extruderTabsRepeater
|
||||||
|
model: base.extruderTabsCount
|
||||||
|
|
||||||
Tab
|
Tab
|
||||||
{
|
{
|
||||||
title: base.extrudersModel.getItem(index).name
|
title: base.extrudersModel.getItem(index).name
|
||||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
property int extruderIndex: index
|
||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
spacing: UM.Theme.getSize("default_margin").width
|
spacing: UM.Theme.getSize("default_margin").width
|
||||||
|
Loading…
x
Reference in New Issue
Block a user