diff --git a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py index 392f89682f..0c8bf3480f 100644 --- a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py +++ b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py @@ -18,6 +18,11 @@ class UMOCheckupMachineAction(MachineAction): self._y_min_endstop_test_completed = False self._z_min_endstop_test_completed = False + self._check_started = False + + Application.getInstance().getOutputDeviceManager().outputDevicesChanged.connect(self._onOutputDevicesChanged) + + onBedTestCompleted = pyqtSignal() onHotendTestCompleted = pyqtSignal() @@ -28,6 +33,13 @@ class UMOCheckupMachineAction(MachineAction): bedTemperatureChanged = pyqtSignal() hotendTemperatureChanged = pyqtSignal() + def _onOutputDevicesChanged(self): + # Check if this action was started, but no output device was found the first time. + # If so, re-try now that an output device has been added/removed. + if self._output_device is None and self._check_started: + self.startCheck() + + def _getPrinterOutputDevices(self): return [printer_output_device for printer_output_device in Application.getInstance().getOutputDeviceManager().getOutputDevices() if @@ -46,6 +58,8 @@ class UMOCheckupMachineAction(MachineAction): pass self._output_device = None + self._check_started = False + # Ensure everything is reset (and right signals are emitted again) self._bed_test_completed = False self.onBedTestCompleted.emit() @@ -121,6 +135,7 @@ class UMOCheckupMachineAction(MachineAction): @pyqtSlot() def startCheck(self): + self._check_started = True output_devices = self._getPrinterOutputDevices() if output_devices: self._output_device = output_devices[0]