MicroPython eric7

Sun, 26 Feb 2023 12:45:22 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 26 Feb 2023 12:45:22 +0100
branch
eric7
changeset 9804
b7e200d35be9
parent 9801
f2da2c1ab424
child 9806
8b375fdd78f1

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

src/eric7/APIs/Python3/eric7.api file | annotate | diff | comparison | revisions
src/eric7/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
src/eric7/Documentation/Source/eric7.MicroPython.Devices.DeviceBase.html file | annotate | diff | comparison | revisions
src/eric7/MicroPython/Devices/DeviceBase.py file | annotate | diff | comparison | revisions
src/eric7/MicroPython/Devices/MicrobitDevices.py file | annotate | diff | comparison | revisions
--- a/src/eric7/APIs/Python3/eric7.api	Sat Feb 25 19:43:06 2023 +0100
+++ b/src/eric7/APIs/Python3/eric7.api	Sun Feb 26 12:45:22 2023 +0100
@@ -2595,7 +2595,7 @@
 eric7.MicroPython.Devices.DeviceBase.BaseDevice.canStartPlotter?4()
 eric7.MicroPython.Devices.DeviceBase.BaseDevice.canStartRepl?4()
 eric7.MicroPython.Devices.DeviceBase.BaseDevice.cd?4(dirname)
-eric7.MicroPython.Devices.DeviceBase.BaseDevice.checkDeviceData?4()
+eric7.MicroPython.Devices.DeviceBase.BaseDevice.checkDeviceData?4(quiet=True)
 eric7.MicroPython.Devices.DeviceBase.BaseDevice.deviceName?4()
 eric7.MicroPython.Devices.DeviceBase.BaseDevice.downloadFirmware?4()
 eric7.MicroPython.Devices.DeviceBase.BaseDevice.fileSystemInfo?4()
Binary file src/eric7/Documentation/Help/source.qch has changed
--- a/src/eric7/Documentation/Source/eric7.MicroPython.Devices.DeviceBase.html	Sat Feb 25 19:43:06 2023 +0100
+++ b/src/eric7/Documentation/Source/eric7.MicroPython.Devices.DeviceBase.html	Sun Feb 26 12:45:22 2023 +0100
@@ -515,13 +515,21 @@
 </dl>
 <a NAME="BaseDevice.checkDeviceData" ID="BaseDevice.checkDeviceData"></a>
 <h4>BaseDevice.checkDeviceData</h4>
-<b>checkDeviceData</b>(<i></i>)
+<b>checkDeviceData</b>(<i>quiet=True</i>)
 
 <p>
         Public method to check the validity of the device data determined during
         connecting the device.
 </p>
 <dl>
+
+<dt><i>quiet</i> (bool (optional))</dt>
+<dd>
+flag indicating to not show an info message, if the data is
+            not available (defaults to True)
+</dd>
+</dl>
+<dl>
 <dt>Return:</dt>
 <dd>
 flag indicating valid device data
--- a/src/eric7/MicroPython/Devices/DeviceBase.py	Sat Feb 25 19:43:06 2023 +0100
+++ b/src/eric7/MicroPython/Devices/DeviceBase.py	Sun Feb 26 12:45:22 2023 +0100
@@ -112,25 +112,29 @@
         """
         return copy.deepcopy(self._deviceData)
 
-    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("Show MicroPython Versions"),
+                    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):
--- a/src/eric7/MicroPython/Devices/MicrobitDevices.py	Sat Feb 25 19:43:06 2023 +0100
+++ b/src/eric7/MicroPython/Devices/MicrobitDevices.py	Sun Feb 26 12:45:22 2023 +0100
@@ -363,7 +363,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