diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index ae4fd2e5c7..bf8e475c38 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -28,6 +28,11 @@ class CuraContainerRegistry(ContainerRegistry): super().__init__(*args, **kwargs) ## Overridden from ContainerRegistry + # + # Adds a container to the registry. + # + # This will also try to convert a ContainerStack to either Extruder or + # Global stack based on metadata information. @override(ContainerRegistry) def addContainer(self, container): # Note: Intentional check with type() because we want to ignore subclasses @@ -295,6 +300,7 @@ class CuraContainerRegistry(ContainerRegistry): return parseBool(global_container_stack.getMetaDataEntry("has_machine_quality", False)) return False + ## Convert an "old-style" pure ContainerStack to either an Extruder or Global stack. def _convertContainerStack(self, container): assert type(container) == ContainerStack diff --git a/cura/Settings/CuraContainerStack.py b/cura/Settings/CuraContainerStack.py index df8cc6078d..2b8a1ebf6d 100644 --- a/cura/Settings/CuraContainerStack.py +++ b/cura/Settings/CuraContainerStack.py @@ -426,8 +426,6 @@ class CuraContainerStack(ContainerStack): # - Otherwise, if the machine definition has a metadata entry "preferred_material", try to find a material that matches the specified ID. # # \return The container that should be used as default, or None if nothing was found or the machine does not use materials. - # - # def findDefaultMaterial(self) -> Optional[ContainerInterface]: definition = self._getMachineDefinition() if not definition.getMetaDataEntry("has_materials"): @@ -467,6 +465,12 @@ class CuraContainerStack(ContainerStack): Logger.log("w", "Could not find a valid material for stack {stack}", stack = self.id) return None + ## Find the quality that should be used as "default" quality. + # + # This will search for qualities that match the current definition and pick the preferred one, + # if specified by the machine definition. + # + # \return The container that should be used as default, or None if nothing was found. def findDefaultQuality(self) -> Optional[ContainerInterface]: definition = self._getMachineDefinition() registry = ContainerRegistry.getInstance()