Browse Source

Move Firmware Updater into a plugin of its own

fieldOfView 6 years ago
parent
commit
b7542a8ef8

+ 2 - 2
plugins/UltimakerMachineActions/UpgradeFirmwareMachineAction.py → plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.py

@@ -19,10 +19,10 @@ if MYPY:
 catalog = i18nCatalog("cura")
 
 ##  Upgrade the firmware of a machine by USB with this action.
-class UpgradeFirmwareMachineAction(MachineAction):
+class FirmwareUpdaterMachineAction(MachineAction):
     def __init__(self) -> None:
         super().__init__("UpgradeFirmware", catalog.i18nc("@action", "Upgrade Firmware"))
-        self._qml_url = "UpgradeFirmwareMachineAction.qml"
+        self._qml_url = "FirmwareUpdaterMachineAction.qml"
         ContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
 
         self._active_output_device = None #type: Optional[PrinterOutputDevice]

+ 9 - 9
plugins/UltimakerMachineActions/UpgradeFirmwareMachineAction.qml → plugins/FirmwareUpdater/FirmwareUpdaterMachineAction.qml

@@ -20,7 +20,7 @@ Cura.MachineAction
 
     Column
     {
-        id: upgradeFirmwareMachineAction
+        id: firmwareUpdaterMachineAction
         anchors.fill: parent;
         UM.I18nCatalog { id: catalog; name:"cura"}
         spacing: UM.Theme.getSize("default_margin").height
@@ -28,7 +28,7 @@ Cura.MachineAction
         Label
         {
             width: parent.width
-            text: catalog.i18nc("@title", "Upgrade Firmware")
+            text: catalog.i18nc("@title", "Update Firmware")
             wrapMode: Text.WordWrap
             font.pointSize: 18
         }
@@ -59,7 +59,7 @@ Cura.MachineAction
                 enabled: parent.firmwareName != "" && canUpdateFirmware
                 onClicked:
                 {
-                    firmwareUpdateWindow.visible = true;
+                    updateProgressDialog.visible = true;
                     activeOutputDevice.updateFirmware(parent.firmwareName);
                 }
             }
@@ -79,8 +79,8 @@ Cura.MachineAction
         {
             width: parent.width
             wrapMode: Text.WordWrap
-            visible: !printerConnected && !firmwareUpdateWindow.visible
-            text: catalog.i18nc("@label", "Firmware can not be upgraded because there is no connection with the printer.");
+            visible: !printerConnected && !updateProgressDialog.visible
+            text: catalog.i18nc("@label", "Firmware can not be updated because there is no connection with the printer.");
         }
 
         Label
@@ -88,7 +88,7 @@ Cura.MachineAction
             width: parent.width
             wrapMode: Text.WordWrap
             visible: printerConnected && !canUpdateFirmware
-            text: catalog.i18nc("@label", "Firmware can not be upgraded because the connection with the printer does not support upgrading firmware.");
+            text: catalog.i18nc("@label", "Firmware can not be updated because the connection with the printer does not support upgrading firmware.");
         }
     }
 
@@ -100,14 +100,14 @@ Cura.MachineAction
         selectExisting: true
         onAccepted:
         {
-            firmwareUpdateWindow.visible = true;
+            updateProgressDialog.visible = true;
             activeOutputDevice.updateFirmware(fileUrl);
         }
     }
 
     UM.Dialog
     {
-        id: firmwareUpdateWindow
+        id: updateProgressDialog
 
         width: minimumWidth
         minimumWidth: 500 * screenScaleFactor
@@ -184,7 +184,7 @@ Cura.MachineAction
             {
                 text: catalog.i18nc("@action:button","Close");
                 enabled: (manager.firmwareUpdater != null) ? manager.firmwareUpdater.firmwareUpdateState != 1 : true;
-                onClicked: firmwareUpdateWindow.visible = false;
+                onClicked: updateProgressDialog.visible = false;
             }
         ]
     }

+ 13 - 0
plugins/FirmwareUpdater/__init__.py

@@ -0,0 +1,13 @@
+# Copyright (c) 2018 Ultimaker B.V.
+# Cura is released under the terms of the LGPLv3 or higher.
+
+from . import FirmwareUpdaterMachineAction
+
+def getMetaData():
+    return {
+    }
+
+def register(app):
+    return { "machine_action": [
+        FirmwareUpdaterMachineAction.FirmwareUpdaterMachineAction(),
+    ]}

+ 8 - 0
plugins/FirmwareUpdater/plugin.json

@@ -0,0 +1,8 @@
+{
+    "name": "Firmware Updater",
+    "author": "Ultimaker B.V.",
+    "version": "1.0.0",
+    "description": "Provides a machine actions for updating firmware.",
+    "api": 5,
+    "i18n-catalog": "cura"
+}

+ 0 - 5
plugins/UltimakerMachineActions/__init__.py

@@ -2,13 +2,9 @@
 # Cura is released under the terms of the LGPLv3 or higher.
 
 from . import BedLevelMachineAction
-from . import UpgradeFirmwareMachineAction
 from . import UMOUpgradeSelection
 from . import UM2UpgradeSelection
 
-from UM.i18n import i18nCatalog
-catalog = i18nCatalog("cura")
-
 def getMetaData():
     return {
     }
@@ -16,7 +12,6 @@ def getMetaData():
 def register(app):
     return { "machine_action": [
         BedLevelMachineAction.BedLevelMachineAction(),
-        UpgradeFirmwareMachineAction.UpgradeFirmwareMachineAction(),
         UMOUpgradeSelection.UMOUpgradeSelection(),
         UM2UpgradeSelection.UM2UpgradeSelection()
     ]}

+ 17 - 0
resources/bundled_packages/cura.json

@@ -118,6 +118,23 @@
             }
         }
     },
+    "FirmwareUpdater": {
+        "package_info": {
+            "package_id": "FirmwareUpdater",
+            "package_type": "plugin",
+            "display_name": "Firmware Updater",
+            "description": "Provides a machine actions for updating firmware.",
+            "package_version": "1.0.0",
+            "sdk_version": 5,
+            "website": "https://ultimaker.com",
+            "author": {
+                "author_id": "Ultimaker",
+                "display_name": "Ultimaker B.V.",
+                "email": "plugins@ultimaker.com",
+                "website": "https://ultimaker.com"
+            }
+        }
+    },
     "GCodeGzReader": {
         "package_info": {
             "package_id": "GCodeGzReader",