diff options
author | Jaime van Kessel <nallath@gmail.com> | 2016-12-06 16:21:57 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2016-12-06 16:21:57 +0300 |
commit | 3e54c86c88055aa0098c521727a26126ac02c7af (patch) | |
tree | 9082a2852ec78d013b48aa196c24d4b80786ac85 /cura/MachineAction.py | |
parent | 5aa394b197cd0b8bdc2daa83bfe16b418e13b73d (diff) |
Updated documentation for MachineActions
Diffstat (limited to 'cura/MachineAction.py')
-rw-r--r-- | cura/MachineAction.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/cura/MachineAction.py b/cura/MachineAction.py index b9ff938303..c4553bc1e4 100644 --- a/cura/MachineAction.py +++ b/cura/MachineAction.py @@ -6,13 +6,21 @@ from PyQt5.QtQml import QQmlComponent, QQmlContext from UM.PluginObject import PluginObject from UM.PluginRegistry import PluginRegistry - +from UM.Logger import Logger from UM.Application import Application import os +## Machine actions are actions that are added to a specific machine type. Examples of such actions are +# updating the firmware, connecting with remote devices or doing bed leveling. A machine action can also have a +# qml, which should contain a "Cura.MachineAction" item. When activated, the item will be displayed in a dialog +# and this object will be added as "manager" (so all pyqtSlot() functions can be called by calling manager.func()) class MachineAction(QObject, PluginObject): + + ## Create a new Machine action. + # \param key unique key of the machine action + # \param label Human readable label used to identify the machine action. def __init__(self, key, label = ""): super().__init__() self._key = key @@ -63,13 +71,16 @@ class MachineAction(QObject, PluginObject): def finished(self): return self._finished + ## Protected helper to create a view object based on provided QML. def _createViewFromQML(self): - path = QUrl.fromLocalFile( - os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), self._qml_url)) + path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), self._qml_url)) self._component = QQmlComponent(Application.getInstance()._engine, path) self._context = QQmlContext(Application.getInstance()._engine.rootContext()) self._context.setContextProperty("manager", self) self._view = self._component.create(self._context) + if self._view is None: + Logger.log("c", "QQmlComponent status %s", self._component.status()) + Logger.log("c", "QQmlComponent error string %s", self._component.errorString()) @pyqtProperty(QObject, constant = True) def displayItem(self): |