Просмотр исходного кода

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.
Ghostkeeper 5 лет назад
Родитель
Сommit
bc3300baa8
2 измененных файлов с 4 добавлено и 6 удалено
  1. 2 3
      cura/Machines/MachineNode.py
  2. 2 3
      cura/Machines/VariantNode.py

+ 2 - 3
cura/Machines/MachineNode.py

@@ -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:

+ 2 - 3
cura/Machines/VariantNode.py

@@ -27,12 +27,11 @@ class VariantNode(ContainerNode):
         self.materials = {}  # type: Dict[str, MaterialNode]  # Mapping material base files to their nodes.
         container_registry = ContainerRegistry.getInstance()
         self.variant_name = container_registry.findContainersMetadata(id = container_id)[0]["name"] #Store our own name so that we can filter more easily.
-        container_registry.allMetadataLoaded.connect(self._reloadAll)
         container_registry.containerAdded.connect(self._materialAdded)
-        self._reloadAll()
+        self._loadAll()
 
     ##  (Re)loads all materials under this variant.
-    def _reloadAll(self):
+    def _loadAll(self):
         container_registry = ContainerRegistry.getInstance()
         # Find all the materials for this variant's name.
         if not self.parent.has_machine_materials:  # Printer has no specific materials. Look for all fdmprinter materials.