From af3e4e3a15fb116a4dc2cc47b575ddfc6657788a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 17 Jun 2016 15:45:10 +0200 Subject: [PATCH] Machine actions can now be used as a plugin type for Cura CURA-1385 --- cura/CuraApplication.py | 3 +++ cura/MachineActionManager.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 5f5880e3d5..a44cada17b 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -44,6 +44,7 @@ from . import ZOffsetDecorator from . import CuraSplashScreen from . import MachineManagerModel from . import ContainerSettingsModel +from . import MachineActionManager from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS from PyQt5.QtGui import QColor, QIcon @@ -100,6 +101,8 @@ class CuraApplication(QtApplication): SettingDefinition.addSupportedProperty("settable_globally", DefinitionPropertyType.Any, default = True) SettingDefinition.addSettingType("extruder", int, str, UM.Settings.Validator) + self._machine_action_manager = MachineActionManager.MachineActionManager() + super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType) self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png"))) diff --git a/cura/MachineActionManager.py b/cura/MachineActionManager.py index 37993e252f..d2ebfc6799 100644 --- a/cura/MachineActionManager.py +++ b/cura/MachineActionManager.py @@ -2,6 +2,8 @@ # Cura is released under the terms of the AGPLv3 or higher. from UM.Logger import Logger +from UM.PluginRegistry import PluginRegistry # So MachineAction can be added as plugin type + ## Raised when trying to add an unknown machine action as a required action class UnknownMachineAction(Exception): @@ -27,6 +29,8 @@ class MachineActionManager: ## Dict of all actions that need to be done when first added by machine reference. self._first_start_actions = {} + PluginRegistry.addType("machine_action", self.addMachineAction) + ## Add a required action to a machine # Raises an exception when the action is not recognised. def addRequiredAction(self, machine, action_key):