Browse Source

Disable the settings in the global tab

CURA-1758
fieldOfView 8 years ago
parent
commit
121cd19e83

+ 6 - 0
cura/Settings/ExtruderManager.py

@@ -41,6 +41,12 @@ class ExtruderManager(QObject):
         except KeyError: # Extruder index could be -1 if the global tab is selected, or the entry doesn't exist if the machine definition is wrong.
             return None
 
+    @pyqtProperty(int, notify = extrudersChanged)
+    def extruderCount(self):
+        if not UM.Application.getInstance().getGlobalContainerStack():
+            return 0 # No active machine, so no extruders.
+        return len(self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()])
+
     ##  The instance of the singleton pattern.
     #
     #   It's None if the extruder manager hasn't been created yet.

+ 10 - 9
resources/qml/Settings/SettingView.qml

@@ -34,14 +34,7 @@ ScrollView
             expanded: Printer.expandedCategories
             onExpandedChanged: Printer.setExpandedCategories(expanded)
 
-            filter:
-            {
-                if(ExtruderManager.activeExtruderStackId)
-                {
-                    return { "settable_per_extruder": true }
-                }
-                return { }
-            }
+            filter: {}
         }
 
         delegate: Loader
@@ -53,7 +46,15 @@ ScrollView
             Behavior on height { NumberAnimation { duration: 100 } }
             opacity: provider.properties.enabled == "True" ? 1 : 0
             Behavior on opacity { NumberAnimation { duration: 100 } }
-            enabled: provider.properties.enabled == "True"
+            enabled:
+            {
+                if(!ExtruderManager.activeExtruderStackId && ExtruderManager.extruderCount > 0)
+                {
+                    // disable all controls on the global tab, except categories
+                    return model.type == "category"
+                }
+                return provider.properties.enabled == "True"
+            }
 
             property var definition: model
             property var settingDefinitionsModel: definitionsModel

+ 2 - 0
resources/qml/SidebarHeader.qml

@@ -258,6 +258,8 @@ Column
         {
             id: globalProfileSelection
             text: Cura.MachineManager.activeQualityName
+            enabled: !extrudersList.visible || base.currentExtruderIndex  > -1
+
             width: parent.width * 0.55 + UM.Theme.getSize("default_margin").width
             height: UM.Theme.getSize("setting_control").height
             tooltip: Cura.MachineManager.activeQualityName