Make ContainerTree singleton but construct in run() of application

We want to make sure that this tree is constructed during start-up after all containers have been registered, so we call getInstance() there once. If you need the tree before that, the tree will not yet have been filled and you won't get complete information, so you'd need to listen for updates.
The singleton is there so you don't need to go via CuraApplication.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-08 17:30:24 +02:00
parent 65360c31ef
commit e106692165
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
2 changed files with 12 additions and 0 deletions

View file

@ -70,6 +70,7 @@ from cura.Scene.CuraSceneNode import CuraSceneNode
from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator
from cura.Scene import ZOffsetDecorator
from cura.Machines.ContainerTree import ContainerTree
from cura.Machines.MachineErrorChecker import MachineErrorChecker
import cura.Machines.MaterialManager #Imported like this to prevent circular imports.
import cura.Machines.QualityManager #Imported like this to prevent circular imports.
@ -731,6 +732,9 @@ class CuraApplication(QtApplication):
def run(self):
super().run()
Logger.log("i", "Building container tree.")
ContainerTree.getInstance()
Logger.log("i", "Initializing machine manager")
self._machine_manager = MachineManager(self, parent = self)