Browse Source

Add property for active intent category

CURA-6598
Jaime van Kessel 5 years ago
parent
commit
04997fca7f
2 changed files with 11 additions and 0 deletions
  1. 10 0
      cura/Settings/MachineManager.py
  2. 1 0
      cura/Settings/cura_empty_instance_containers.py

+ 10 - 0
cura/Settings/MachineManager.py

@@ -132,6 +132,7 @@ class MachineManager(QObject):
     activeMaterialChanged = pyqtSignal()
     activeVariantChanged = pyqtSignal()
     activeQualityChanged = pyqtSignal()
+    activeIntentChanged = pyqtSignal()
     activeStackChanged = pyqtSignal()  # Emitted whenever the active stack is changed (ie: when changing between extruders, changing a profile, but not when changing a value)
     extruderChanged = pyqtSignal()
 
@@ -270,6 +271,7 @@ class MachineManager(QObject):
         self.activeQualityChanged.emit()
         self.activeVariantChanged.emit()
         self.activeMaterialChanged.emit()
+        self.activeIntentChanged.emit()
 
         self.rootMaterialChanged.emit()
         self.numberExtrudersEnabledChanged.emit()
@@ -607,6 +609,14 @@ class MachineManager(QObject):
             return False
         return Util.parseBool(global_container_stack.quality.getMetaDataEntry("is_experimental", False))
 
+    @pyqtProperty(str, notify=activeIntentChanged)
+    def activeIntentCategory(self):
+
+        if not self._active_container_stack:
+            return ""
+        intent_category = self._active_container_stack.intent.getMetaDataEntry("intent_category")
+        return intent_category
+
     ##  Returns whether there is anything unsupported in the current set-up.
     #
     #   The current set-up signifies the global stack and all extruder stacks,

+ 1 - 0
cura/Settings/cura_empty_instance_containers.py

@@ -47,6 +47,7 @@ EMPTY_INTENT_CONTAINER_ID = "empty_intent"
 empty_intent_container = copy.deepcopy(empty_container)
 empty_intent_container.setMetaDataEntry("id", EMPTY_INTENT_CONTAINER_ID)
 empty_intent_container.setMetaDataEntry("type", "intent")
+empty_intent_container.setMetaDataEntry("intent_category", "default")
 empty_intent_container.setName(catalog.i18nc("@info:No intent profile selected", "Default"))