eric6/MicroPython/MicroPythonWidget.py

changeset 8061
979562f350bf
parent 8055
52fdd41517f3
child 8067
a467ab075be0
diff -r 78aea20be1ec -r 979562f350bf eric6/MicroPython/MicroPythonWidget.py
--- a/eric6/MicroPython/MicroPythonWidget.py	Wed Feb 03 16:42:04 2021 +0100
+++ b/eric6/MicroPython/MicroPythonWidget.py	Wed Feb 03 19:14:35 2021 +0100
@@ -23,6 +23,7 @@
 from E5Gui import E5MessageBox, E5FileDialog
 from E5Gui.E5Application import e5App
 from E5Gui.E5ProcessDialog import E5ProcessDialog
+from E5Gui.E5OverrideCursor import E5OverrideCursor, E5OverridenCursor
 
 from .Ui_MicroPythonWidget import Ui_MicroPythonWidget
 
@@ -573,7 +574,8 @@
         currently connected device.
         """
         if self.__connected:
-            self.__disconnectFromDevice()
+            with E5OverrideCursor():
+                self.__disconnectFromDevice()
             
             if self.replButton.isChecked():
                 self.on_replButton_clicked(False)
@@ -582,7 +584,8 @@
             if self.chartButton.isChecked():
                 self.on_chartButton_clicked(False)
         else:
-            self.__connectToDevice()
+            with E5OverrideCursor():
+                self.__connectToDevice()
     
     @pyqtSlot()
     def __clear(self):
@@ -597,6 +600,7 @@
         """
         Private slot to perform a paste operation.
         """
+        # add support for paste by mouse middle button
         clipboard = QApplication.clipboard()
         if clipboard:
             pasteText = clipboard.text()
@@ -687,7 +691,7 @@
             if data[index] == 8:        # \b
                 tc.movePosition(QTextCursor.Left)
                 self.replEdit.setTextCursor(tc)
-            elif data[index] == 13:     # \r
+            elif data[index] in (4, 13):     # EOT, \r
                 pass
             elif (len(data) > index + 1 and
                   data[index] == 27 and
@@ -928,11 +932,12 @@
                     self.__device.hasTimeCommands()):
                 self.__synchronizeTime(quiet=True)
         else:
-            E5MessageBox.warning(
-                self,
-                self.tr("Serial Device Connect"),
-                self.tr("""<p>Cannot connect to device at serial port"""
-                        """ <b>{0}</b>.</p>""").format(port))
+            with E5OverridenCursor():
+                E5MessageBox.warning(
+                    self,
+                    self.tr("Serial Device Connect"),
+                    self.tr("""<p>Cannot connect to device at serial port"""
+                            """ <b>{0}</b>.</p>""").format(port))
     
     def __disconnectFromDevice(self):
         """
@@ -1308,13 +1313,14 @@
             self.__interface.syncTime()
             
             if not quiet:
-                E5MessageBox.information(
-                    self,
-                    self.tr("Synchronize Time"),
-                    self.tr("<p>The time of the connected device was"
-                            " synchronized with the local time.</p>") +
-                    self.__getDeviceTime()
-                )
+                with E5OverridenCursor():
+                    E5MessageBox.information(
+                        self,
+                        self.tr("Synchronize Time"),
+                        self.tr("<p>The time of the connected device was"
+                                " synchronized with the local time.</p>") +
+                        self.__getDeviceTime()
+                    )
         except Exception as exc:
             self.__showError("syncTime()", str(exc))
     
@@ -1352,10 +1358,11 @@
         Private slot to show the date and time of the connected device.
         """
         msg = self.__getDeviceTime()
-        E5MessageBox.information(
-            self,
-            self.tr("Device Date and Time"),
-            msg)
+        if msg:
+            E5MessageBox.information(
+                self,
+                self.tr("Device Date and Time"),
+                msg)
     
     @pyqtSlot()
     def __showLocalTime(self):
@@ -1432,12 +1439,14 @@
         @param error error message
         @type str
         """
-        E5MessageBox.warning(
-            self,
-            self.tr("Error handling device"),
-            self.tr("<p>There was an error communicating with the connected"
-                    " device.</p><p>Method: {0}</p><p>Message: {1}</p>")
-            .format(method, error))
+        with E5OverridenCursor():
+            E5MessageBox.warning(
+                self,
+                self.tr("Error handling device"),
+                self.tr("<p>There was an error communicating with the"
+                        " connected device.</p><p>Method: {0}</p>"
+                        "<p>Message: {1}</p>")
+                .format(method, error))
     
     def __mpyCrossAvailable(self):
         """

eric ide

mercurial