Add canUpdateFirmware property to printer output devices

This commit is contained in:
fieldOfView 2018-08-08 15:53:26 +02:00
parent 339987be9d
commit 688a5083d2
5 changed files with 11 additions and 1 deletions

View file

@ -29,6 +29,8 @@ class GenericOutputController(PrinterOutputController):
self._output_device.printersChanged.connect(self._onPrintersChanged)
self._active_printer = None
self.can_update_firmware = True
def _onPrintersChanged(self):
if self._active_printer:
self._active_printer.stateChanged.disconnect(self._onPrinterStateChanged)

View file

@ -18,6 +18,7 @@ class PrinterOutputController:
self.can_pre_heat_hotends = True
self.can_send_raw_gcode = True
self.can_control_manually = True
self.can_update_firmware = False
self._output_device = output_device
def setTargetHotendTemperature(self, printer: "PrinterOutputModel", extruder: "ExtruderOutputModel", temperature: int):

View file

@ -277,6 +277,13 @@ class PrinterOutputModel(QObject):
return self._controller.can_control_manually
return False
# Does the printer support upgrading firmware
@pyqtProperty(bool, notify = canUpdateFirmwareChanged)
def canUpdateFirmware(self):
if self._controller:
return self._controller.can_update_firmware
return False
# Returns the configuration (material, variant and buildplate) of the current printer
@pyqtProperty(QObject, notify = configurationChanged)
def printerConfiguration(self):

View file

@ -9,7 +9,6 @@ from .avr_isp import stk500v2, intelHex
from enum import IntEnum
@signalemitter
class AvrFirmwareUpdater(QObject):
firmwareProgressChanged = pyqtSignal()
firmwareUpdateStateChanged = pyqtSignal()

View file

@ -16,6 +16,7 @@ Cura.MachineAction
anchors.fill: parent;
property bool printerConnected: Cura.MachineManager.printerConnected
property var activeOutputDevice: printerConnected ? Cura.MachineManager.printerOutputDevices[0] : null
property var canUpdateFirmware: activeOutputDevice ? activeOutputDevice.canUpdateFirmware : False
Item
{