mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Move Firmware Updater into a plugin of its own
This commit is contained in:
parent
61ffdf23d7
commit
b7542a8ef8
6 changed files with 49 additions and 16 deletions
|
@ -19,10 +19,10 @@ if MYPY:
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
## Upgrade the firmware of a machine by USB with this action.
|
## Upgrade the firmware of a machine by USB with this action.
|
||||||
class UpgradeFirmwareMachineAction(MachineAction):
|
class FirmwareUpdaterMachineAction(MachineAction):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__("UpgradeFirmware", catalog.i18nc("@action", "Upgrade Firmware"))
|
super().__init__("UpgradeFirmware", catalog.i18nc("@action", "Upgrade Firmware"))
|
||||||
self._qml_url = "UpgradeFirmwareMachineAction.qml"
|
self._qml_url = "FirmwareUpdaterMachineAction.qml"
|
||||||
ContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
|
ContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded)
|
||||||
|
|
||||||
self._active_output_device = None #type: Optional[PrinterOutputDevice]
|
self._active_output_device = None #type: Optional[PrinterOutputDevice]
|
|
@ -20,7 +20,7 @@ Cura.MachineAction
|
||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
id: upgradeFirmwareMachineAction
|
id: firmwareUpdaterMachineAction
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
UM.I18nCatalog { id: catalog; name:"cura"}
|
UM.I18nCatalog { id: catalog; name:"cura"}
|
||||||
spacing: UM.Theme.getSize("default_margin").height
|
spacing: UM.Theme.getSize("default_margin").height
|
||||||
|
@ -28,7 +28,7 @@ Cura.MachineAction
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: catalog.i18nc("@title", "Upgrade Firmware")
|
text: catalog.i18nc("@title", "Update Firmware")
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
font.pointSize: 18
|
font.pointSize: 18
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ Cura.MachineAction
|
||||||
enabled: parent.firmwareName != "" && canUpdateFirmware
|
enabled: parent.firmwareName != "" && canUpdateFirmware
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
firmwareUpdateWindow.visible = true;
|
updateProgressDialog.visible = true;
|
||||||
activeOutputDevice.updateFirmware(parent.firmwareName);
|
activeOutputDevice.updateFirmware(parent.firmwareName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,8 @@ Cura.MachineAction
|
||||||
{
|
{
|
||||||
width: parent.width
|
width: parent.width
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
visible: !printerConnected && !firmwareUpdateWindow.visible
|
visible: !printerConnected && !updateProgressDialog.visible
|
||||||
text: catalog.i18nc("@label", "Firmware can not be upgraded because there is no connection with the printer.");
|
text: catalog.i18nc("@label", "Firmware can not be updated because there is no connection with the printer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
|
@ -88,7 +88,7 @@ Cura.MachineAction
|
||||||
width: parent.width
|
width: parent.width
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
visible: printerConnected && !canUpdateFirmware
|
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
|
selectExisting: true
|
||||||
onAccepted:
|
onAccepted:
|
||||||
{
|
{
|
||||||
firmwareUpdateWindow.visible = true;
|
updateProgressDialog.visible = true;
|
||||||
activeOutputDevice.updateFirmware(fileUrl);
|
activeOutputDevice.updateFirmware(fileUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.Dialog
|
UM.Dialog
|
||||||
{
|
{
|
||||||
id: firmwareUpdateWindow
|
id: updateProgressDialog
|
||||||
|
|
||||||
width: minimumWidth
|
width: minimumWidth
|
||||||
minimumWidth: 500 * screenScaleFactor
|
minimumWidth: 500 * screenScaleFactor
|
||||||
|
@ -184,7 +184,7 @@ Cura.MachineAction
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:button","Close");
|
text: catalog.i18nc("@action:button","Close");
|
||||||
enabled: (manager.firmwareUpdater != null) ? manager.firmwareUpdater.firmwareUpdateState != 1 : true;
|
enabled: (manager.firmwareUpdater != null) ? manager.firmwareUpdater.firmwareUpdateState != 1 : true;
|
||||||
onClicked: firmwareUpdateWindow.visible = false;
|
onClicked: updateProgressDialog.visible = false;
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
13
plugins/FirmwareUpdater/__init__.py
Normal file
13
plugins/FirmwareUpdater/__init__.py
Normal file
|
@ -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
plugins/FirmwareUpdater/plugin.json
Normal file
8
plugins/FirmwareUpdater/plugin.json
Normal file
|
@ -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"
|
||||||
|
}
|
|
@ -2,13 +2,9 @@
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from . import BedLevelMachineAction
|
from . import BedLevelMachineAction
|
||||||
from . import UpgradeFirmwareMachineAction
|
|
||||||
from . import UMOUpgradeSelection
|
from . import UMOUpgradeSelection
|
||||||
from . import UM2UpgradeSelection
|
from . import UM2UpgradeSelection
|
||||||
|
|
||||||
from UM.i18n import i18nCatalog
|
|
||||||
catalog = i18nCatalog("cura")
|
|
||||||
|
|
||||||
def getMetaData():
|
def getMetaData():
|
||||||
return {
|
return {
|
||||||
}
|
}
|
||||||
|
@ -16,7 +12,6 @@ def getMetaData():
|
||||||
def register(app):
|
def register(app):
|
||||||
return { "machine_action": [
|
return { "machine_action": [
|
||||||
BedLevelMachineAction.BedLevelMachineAction(),
|
BedLevelMachineAction.BedLevelMachineAction(),
|
||||||
UpgradeFirmwareMachineAction.UpgradeFirmwareMachineAction(),
|
|
||||||
UMOUpgradeSelection.UMOUpgradeSelection(),
|
UMOUpgradeSelection.UMOUpgradeSelection(),
|
||||||
UM2UpgradeSelection.UM2UpgradeSelection()
|
UM2UpgradeSelection.UM2UpgradeSelection()
|
||||||
]}
|
]}
|
||||||
|
|
|
@ -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": {
|
"GCodeGzReader": {
|
||||||
"package_info": {
|
"package_info": {
|
||||||
"package_id": "GCodeGzReader",
|
"package_id": "GCodeGzReader",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue