mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Machine actions can now be used as a plugin type for Cura
CURA-1385
This commit is contained in:
parent
4beec2982e
commit
af3e4e3a15
2 changed files with 7 additions and 0 deletions
|
@ -44,6 +44,7 @@ from . import ZOffsetDecorator
|
||||||
from . import CuraSplashScreen
|
from . import CuraSplashScreen
|
||||||
from . import MachineManagerModel
|
from . import MachineManagerModel
|
||||||
from . import ContainerSettingsModel
|
from . import ContainerSettingsModel
|
||||||
|
from . import MachineActionManager
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS
|
from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS
|
||||||
from PyQt5.QtGui import QColor, QIcon
|
from PyQt5.QtGui import QColor, QIcon
|
||||||
|
@ -100,6 +101,8 @@ class CuraApplication(QtApplication):
|
||||||
SettingDefinition.addSupportedProperty("settable_globally", DefinitionPropertyType.Any, default = True)
|
SettingDefinition.addSupportedProperty("settable_globally", DefinitionPropertyType.Any, default = True)
|
||||||
SettingDefinition.addSettingType("extruder", int, str, UM.Settings.Validator)
|
SettingDefinition.addSettingType("extruder", int, str, UM.Settings.Validator)
|
||||||
|
|
||||||
|
self._machine_action_manager = MachineActionManager.MachineActionManager()
|
||||||
|
|
||||||
super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType)
|
super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType)
|
||||||
|
|
||||||
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
|
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
from UM.Logger import Logger
|
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
|
## Raised when trying to add an unknown machine action as a required action
|
||||||
class UnknownMachineAction(Exception):
|
class UnknownMachineAction(Exception):
|
||||||
|
@ -27,6 +29,8 @@ class MachineActionManager:
|
||||||
## Dict of all actions that need to be done when first added by machine reference.
|
## Dict of all actions that need to be done when first added by machine reference.
|
||||||
self._first_start_actions = {}
|
self._first_start_actions = {}
|
||||||
|
|
||||||
|
PluginRegistry.addType("machine_action", self.addMachineAction)
|
||||||
|
|
||||||
## Add a required action to a machine
|
## Add a required action to a machine
|
||||||
# Raises an exception when the action is not recognised.
|
# Raises an exception when the action is not recognised.
|
||||||
def addRequiredAction(self, machine, action_key):
|
def addRequiredAction(self, machine, action_key):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue