Browse Source

CURA-4870 Clean the error messages from qml by not rendering components
if there is no outputDevice defined.

Diego Prado Gesto 7 years ago
parent
commit
9196802e83

+ 2 - 2
resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml

@@ -11,7 +11,7 @@ import Cura 1.0 as Cura
 Column
 {
     id: base
-    property var outputDevice: Cura.MachineManager.printerOutputDevices[0]
+    property var outputDevice: null
     property var computedHeight: container.height + configurationListHeading.height + 3 * padding
     height: childrenRect.height + 2 * padding
     padding: UM.Theme.getSize("default_margin").width
@@ -78,7 +78,7 @@ Column
         onUniqueConfigurationsChanged:
         {
             // FIXME For now the model should be removed and then created again, otherwise changes in the printer don't automatically update the UI
-            configurationList.model = null
+            configurationList.model = []
             configurationList.model = outputDevice.uniqueConfigurations
         }
     }

+ 4 - 1
resources/qml/Menus/ConfigurationMenu/ConfigurationSelection.qml

@@ -11,11 +11,13 @@ import Cura 1.0 as Cura
 Item
 {
     id: configurationSelector
+    property var connectedDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
     property var panelWidth: control.width
     property var panelVisible: false
 
     SyncButton {
         onClicked: configurationSelector.state == "open" ? configurationSelector.state = "closed" : configurationSelector.state = "open"
+        outputDevice: connectedDevice
     }
 
     Popup {
@@ -24,11 +26,12 @@ Item
         y: configurationSelector.height - UM.Theme.getSize("default_lining").height
         x: configurationSelector.width - width
         width: panelWidth
-        visible: panelVisible
+        visible: panelVisible && connectedDevice != null
         padding: UM.Theme.getSize("default_lining").width
         contentItem: ConfigurationListView {
             id: configList
             width: panelWidth - 2 * popup.padding
+            outputDevice: connectedDevice
         }
         background: Rectangle {
             color: UM.Theme.getColor("setting_control")

+ 1 - 1
resources/qml/Menus/ConfigurationMenu/SyncButton.qml

@@ -11,7 +11,7 @@ import Cura 1.0 as Cura
 Button
 {
     id: base
-    property var outputDevice: Cura.MachineManager.printerOutputDevices[0]
+    property var outputDevice: null
     property var matched: updateOnSync()
     text: matched == true ? "Yes" : "No"
     width: parent.width