Starting UMOCheckup before connection was established now works correctly

CURA-1385
This commit is contained in:
Jaime van Kessel 2016-06-23 13:10:57 +02:00
parent 488740c60d
commit b14ae94190

View file

@ -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]