Fixed a few issues in the MicroPython package. eric7

Tue, 14 Feb 2023 11:09:49 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 14 Feb 2023 11:09:49 +0100
branch
eric7
changeset 9764
57496966803c
parent 9763
52f982c08301
child 9765
6378da868bb0

Fixed a few issues in the MicroPython package.

src/eric7/MicroPython/MicroPythonCommandsInterface.py file | annotate | diff | comparison | revisions
src/eric7/MicroPython/MicroPythonFileManagerWidget.py file | annotate | diff | comparison | revisions
--- a/src/eric7/MicroPython/MicroPythonCommandsInterface.py	Tue Feb 14 10:05:29 2023 +0100
+++ b/src/eric7/MicroPython/MicroPythonCommandsInterface.py	Tue Feb 14 11:09:49 2023 +0100
@@ -274,8 +274,8 @@
                 else:
                     err = b"invalid response received: " + response
                 if err:
-                    self.__blockReadyRead = False
-                    return b"", err
+                    result = b""
+                    break
 
         # switch off raw mode
         QThread.msleep(10)
@@ -293,14 +293,10 @@
         @type list of bytes
         """
 
-        def remainingTask(commands):
-            self.executeAsync(commands)
-
         if commandsList:
-            command = commandsList[0]
+            command = commandsList.pop(0)
             self.__serial.write(command)
-            remainder = commandsList[1:]
-            QTimer.singleShot(2, lambda: remainingTask(remainder))
+            QTimer.singleShot(2, lambda: self.executeAsync(commandsList))
         else:
             self.executeAsyncFinished.emit()
 
--- a/src/eric7/MicroPython/MicroPythonFileManagerWidget.py	Tue Feb 14 10:05:29 2023 +0100
+++ b/src/eric7/MicroPython/MicroPythonFileManagerWidget.py	Tue Feb 14 11:09:49 2023 +0100
@@ -715,6 +715,7 @@
                 saveAs = True
         else:
             saveAs = True
+            filename = ""
 
         if saveAs:
             filename, ok = QInputDialog.getText(
@@ -727,6 +728,12 @@
             if not ok or not filename:
                 return
 
+        if not saveAs:
+            # check editor and selected file names for an implicit 'save as'
+            editorFileName = os.path.basename(aw.getFileName().replace("device:", ""))
+            if editorFileName != filename:
+                saveAs = True
+
         if saveAs and self.__isFileInList(filename, self.deviceFileTreeWidget):
             # ask for overwrite permission
             action, resultFilename = confirmOverwrite(

eric ide

mercurial