mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 06:33:55 -06:00
WIP: Cleanup old QualityManager
This commit is contained in:
parent
d4db41503f
commit
3fffc2c621
3 changed files with 10 additions and 44 deletions
|
@ -27,42 +27,6 @@ class QualityManager:
|
|||
|
||||
__instance = None # type: "QualityManager"
|
||||
|
||||
## Find a quality by name for a specific machine definition and materials.
|
||||
#
|
||||
# \param quality_name
|
||||
# \param machine_definition (Optional) \type{DefinitionContainerInterface} If nothing is
|
||||
# specified then the currently selected machine definition is used.
|
||||
# \param material_containers_metadata If nothing is specified then the
|
||||
# current set of selected materials is used.
|
||||
# \return the matching quality container \type{InstanceContainer}
|
||||
def findQualityByName(self, quality_name: str, machine_definition: Optional["DefinitionContainerInterface"] = None, material_containers_metadata: Optional[List[Dict[str, Any]]] = None) -> Optional[InstanceContainer]:
|
||||
criteria = {"type": "quality", "name": quality_name}
|
||||
result = self._getFilteredContainersForStack(machine_definition, material_containers_metadata, **criteria)
|
||||
|
||||
# Fall back to using generic materials and qualities if nothing could be found.
|
||||
if not result and material_containers_metadata and len(material_containers_metadata) == 1:
|
||||
basic_materials = self._getBasicMaterialMetadatas(material_containers_metadata[0])
|
||||
result = self._getFilteredContainersForStack(machine_definition, basic_materials, **criteria)
|
||||
|
||||
return result[0] if result else None
|
||||
|
||||
## Find a quality changes container by name.
|
||||
#
|
||||
# \param quality_changes_name \type{str} the name of the quality changes container.
|
||||
# \param machine_definition (Optional) \type{DefinitionContainer} If nothing is
|
||||
# specified then the currently selected machine definition is used..
|
||||
# \return the matching quality changes containers \type{List[InstanceContainer]}
|
||||
def findQualityChangesByName(self, quality_changes_name: str, machine_definition: Optional["DefinitionContainerInterface"] = None):
|
||||
if not machine_definition:
|
||||
global_stack = Application.getGlobalContainerStack()
|
||||
if not global_stack:
|
||||
return [] #No stack, so no current definition could be found, so there are no quality changes either.
|
||||
machine_definition = global_stack.definition
|
||||
|
||||
result = self.findAllQualityChangesForMachine(machine_definition)
|
||||
result = [quality_change for quality_change in result if quality_change.getName() == quality_changes_name]
|
||||
return result
|
||||
|
||||
## Fetch the list of available quality types for this combination of machine definition and materials.
|
||||
#
|
||||
# \param machine_definition \type{DefinitionContainer}
|
||||
|
|
|
@ -161,7 +161,7 @@ class ContainerManager(QObject):
|
|||
return container.getProperty(setting_key, property_name)
|
||||
|
||||
## Set the name of the specified material.
|
||||
@pyqtSlot("QVariant", str)
|
||||
@pyqtSlot(QObject, str)
|
||||
def setMaterialName(self, material_node, new_name):
|
||||
root_material_id = material_node.metadata["base_file"]
|
||||
if self._container_registry.isReadOnly(root_material_id):
|
||||
|
|
|
@ -4,26 +4,28 @@
|
|||
import os.path
|
||||
import zipfile
|
||||
|
||||
import numpy
|
||||
|
||||
import Savitar
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.Logger import Logger
|
||||
from UM.Math.Matrix import Matrix
|
||||
from UM.Math.Vector import Vector
|
||||
from UM.Mesh.MeshBuilder import MeshBuilder
|
||||
from UM.Mesh.MeshReader import MeshReader
|
||||
from UM.Scene.GroupDecorator import GroupDecorator
|
||||
|
||||
from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator
|
||||
from UM.Application import Application
|
||||
from cura.Settings.ExtruderManager import ExtruderManager
|
||||
from cura.QualityManager import QualityManager
|
||||
from cura.Scene.CuraSceneNode import CuraSceneNode
|
||||
from cura.Scene.BuildPlateDecorator import BuildPlateDecorator
|
||||
from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator
|
||||
from cura.Scene.ZOffsetDecorator import ZOffsetDecorator
|
||||
from cura.Machines.MachineTools import getMachineDefinitionIDForQualitySearch
|
||||
|
||||
MYPY = False
|
||||
|
||||
import Savitar
|
||||
import numpy
|
||||
|
||||
try:
|
||||
if not MYPY:
|
||||
import xml.etree.cElementTree as ET
|
||||
|
@ -120,8 +122,8 @@ class ThreeMFReader(MeshReader):
|
|||
um_node.callDecoration("setActiveExtruder", default_stack.getId())
|
||||
|
||||
# Get the definition & set it
|
||||
definition = QualityManager.getInstance().getParentMachineDefinition(global_container_stack.getBottom())
|
||||
um_node.callDecoration("getStack").getTop().setDefinition(definition.getId())
|
||||
definition_id = getMachineDefinitionIDForQualitySearch(global_container_stack.definition)
|
||||
um_node.callDecoration("getStack").getTop().setDefinition(definition_id)
|
||||
|
||||
setting_container = um_node.callDecoration("getStack").getTop()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue