Browse Source

CURA-4870 Make the machine selection toolbutton react to changes in the
output devices

Diego Prado Gesto 7 years ago
parent
commit
16a5b652f4
1 changed files with 13 additions and 2 deletions
  1. 13 2
      resources/qml/MachineSelection.qml

+ 13 - 2
resources/qml/MachineSelection.qml

@@ -11,9 +11,10 @@ import Cura 1.0 as Cura
 import "Menus"
 
 ToolButton {
-    property var isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey ? true : false
+    id: base
+    property var isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
     property var printerStatus: Cura.MachineManager.printerOutputDevices.length != 0 ? "connected" : "unknown"
-    text: Cura.MachineManager.activeMachineName
+    text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
 
     tooltip: Cura.MachineManager.activeMachineName
 
@@ -73,4 +74,14 @@ ToolButton {
     }
 
     menu: PrinterMenu { }
+
+    // Make the toolbutton react when the outputdevice changes
+    Connections
+    {
+        target: Cura.MachineManager
+        onOutputDevicesChanged:
+        {
+            base.isNetworkPrinter = Cura.MachineManager.activeMachineNetworkKey != ""
+        }
+    }
 }