Fix a crash when adding a printer part of a cluster

This commit is contained in:
fieldOfView 2018-10-04 12:32:42 +02:00
parent 28dc32adab
commit 5b2dc804ca

View file

@ -39,13 +39,13 @@ class FirmwareUpdaterMachineAction(MachineAction):
CuraApplication.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey()) CuraApplication.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey())
def _onOutputDevicesChanged(self) -> None: def _onOutputDevicesChanged(self) -> None:
if self._active_output_device: if self._active_output_device and self._active_output_device.activePrinter:
self._active_output_device.activePrinter.getController().canUpdateFirmwareChanged.disconnect(self._onControllerCanUpdateFirmwareChanged) self._active_output_device.activePrinter.getController().canUpdateFirmwareChanged.disconnect(self._onControllerCanUpdateFirmwareChanged)
output_devices = CuraApplication.getInstance().getMachineManager().printerOutputDevices output_devices = CuraApplication.getInstance().getMachineManager().printerOutputDevices
self._active_output_device = output_devices[0] if output_devices else None self._active_output_device = output_devices[0] if output_devices else None
if self._active_output_device: if self._active_output_device and self._active_output_device.activePrinter:
self._active_output_device.activePrinter.getController().canUpdateFirmwareChanged.connect(self._onControllerCanUpdateFirmwareChanged) self._active_output_device.activePrinter.getController().canUpdateFirmwareChanged.connect(self._onControllerCanUpdateFirmwareChanged)
self.outputDeviceCanUpdateFirmwareChanged.emit() self.outputDeviceCanUpdateFirmwareChanged.emit()