|
@@ -13,6 +13,9 @@ from UM.Settings.ContainerRegistry import ContainerRegistry #Finding containers
|
|
|
# and makes sure that whenever the machine is swapped, this list is kept up to
|
|
|
# date. It also contains and updates the setting stacks for the extruders.
|
|
|
class ExtruderManager:
|
|
|
+ ## The singleton instance of this manager.
|
|
|
+ __instance = None
|
|
|
+
|
|
|
## Registers listeners and such to listen to changes to the extruders.
|
|
|
def __init__(self):
|
|
|
self._extruders = [] #Extruders for the current machine.
|
|
@@ -20,6 +23,16 @@ class ExtruderManager:
|
|
|
|
|
|
Application.getInstance().globalContainerStackChanged.connect(self._reconnectExtruderReload) #When the current machine changes, we need to reload all extruders belonging to the new machine.
|
|
|
|
|
|
+ ## Gets an instance of this extruder manager.
|
|
|
+ #
|
|
|
+ # If an instance was already created, the old instance is returned. This
|
|
|
+ # implements the singleton pattern.
|
|
|
+ @classmethod
|
|
|
+ def getInstance(cls):
|
|
|
+ if not cls.__instance:
|
|
|
+ cls.__instance = ExtruderManager()
|
|
|
+ return cls.__instance
|
|
|
+
|
|
|
## When the global container stack changes, this reconnects to the new
|
|
|
# signal for containers changing.
|
|
|
def _reconnectExtruderReload(self):
|