mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 18:59:11 +08:00
Switch if-statement around for fail checking
This reduces indent and makes the control flow a bit easier to read in my opinion. Contributes to issue CURA-5061.
This commit is contained in:
parent
375770818b
commit
676f9b8474
@ -10,6 +10,7 @@ from UM.FlameProfiler import pyqtSlot
|
|||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
|
from UM.Logger import Logger
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
|
|
||||||
@ -32,7 +33,10 @@ class BedLevelMachineAction(MachineAction):
|
|||||||
def startBedLeveling(self):
|
def startBedLeveling(self):
|
||||||
self._bed_level_position = 0
|
self._bed_level_position = 0
|
||||||
printer_output_devices = self._getPrinterOutputDevices()
|
printer_output_devices = self._getPrinterOutputDevices()
|
||||||
if printer_output_devices:
|
if not printer_output_devices:
|
||||||
|
Logger.log("e", "Can't start bed levelling. The printer connection seems to have been lost.")
|
||||||
|
return
|
||||||
|
|
||||||
printer_output_devices[0].homeBed()
|
printer_output_devices[0].homeBed()
|
||||||
printer_output_devices[0].moveHead(0, 0, 3)
|
printer_output_devices[0].moveHead(0, 0, 3)
|
||||||
printer_output_devices[0].homeHead()
|
printer_output_devices[0].homeHead()
|
||||||
@ -43,7 +47,10 @@ class BedLevelMachineAction(MachineAction):
|
|||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def moveToNextLevelPosition(self):
|
def moveToNextLevelPosition(self):
|
||||||
output_devices = self._getPrinterOutputDevices()
|
output_devices = self._getPrinterOutputDevices()
|
||||||
if output_devices: # We found at least one output device
|
if not output_devices: #No output devices. Can't move.
|
||||||
|
Logger.log("e", "Can't move to the next position. The printer connection seems to have been lost.")
|
||||||
|
return
|
||||||
|
|
||||||
output_device = output_devices[0]
|
output_device = output_devices[0]
|
||||||
|
|
||||||
if self._bed_level_position == 0:
|
if self._bed_level_position == 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user