Don't make parent a common property

Instead we use properly-typed and appropriately-named variables in each of the sub classes.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-06 16:31:57 +02:00
parent d3dc36c187
commit 8ec1c31b58
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
4 changed files with 27 additions and 27 deletions

View file

@ -17,7 +17,7 @@ if TYPE_CHECKING:
# The subnodes of these nodes are variants.
class MachineNode(ContainerNode):
def __init__(self, container_id: str) -> None:
super().__init__(container_id, None)
super().__init__(container_id)
self.variants = {} # type: Dict[str, VariantNode] # mapping variant names to their nodes.
container_registry = ContainerRegistry.getInstance()
my_metadata = container_registry.findContainersMetadata(id = container_id)[0]
@ -35,7 +35,7 @@ class MachineNode(ContainerNode):
for variant in variants:
variant_name = variant["name"]
if variant_name not in self.variants:
self.variants[variant_name] = VariantNode(variant["id"], parent = self)
self.variants[variant_name] = VariantNode(variant["id"], machine = self)
## When a variant gets added to the set of profiles, we need to update our
# tree here.
@ -50,4 +50,4 @@ class MachineNode(ContainerNode):
if container.getMetaDataEntry("definition") != self.container_id:
return # Not a nozzle that fits in my machine.
self.variants[name] = VariantNode(container.getId(), parent = self)
self.variants[name] = VariantNode(container.getId(), machine = self)