--- a/src/eric7/MicroPython/MicroPythonWebreplDeviceInterface.py Thu Oct 05 17:07:35 2023 +0200 +++ b/src/eric7/MicroPython/MicroPythonWebreplDeviceInterface.py Fri Oct 06 15:52:33 2023 +0200 @@ -58,16 +58,15 @@ data = self.__socket.readAll() self.dataReceived.emit(data) - @pyqtSlot() def connectToDevice(self, connection): """ - Public slot to connect to the device. + Public method to connect to the device. @param connection name of the connection to be used in the form of an URL string (ws://password@host:port) @type str - @return flag indicating success - @rtype bool + @return flag indicating success and an error message + @rtype tuple of (bool, str) """ connection = connection.replace("ws://", "") try: @@ -82,7 +81,7 @@ QLineEdit.EchoMode.Password, ) if not ok: - return False + return False, self.tr("No password given") try: host, port = hostPort.split(":", 1) @@ -91,9 +90,9 @@ host, port = hostPort, 8266 # default port is 8266 self.__blockReadyRead = True - ok = self.__socket.connectToDevice(host, port) + ok, error = self.__socket.connectToDevice(host, port) if ok: - ok = self.__socket.login(password) + ok, error = self.__socket.login(password) if not ok: EricMessageBox.warning( None, @@ -107,7 +106,7 @@ self.__connected = ok self.__blockReadyRead = False - return self.__connected + return self.__connected, error @pyqtSlot() def disconnectFromDevice(self):