mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
CURA-2079: First concept
This commit is contained in:
parent
c60ddbecfb
commit
9a34f6b067
2 changed files with 48 additions and 5 deletions
|
@ -37,6 +37,26 @@ UM.Dialog
|
||||||
//: Firmware update status label
|
//: Firmware update status label
|
||||||
return catalog.i18nc("@label","Firmware update completed.")
|
return catalog.i18nc("@label","Firmware update completed.")
|
||||||
}
|
}
|
||||||
|
else if (manager.progress == -4)
|
||||||
|
{
|
||||||
|
//: Firmware update status label
|
||||||
|
return catalog.i18nc("@label","Firmware update failed due to missing firmware.")
|
||||||
|
}
|
||||||
|
else if (manager.progress == -3)
|
||||||
|
{
|
||||||
|
//: Firmware update status label
|
||||||
|
return catalog.i18nc("@label","Firmware update failed due to an input/output error.")
|
||||||
|
}
|
||||||
|
else if (manager.progress == -2)
|
||||||
|
{
|
||||||
|
//: Firmware update status label
|
||||||
|
return catalog.i18nc("@label","Firmware update failed due to an communication error.")
|
||||||
|
}
|
||||||
|
else if (manager.progress == -1)
|
||||||
|
{
|
||||||
|
//: Firmware update status label
|
||||||
|
return catalog.i18nc("@label","Firmware update failed due to an unknown error.")
|
||||||
|
}
|
||||||
else if (manager.progress == 0)
|
else if (manager.progress == 0)
|
||||||
{
|
{
|
||||||
//: Firmware update status label
|
//: Firmware update status label
|
||||||
|
|
|
@ -182,7 +182,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
|
|
||||||
if len(hex_file) == 0:
|
if len(hex_file) == 0:
|
||||||
Logger.log("e", "Unable to read provided hex file. Could not update firmware")
|
Logger.log("e", "Unable to read provided hex file. Could not update firmware")
|
||||||
self._updateFirmware_completed()
|
self._updateFirmware_completed_missing_firmware()
|
||||||
return
|
return
|
||||||
|
|
||||||
programmer = stk500v2.Stk500v2()
|
programmer = stk500v2.Stk500v2()
|
||||||
|
@ -208,16 +208,39 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
self._updating_firmware = False
|
self._updating_firmware = False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Logger.log("e", "Exception while trying to update firmware %s" %e)
|
Logger.log("e", "Exception while trying to update firmware %s" %e)
|
||||||
self._updateFirmware_completed()
|
self._updateFirmware_completed_unknown()
|
||||||
return
|
return
|
||||||
programmer.close()
|
programmer.close()
|
||||||
|
|
||||||
self._updateFirmware_completed()
|
self._updateFirmware_completed()
|
||||||
return
|
return
|
||||||
|
|
||||||
## Private function which makes sure that firmware update process has completed/ended
|
## Private function which makes sure that firmware update process has failed by missing firmware
|
||||||
def _updateFirmware_completed(self):
|
def _updateFirmware_completed_missing_firmware(self):
|
||||||
self.setProgress(100, 100)
|
return self._updateFirmware_common(progress = -4)
|
||||||
|
|
||||||
|
## Private function which makes sure that firmware update process has failed by an IO error
|
||||||
|
def _updateFirmware_completed_io_error(self):
|
||||||
|
return self._updateFirmware_common(progress = -3)
|
||||||
|
|
||||||
|
## Private function which makes sure that firmware update process has failed by a communication problem
|
||||||
|
def _updateFirmware_completed_communication_error(self):
|
||||||
|
return self._updateFirmware_common(progress = -2)
|
||||||
|
|
||||||
|
## Private function which makes sure that firmware update process has failed by an unknown error
|
||||||
|
def _updateFirmware_completed_unknown(self):
|
||||||
|
return self._updateFirmware_common(progress = -1)
|
||||||
|
|
||||||
|
## Private function which makes sure that firmware update process has sucessfully completed/ended
|
||||||
|
def _updateFirmware_completed_sucessfully(self):
|
||||||
|
return self._updateFirmware_common(progress = 100)
|
||||||
|
|
||||||
|
## Private common function which makes sure that firmware update process has completed/ended with a set progress state
|
||||||
|
def _updateFirmware_completed_common(self, progress, max_progress = 100):
|
||||||
|
if not progress:
|
||||||
|
raise Exception("Progresss not set!")
|
||||||
|
|
||||||
|
self.setProgress(progress, max_progress = max_progress)
|
||||||
self._firmware_update_finished = True
|
self._firmware_update_finished = True
|
||||||
self.resetFirmwareUpdate(update_has_finished=True)
|
self.resetFirmwareUpdate(update_has_finished=True)
|
||||||
self.firmwareUpdateComplete.emit()
|
self.firmwareUpdateComplete.emit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue