Assume that the tree is always constructed after metadata has been loaded

Safe assumption, since the tree can only start constructing after the stacks are loaded.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-06 15:13:29 +02:00
parent b46d4eb2b5
commit bc3300baa8
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
2 changed files with 4 additions and 6 deletions

View file

@ -21,12 +21,11 @@ class MachineNode(ContainerNode):
self.variants = {} # type: Dict[str, VariantNode] # mapping variant names to their nodes.
container_registry = ContainerRegistry.getInstance()
self.has_machine_materials = parseBool(container_registry.findContainersMetadata(id = container_id)[0].get("has_machine_materials", "true"))
container_registry.allMetadataLoaded.connect(self._reloadAll)
container_registry.containerAdded.connect(self._variantAdded)
self._reloadAll()
self._loadAll()
## (Re)loads all variants under this printer.
def _reloadAll(self):
def _loadAll(self):
# Find all the variants for this definition ID.
variants = ContainerRegistry.getInstance().findInstanceContainersMetadata(type = "variant", definition = self.container_id, hardware_type = "nozzle")
for variant in variants: