Make sure MachineManager initializes after ContainerRegistry does

CURA-4084

When MachineManager gets created, it will find and set the current
active machine. This requires the ContainerRegistry to be initialized
first.
This commit is contained in:
Lipu Fei 2017-07-26 14:07:51 +02:00
parent 93731b8d1f
commit 9c1d23fe5b
3 changed files with 8 additions and 3 deletions

View file

@ -119,6 +119,12 @@ class CuraApplication(QtApplication):
Q_ENUMS(ResourceTypes)
# FIXME: This signal belongs to the MachineManager, but the CuraEngineBackend plugin requires on it.
# Because plugins are initialized before the ContainerRegistry, putting this signal in MachineManager
# will make it initialized before ContainerRegistry does, and it won't find the active machine, thus
# Cura will always show the Add Machine Dialog upon start.
stacksValidationFinished = pyqtSignal() # Emitted whenever a validation is finished
def __init__(self):
# this list of dir names will be used by UM to detect an old cura directory
for dir_name in ["extruders", "machine_instances", "materials", "plugins", "quality", "user", "variants"]:

View file

@ -115,7 +115,6 @@ class MachineManager(QObject):
activeStackValueChanged = pyqtSignal() # Emitted whenever a value inside the active stack is changed.
activeStackValidationChanged = pyqtSignal() # Emitted whenever a validation inside active container is changed
stacksValidationChanged = pyqtSignal() # Emitted whenever a validation is changed
stacksValidationFinished = pyqtSignal() # Emitted whenever a validation is finished
blurSettings = pyqtSignal() # Emitted to force fields in the advanced sidebar to un-focus, so they update properly
@ -306,7 +305,7 @@ class MachineManager(QObject):
self._stacks_have_errors = self._checkStacksHaveErrors()
if old_stacks_have_errors != self._stacks_have_errors:
self.stacksValidationChanged.emit()
self.stacksValidationFinished.emit()
Application.getInstance().stacksValidationFinished.emit()
def _onActiveExtruderStackChanged(self):
self.blurSettings.emit() # Ensure no-one has focus.

View file

@ -77,7 +77,7 @@ class CuraEngineBackend(QObject, Backend):
self._scene.sceneChanged.connect(self._onSceneChanged)
# trigger auto-slicing on error check finished
Application.getInstance().getMachineManager().stacksValidationFinished.connect(self._onStackErrorCheckFinished)
Application.getInstance().stacksValidationFinished.connect(self._onStackErrorCheckFinished)
# Listeners for receiving messages from the back-end.
self._message_handlers["cura.proto.Layer"] = self._onLayerMessage