mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Provide activeQualityGroupName instead of QualityGroup(QObject)
We don't need to inherit from QObject if we expose the name elsewhere. This prevents having workarounds for C++ vs QML ownership, and also allows us to test this while mocking out CuraApplication. Done during Turbo Testing and Tooling.
This commit is contained in:
parent
6f2f15c74f
commit
6c0772cd4a
3 changed files with 27 additions and 20 deletions
|
|
@ -8,6 +8,7 @@ from UM.Signal import Signal
|
|||
from UM.Util import parseBool
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry # To find all the variants for this machine.
|
||||
|
||||
import cura.CuraApplication # Imported like this to prevent circular dependencies.
|
||||
from cura.Machines.ContainerNode import ContainerNode
|
||||
from cura.Machines.QualityChangesGroup import QualityChangesGroup # To construct groups of quality changes profiles that belong together.
|
||||
from cura.Machines.QualityGroup import QualityGroup # To construct groups of quality profiles that belong together.
|
||||
|
|
@ -81,15 +82,7 @@ class MachineNode(ContainerNode):
|
|||
if not global_quality_node.container:
|
||||
Logger.log("w", "Node {0} doesn't have a container.".format(global_quality_node.container_id))
|
||||
continue
|
||||
# CURA-6599
|
||||
# Same as QualityChangesGroup.
|
||||
# For some reason, QML will get null or fail to convert type for MachineManager.activeQualityChangesGroup() to
|
||||
# a QObject. Setting the object ownership to QQmlEngine.CppOwnership doesn't work, but setting the object
|
||||
# parent to application seems to work.
|
||||
from cura.CuraApplication import CuraApplication
|
||||
quality_groups[quality_type] = QualityGroup(name = global_quality_node.container.getMetaDataEntry("name", "Unnamed profile"),
|
||||
quality_type = quality_type,
|
||||
parent = CuraApplication.getInstance())
|
||||
quality_groups[quality_type] = QualityGroup(name = global_quality_node.container.getMetaDataEntry("name", "Unnamed profile"), quality_type = quality_type)
|
||||
quality_groups[quality_type].node_for_global = global_quality_node
|
||||
for extruder, qualities_per_type in enumerate(qualities_per_type_per_extruder):
|
||||
if quality_type in qualities_per_type:
|
||||
|
|
@ -168,7 +161,7 @@ class MachineNode(ContainerNode):
|
|||
return self.global_qualities.get(self.preferred_quality_type, next(iter(self.global_qualities.values())))
|
||||
|
||||
## (Re)loads all variants under this printer.
|
||||
def _loadAll(self):
|
||||
def _loadAll(self) -> None:
|
||||
container_registry = ContainerRegistry.getInstance()
|
||||
if not self.has_variants:
|
||||
self.variants["empty"] = VariantNode("empty_variant", machine = self)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue