|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
|
|
|
from PyQt5.QtCore import pyqtProperty, pyqtSignal
|
|
|
-from typing import List, Tuple, TYPE_CHECKING
|
|
|
+from typing import Any, Dict, List, Tuple, TYPE_CHECKING
|
|
|
from cura.CuraApplication import CuraApplication
|
|
|
from cura.Machines.QualityManager import QualityManager
|
|
|
from cura.Settings.MachineManager import MachineManager
|
|
@@ -24,6 +24,7 @@ class IntentManager:
|
|
|
self.configurationChanged.connect(self.selectDefaultIntent)
|
|
|
pass
|
|
|
|
|
|
+
|
|
|
@classmethod
|
|
|
def getInstance(cls):
|
|
|
if not cls.__instance:
|
|
@@ -32,15 +33,22 @@ class IntentManager:
|
|
|
|
|
|
configurationChanged = pyqtSignal
|
|
|
|
|
|
- def intentMetadatas(self, definition_id: str, nozzle_id: str, material_id: str) -> List[str]:
|
|
|
-
|
|
|
-
|
|
|
- return []
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ def intentMetadatas(self, definition_id: str, nozzle_name: str, material_id: str) -> List[Dict[str, Any]]:
|
|
|
+ registry = ContainerRegistry.getInstance()
|
|
|
+ return registry.findContainersMetadata(definition = definition_id, variant = nozzle_name, material_id = material_id)
|
|
|
|
|
|
+
|
|
|
def intentCategories(self, definition_id: str, nozzle_id: str, material_id: str) -> List[str]:
|
|
|
categories = set()
|
|
|
for intent in self.intentMetadatas(definition_id, nozzle_id, material_id):
|
|
|
categories.add(intent["intent_category"])
|
|
|
+ categories.add("default")
|
|
|
return list(categories)
|
|
|
|
|
|
|
|
@@ -50,7 +58,6 @@ class IntentManager:
|
|
|
|
|
|
|
|
|
|
|
|
- @pyqtProperty("QVariantList", notify = configurationChanged)
|
|
|
def currentAvailableIntents(self) -> List[Tuple[str, str]]:
|
|
|
final_intent_ids = {metadata["id"] for metadata in ContainerRegistry.getInstance().findContainersMetadata(type = "intent", definition = current_definition_id)}
|
|
|
for extruder in all_extruders:
|