Browse Source

Expose quality changes id and quality type and make the profile menu work correctly

Contributes to CURA-2006
Arjen Hiemstra 8 years ago
parent
commit
6de7d0170a
2 changed files with 18 additions and 2 deletions
  1. 16 0
      cura/Settings/MachineManager.py
  2. 2 2
      resources/qml/Menus/ProfileMenu.qml

+ 16 - 0
cura/Settings/MachineManager.py

@@ -417,6 +417,22 @@ class MachineManager(QObject):
                 return quality.getId()
         return ""
 
+    @pyqtProperty(str, notify = activeQualityChanged)
+    def activeQualityType(self):
+        if self._global_container_stack:
+            quality = self._global_container_stack.findContainer(type = "quality")
+            if quality:
+                return quality.getMetaDataEntry("quality_type")
+        return ""
+
+    @pyqtProperty(str, notify = activeQualityChanged)
+    def activeQualityChangesId(self):
+        if self._global_container_stack:
+            changes = self._global_container_stack.findContainer(type = "quality_changes")
+            if changes:
+                return changes.getId()
+        return ""
+
     ## Check if a container is read_only
     @pyqtSlot(str, result = bool)
     def isReadOnly(self, container_id):

+ 2 - 2
resources/qml/Menus/ProfileMenu.qml

@@ -22,7 +22,7 @@ Menu
         {
             text: model.name
             checkable: true
-            checked: Cura.MachineManager.activeQualityId == model.id
+            checked: Cura.MachineManager.activeQualityChangesId == "empty_quality_changes" && Cura.MachineManager.activeQualityType == model.metadata.quality_type
             exclusiveGroup: group
             onTriggered: Cura.MachineManager.setActiveQuality(model.id)
         }
@@ -38,7 +38,7 @@ Menu
         id: customProfileInstantiator
         model: UM.InstanceContainersModel
         {
-            filter: menu.getFilter({ "type": "quality_changes", "extruder": null });
+            filter: { "type": "quality_changes", "extruder": null, "definition": Cura.MachineManager.filterQualityByMachine ? Cura.MachineManager.activeDefinitionId : "fdmprinter" };
             onModelReset: customSeparator.visible = rowCount() > 0
         }