Thu, 04 May 2023 11:47:21 +0200
MicroPython
- Added code to send OSD data to the MicroPython widget from the device interfaces.
--- a/src/eric7/MicroPython/MicroPythonDeviceInterface.py Thu May 04 11:22:11 2023 +0200 +++ b/src/eric7/MicroPython/MicroPythonDeviceInterface.py Thu May 04 11:47:21 2023 +0200 @@ -18,10 +18,12 @@ asynchronously executed list of commands (e.g. a script) @signal dataReceived(data) emitted to send data received via the connection for further processing + @signal osdInfo(str) emitted when some OSD data was received from the device """ executeAsyncFinished = pyqtSignal() dataReceived = pyqtSignal(bytes) + osdInfo = pyqtSignal(str) PasteModePrompt = b"=== " TracebackMarker = b"Traceback (most recent call last):"
--- a/src/eric7/MicroPython/MicroPythonReplWidget.py Thu May 04 11:22:11 2023 +0200 +++ b/src/eric7/MicroPython/MicroPythonReplWidget.py Thu May 04 11:47:21 2023 +0200 @@ -559,7 +559,7 @@ # 'set window title' command detected: <Esc>]0;...<Esc>\ # __IGNORE_WARNING_M891__ titleData = data[index + 4 :].split(b"\x1b\\")[0] - title = titleData.decode() + title = titleData.decode("utf-8") index += len(titleData) + 5 # one more is done at the end self.osdInfo.emit(title) else:
--- a/src/eric7/MicroPython/MicroPythonSerialDeviceInterface.py Thu May 04 11:22:11 2023 +0200 +++ b/src/eric7/MicroPython/MicroPythonSerialDeviceInterface.py Thu May 04 11:47:21 2023 +0200 @@ -395,10 +395,10 @@ self.__blockReadyRead = False return b"", b"Timeout while processing commands." - # get rid of any OSD string - # TODO: emit the OSD data + # get rid of any OSD string and send it if result.startswith(b"\x1b]0;"): - result = result.split(b"\x1b\\")[-1] + osd, result = result.split(b"\x1b\\", 1) + self.osdInfo.emit(osd[4:].decode("utf-8")) if self.TracebackMarker in result: errorIndex = result.find(self.TracebackMarker)
--- a/src/eric7/MicroPython/MicroPythonWebreplDeviceInterface.py Thu May 04 11:22:11 2023 +0200 +++ b/src/eric7/MicroPython/MicroPythonWebreplDeviceInterface.py Thu May 04 11:47:21 2023 +0200 @@ -224,10 +224,10 @@ self.__blockReadyRead = False return b"", b"Timeout while processing commands." - # get rid of any OSD string - # TODO: emit the OSD data + # get rid of any OSD string and send it if result.startswith(b"\x1b]0;"): - result = result.split(b"\x1b\\")[-1] + osd, result = result.split(b"\x1b\\", 1) + self.osdInfo.emit(osd[4:].decode("utf-8")) if self.TracebackMarker in result: errorIndex = result.find(self.TracebackMarker)
--- a/src/eric7/MicroPython/MicroPythonWidget.py Thu May 04 11:22:11 2023 +0200 +++ b/src/eric7/MicroPython/MicroPythonWidget.py Thu May 04 11:47:21 2023 +0200 @@ -686,6 +686,7 @@ self.__interface = MicroPythonWebreplDeviceInterface(self) self.replWidget.replEdit().setInterface(self.__interface) + self.__interface.osdInfo.connect(self.replWidget.setOSDInfo) if self.__interface.connectToDevice(port): deviceResponding = self.__interface.probeDevice()