MicroPython mpy_network

Sun, 26 Feb 2023 12:44:03 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 26 Feb 2023 12:44:03 +0100
branch
mpy_network
changeset 9803
2ab3de60b51c
parent 9802
22aeee2bf35f
child 9805
4a2657e29a32

MicroPython
- fixed an issue checking, if the device data is available

src/eric7/MicroPython/Devices/DeviceBase.py file | annotate | diff | comparison | revisions
src/eric7/MicroPython/Devices/MicrobitDevices.py file | annotate | diff | comparison | revisions
diff -r 22aeee2bf35f -r 2ab3de60b51c src/eric7/MicroPython/Devices/DeviceBase.py
--- a/src/eric7/MicroPython/Devices/DeviceBase.py	Sat Feb 25 19:47:23 2023 +0100
+++ b/src/eric7/MicroPython/Devices/DeviceBase.py	Sun Feb 26 12:44:03 2023 +0100
@@ -139,25 +139,29 @@
         else:
             return self._deviceData[key]
 
-    def checkDeviceData(self):
+    def checkDeviceData(self, quiet=True):
         """
         Public method to check the validity of the device data determined during
         connecting the device.
 
+        @param quiet flag indicating to not show an info message, if the data is
+            not available (defaults to True)
+        @type bool (optional)
         @return flag indicating valid device data
         @rtype bool
         """
         if bool(self._deviceData):
             return True
         else:
-            EricMessageBox.critical(
-                None,
-                self.tr("Show MicroPython Versions"),
-                self.tr(
-                    """<p>The device data is not available. Try to connect to the"""
-                    """ device again. Aborting...</p>"""
-                ).format(self.getDeviceType()),
-            )
+            if not quiet:
+                EricMessageBox.critical(
+                    None,
+                    self.tr("Device Data Not Available"),
+                    self.tr(
+                        """<p>The device data is not available. Try to connect to the"""
+                        """ device again. Aborting...</p>"""
+                    ).format(self.getDeviceType()),
+                )
             return False
 
     def hasCircuitPython(self):
diff -r 22aeee2bf35f -r 2ab3de60b51c src/eric7/MicroPython/Devices/MicrobitDevices.py
--- a/src/eric7/MicroPython/Devices/MicrobitDevices.py	Sat Feb 25 19:47:23 2023 +0100
+++ b/src/eric7/MicroPython/Devices/MicrobitDevices.py	Sun Feb 26 12:44:03 2023 +0100
@@ -54,6 +54,21 @@
 
         self.__createMicrobitMenu()
 
+    def setConnected(self, connected):
+        """
+        Public method to set the connection state.
+
+        Note: This method can be overwritten to perform actions upon connect
+        or disconnect of the device.
+
+        @param connected connection state
+        @type bool
+        """
+        super().setConnected(connected)
+
+        if self.hasCircuitPython():
+            self.submitMode = "paste"
+
     def setButtons(self):
         """
         Public method to enable the supported action buttons.
@@ -363,7 +378,7 @@
         Private slot to show the firmware version of the connected device and the
         available firmware version.
         """
-        if self.microPython.isConnected() and self.checkDeviceData():
+        if self.microPython.isConnected() and self.checkDeviceData(quiet=False):
             if self._deviceData["mpy_name"] not in ("micropython", "circuitpython"):
                 EricMessageBox.critical(
                     None,

eric ide

mercurial