Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.setStatusLabel("Disconnected")
self.coldBootButton.setEnabled(True)
elif (state == UIState.CONNECTING):
self.resetButton.setEnabled(False)
self.programButton.setEnabled(False)
self.setStatusLabel("Trying to connect cold bootloader, restart the Crazyflie to connect")
self.coldBootButton.setEnabled(False)
elif (state == UIState.CONNECT_FAILED):
self.setStatusLabel("Connecting to bootloader failed")
self.coldBootButton.setEnabled(True)
elif (state == UIState.COLD_CONNECT):
self.resetButton.setEnabled(True)
self.programButton.setEnabled(True)
self.setStatusLabel("Connected to bootloader")
self.coldBootButton.setEnabled(False)
elif (state == UIState.RESET):
self.setStatusLabel("Resetting to firmware, disconnected")
self.resetButton.setEnabled(False)
self.programButton.setEnabled(False)
self.coldBootButton.setEnabled(False)
def setUiState(self, state):
if (state == UIState.DISCONNECTED):
self.resetButton.setEnabled(False)
self.programButton.setEnabled(False)
self.setStatusLabel("Disconnected")
self.coldBootButton.setEnabled(True)
elif (state == UIState.CONNECTING):
self.resetButton.setEnabled(False)
self.programButton.setEnabled(False)
self.setStatusLabel("Trying to connect cold bootloader, restart the Crazyflie to connect")
self.coldBootButton.setEnabled(False)
elif (state == UIState.CONNECT_FAILED):
self.setStatusLabel("Connecting to bootloader failed")
self.coldBootButton.setEnabled(True)
elif (state == UIState.COLD_CONNECT):
self.resetButton.setEnabled(True)
self.programButton.setEnabled(True)
self.setStatusLabel("Connected to bootloader")
self.coldBootButton.setEnabled(False)
elif (state == UIState.RESET):
self.setStatusLabel("Resetting to firmware, disconnected")
self.resetButton.setEnabled(False)
self.programButton.setEnabled(False)
self.coldBootButton.setEnabled(False)
def setUiState(self, state):
if (state == UIState.DISCONNECTED):
self.resetButton.setEnabled(False)
self.programButton.setEnabled(False)
self.setStatusLabel("Disconnected")
self.coldBootButton.setEnabled(True)
elif (state == UIState.CONNECTING):
self.resetButton.setEnabled(False)
self.programButton.setEnabled(False)
self.setStatusLabel("Trying to connect cold bootloader, restart the Crazyflie to connect")
self.coldBootButton.setEnabled(False)
elif (state == UIState.CONNECT_FAILED):
self.setStatusLabel("Connecting to bootloader failed")
self.coldBootButton.setEnabled(True)
elif (state == UIState.COLD_CONNECT):
self.resetButton.setEnabled(True)
self.programButton.setEnabled(True)
self.setStatusLabel("Connected to bootloader")
self.coldBootButton.setEnabled(False)
elif (state == UIState.RESET):
self.setStatusLabel("Resetting to firmware, disconnected")
self.resetButton.setEnabled(False)
self.programButton.setEnabled(False)
self.coldBootButton.setEnabled(False)
def setUiState(self, state):
if (state == UIState.DISCONNECTED):
self.resetButton.setEnabled(False)
self.programButton.setEnabled(False)
self.setStatusLabel("Disconnected")
self.coldBootButton.setEnabled(True)
elif (state == UIState.CONNECTING):
self.resetButton.setEnabled(False)
self.programButton.setEnabled(False)
self.setStatusLabel("Trying to connect cold bootloader, restart the Crazyflie to connect")
self.coldBootButton.setEnabled(False)
elif (state == UIState.CONNECT_FAILED):
self.setStatusLabel("Connecting to bootloader failed")
self.coldBootButton.setEnabled(True)
elif (state == UIState.COLD_CONNECT):
self.resetButton.setEnabled(True)
self.programButton.setEnabled(True)
self.setStatusLabel("Connected to bootloader")
self.clt.connectingSignal.connect(lambda: self.setUiState(UIState.CONNECTING))
self.clt.connectedSignal.connect(lambda: self.setUiState(UIState.COLD_CONNECT))