mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 13:06:05 +08:00
Remove ContainerGroup in favour of QualityGroup
This commit is contained in:
parent
37f86a43de
commit
741dc8b8a3
@ -1,51 +0,0 @@
|
|||||||
# Copyright (c) 2018 Ultimaker B.V.
|
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
|
||||||
|
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
from PyQt5.Qt import QObject, pyqtSlot
|
|
||||||
|
|
||||||
from cura.Machines.ContainerNode import ContainerNode
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# A ContainerGroup represents a group of containers that must be applied to each ContainerStack when it's used.
|
|
||||||
# Some concrete examples are Quality and QualityChanges: when we select quality type "normal", this quality type
|
|
||||||
# must be applied to all stacks in a machine, although each stack can have different containers. Use an Ultimaker 3
|
|
||||||
# as an example, suppose we choose quality type "normal", the actual InstanceConstainers on each stack may look
|
|
||||||
# as below:
|
|
||||||
# GlobalStack ExtruderStack 1 ExtruderStack 2
|
|
||||||
# quality container: um3_global_normal um3_aa04_pla_normal um3_aa04_abs_normal
|
|
||||||
#
|
|
||||||
# This ContainerGroup is mainly used in quality and quality_changes to group the containers that can be applied to
|
|
||||||
# a machine, so when a quality/custom quality is selected, the container can be directly applied to each stack instead
|
|
||||||
# of looking them up again.
|
|
||||||
#
|
|
||||||
class ContainerGroup(QObject):
|
|
||||||
|
|
||||||
def __init__(self, name: str, parent = None):
|
|
||||||
super().__init__(parent)
|
|
||||||
self.name = name
|
|
||||||
self.node_for_global = None # type: Optional[ContainerNode]
|
|
||||||
self.nodes_for_extruders = dict()
|
|
||||||
|
|
||||||
@pyqtSlot(result = str)
|
|
||||||
def getName(self) -> str:
|
|
||||||
return self.name
|
|
||||||
|
|
||||||
def getAllKeys(self) -> set:
|
|
||||||
result = set()
|
|
||||||
for node in [self.node_for_global] + list(self.nodes_for_extruders.values()):
|
|
||||||
if node is None:
|
|
||||||
continue
|
|
||||||
for key in node.getContainer().getAllKeys():
|
|
||||||
result.add(key)
|
|
||||||
return result
|
|
||||||
|
|
||||||
def getAllNodes(self) -> List[ContainerNode]:
|
|
||||||
result = []
|
|
||||||
if self.node_for_global is not None:
|
|
||||||
result.append(self.node_for_global)
|
|
||||||
for extruder_node in self.nodes_for_extruders.values():
|
|
||||||
result.append(extruder_node)
|
|
||||||
return result
|
|
@ -1,16 +1,14 @@
|
|||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Optional, List
|
||||||
|
|
||||||
from PyQt5.Qt import pyqtSignal
|
from PyQt5.QtCore import QObject, QTimer, pyqtSignal, pyqtSlot
|
||||||
from PyQt5.QtCore import QObject, QTimer
|
|
||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Util import parseBool
|
from UM.Util import parseBool
|
||||||
|
|
||||||
from cura.Machines.ContainerGroup import ContainerGroup
|
|
||||||
from cura.Machines.ContainerNode import ContainerNode
|
from cura.Machines.ContainerNode import ContainerNode
|
||||||
|
|
||||||
|
|
||||||
@ -29,14 +27,50 @@ from cura.Machines.ContainerNode import ContainerNode
|
|||||||
# + <quality_changes_name>
|
# + <quality_changes_name>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#
|
||||||
class QualityGroup(ContainerGroup):
|
# A QualityGroup represents a group of containers that must be applied to each ContainerStack when it's used.
|
||||||
|
# Some concrete examples are Quality and QualityChanges: when we select quality type "normal", this quality type
|
||||||
|
# must be applied to all stacks in a machine, although each stack can have different containers. Use an Ultimaker 3
|
||||||
|
# as an example, suppose we choose quality type "normal", the actual InstanceContainers on each stack may look
|
||||||
|
# as below:
|
||||||
|
# GlobalStack ExtruderStack 1 ExtruderStack 2
|
||||||
|
# quality container: um3_global_normal um3_aa04_pla_normal um3_aa04_abs_normal
|
||||||
|
#
|
||||||
|
# This QualityGroup is mainly used in quality and quality_changes to group the containers that can be applied to
|
||||||
|
# a machine, so when a quality/custom quality is selected, the container can be directly applied to each stack instead
|
||||||
|
# of looking them up again.
|
||||||
|
#
|
||||||
|
class QualityGroup(QObject):
|
||||||
|
|
||||||
def __init__(self, name: str, quality_type: str, parent = None):
|
def __init__(self, name: str, quality_type: str, parent = None):
|
||||||
super().__init__(name, parent)
|
super().__init__(parent)
|
||||||
|
self.name = name
|
||||||
|
self.node_for_global = None # type: Optional["QualityGroup"]
|
||||||
|
self.nodes_for_extruders = dict() # position str -> QualityGroup
|
||||||
self.quality_type = quality_type
|
self.quality_type = quality_type
|
||||||
self.is_available = False
|
self.is_available = False
|
||||||
|
|
||||||
|
@pyqtSlot(result = str)
|
||||||
|
def getName(self) -> str:
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
def getAllKeys(self) -> set:
|
||||||
|
result = set()
|
||||||
|
for node in [self.node_for_global] + list(self.nodes_for_extruders.values()):
|
||||||
|
if node is None:
|
||||||
|
continue
|
||||||
|
for key in node.getContainer().getAllKeys():
|
||||||
|
result.add(key)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def getAllNodes(self) -> List["QualityGroup"]:
|
||||||
|
result = []
|
||||||
|
if self.node_for_global is not None:
|
||||||
|
result.append(self.node_for_global)
|
||||||
|
for extruder_node in self.nodes_for_extruders.values():
|
||||||
|
result.append(extruder_node)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
class QualityChangesGroup(QualityGroup):
|
class QualityChangesGroup(QualityGroup):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user