Update outputDevice when the global container changed

And directly link the active printer name to it, so that that also gets updated. With the property var it just gets evaluated upon creating the rectangle.

Contributes to issue CURA-5749.
This commit is contained in:
Ghostkeeper 2018-10-12 14:56:27 +02:00
parent 99fc372b32
commit 9e4fcd820e
No known key found for this signature in database
GPG Key ID: 5252B696FB5E7C7A
2 changed files with 11 additions and 3 deletions

View File

@ -44,7 +44,7 @@ Column
Repeater
{
id: extrudersRepeater
model: activePrinter!=null ? activePrinter.extruders : null
model: activePrinter != null ? activePrinter.extruders : null
ExtruderBox
{

View File

@ -14,11 +14,19 @@ Item
implicitHeight: Math.floor(childrenRect.height + UM.Theme.getSize("default_margin").height * 2)
property var outputDevice: null
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged:
{
outputDevice = Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null;
}
}
Rectangle
{
height: childrenRect.height
color: UM.Theme.getColor("setting_category")
property var activePrinter: outputDevice != null ? outputDevice.activePrinter : null
Label
{
@ -28,7 +36,7 @@ Item
anchors.left: parent.left
anchors.top: parent.top
anchors.margins: UM.Theme.getSize("default_margin").width
text: outputDevice != null ? activePrinter.name : ""
text: outputDevice != null ? outputDevice.activePrinter.name : ""
}
Label