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): diff --git a/plugins/UltimakerMachineActions/BedLevelMachineAction.py b/plugins/UltimakerMachineActions/BedLevelMachineAction.py index c80a8ffc01..117b2c99e2 100644 --- a/plugins/UltimakerMachineActions/BedLevelMachineAction.py +++ b/plugins/UltimakerMachineActions/BedLevelMachineAction.py @@ -8,6 +8,8 @@ from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") +## A simple action to handle manual bed leveling procedure for printers that don't have it on the firmware. +# This is currently only used by the Ultimaker Original+ class BedLevelMachineAction(MachineAction): def __init__(self): super().__init__("BedLevel", catalog.i18nc("@action", "Level build plate")) diff --git a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py index 355b4dd0c1..f9ad4789e5 100644 --- a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py +++ b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py @@ -8,6 +8,7 @@ from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") +## Action to check up if the self-built UMO was done correctly. class UMOCheckupMachineAction(MachineAction): def __init__(self): super().__init__("UMOCheckup", catalog.i18nc("@action", "Checkup")) @@ -27,7 +28,6 @@ class UMOCheckupMachineAction(MachineAction): Application.getInstance().getOutputDeviceManager().outputDevicesChanged.connect(self._onOutputDevicesChanged) - onBedTestCompleted = pyqtSignal() onHotendTestCompleted = pyqtSignal() diff --git a/plugins/UltimakerMachineActions/UMOUpgradeSelection.py b/plugins/UltimakerMachineActions/UMOUpgradeSelection.py index e85ec7b434..a9148e0c7b 100644 --- a/plugins/UltimakerMachineActions/UMOUpgradeSelection.py +++ b/plugins/UltimakerMachineActions/UMOUpgradeSelection.py @@ -7,6 +7,9 @@ catalog = i18nCatalog("cura") import UM.Settings.InstanceContainer + +## The Ultimaker Original can have a few revisions & upgrades. This action helps with selecting them, so they are added +# as a variant. class UMOUpgradeSelection(MachineAction): def __init__(self): super().__init__("UMOUpgradeSelection", catalog.i18nc("@action", "Select upgrades")) diff --git a/plugins/UltimakerMachineActions/UpgradeFirmwareMachineAction.py b/plugins/UltimakerMachineActions/UpgradeFirmwareMachineAction.py index 71d3f0b55b..828411cc8a 100644 --- a/plugins/UltimakerMachineActions/UpgradeFirmwareMachineAction.py +++ b/plugins/UltimakerMachineActions/UpgradeFirmwareMachineAction.py @@ -5,6 +5,7 @@ import UM.Settings.DefinitionContainer catalog = i18nCatalog("cura") +## Upgrade the firmware of a machine by USB with this action. class UpgradeFirmwareMachineAction(MachineAction): def __init__(self): super().__init__("UpgradeFirmware", catalog.i18nc("@action", "Upgrade Firmware")) @@ -12,6 +13,6 @@ class UpgradeFirmwareMachineAction(MachineAction): cura.Settings.CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded) def _onContainerAdded(self, container): - # Add this action as a supported action to all machine definitions + # Add this action as a supported action to all machine definitions if they support USB connection if isinstance(container, UM.Settings.DefinitionContainer) and container.getMetaDataEntry("type") == "machine" and container.getMetaDataEntry("supports_usb_connection"): UM.Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey())