src/eric7/MicroPython/RP2040Devices.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/MicroPython/RP2040Devices.py
--- a/src/eric7/MicroPython/RP2040Devices.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/MicroPython/RP2040Devices.py	Wed Jul 13 14:55:47 2022 +0200
@@ -20,10 +20,11 @@
     """
     Class implementing the device for RP2040 based boards.
     """
+
     def __init__(self, microPythonWidget, deviceType, parent=None):
         """
         Constructor
-        
+
         @param microPythonWidget reference to the main MicroPython widget
         @type MicroPythonWidget
         @param deviceType device type assigned to this device interface
@@ -31,154 +32,162 @@
         @param parent reference to the parent object
         @type QObject
         """
-        super().__init__(
-            microPythonWidget, deviceType, parent)
-    
+        super().__init__(microPythonWidget, deviceType, parent)
+
     def setButtons(self):
         """
         Public method to enable the supported action buttons.
         """
         super().setButtons()
         self.microPython.setActionButtons(
-            run=True, repl=True, files=True, chart=HAS_QTCHART)
-    
+            run=True, repl=True, files=True, chart=HAS_QTCHART
+        )
+
     def forceInterrupt(self):
         """
         Public method to determine the need for an interrupt when opening the
         serial connection.
-        
+
         @return flag indicating an interrupt is needed
         @rtype bool
         """
         return False
-    
+
     def deviceName(self):
         """
         Public method to get the name of the device.
-        
+
         @return name of the device
         @rtype str
         """
         return self.tr("RP2040")
-    
+
     def canStartRepl(self):
         """
         Public method to determine, if a REPL can be started.
-        
+
         @return tuple containing a flag indicating it is safe to start a REPL
             and a reason why it cannot.
         @rtype tuple of (bool, str)
         """
         return True, ""
-    
+
     def canStartPlotter(self):
         """
         Public method to determine, if a Plotter can be started.
-        
+
         @return tuple containing a flag indicating it is safe to start a
             Plotter and a reason why it cannot.
         @rtype tuple of (bool, str)
         """
         return True, ""
-    
+
     def canRunScript(self):
         """
         Public method to determine, if a script can be executed.
-        
+
         @return tuple containing a flag indicating it is safe to start a
             Plotter and a reason why it cannot.
         @rtype tuple of (bool, str)
         """
         return True, ""
-    
+
     def runScript(self, script):
         """
         Public method to run the given Python script.
-        
+
         @param script script to be executed
         @type str
         """
         pythonScript = script.split("\n")
         self.sendCommands(pythonScript)
-    
+
     def canStartFileManager(self):
         """
         Public method to determine, if a File Manager can be started.
-        
+
         @return tuple containing a flag indicating it is safe to start a
             File Manager and a reason why it cannot.
         @rtype tuple of (bool, str)
         """
         return True, ""
-    
+
     def addDeviceMenuEntries(self, menu):
         """
         Public method to add device specific entries to the given menu.
-        
+
         @param menu reference to the context menu
         @type QMenu
         """
         connected = self.microPython.isConnected()
-        
-        act = menu.addAction(self.tr("Activate Bootloader"),
-                             self.__activateBootloader)
+
+        act = menu.addAction(self.tr("Activate Bootloader"), self.__activateBootloader)
         act.setEnabled(connected)
         act = menu.addAction(self.tr("Flash Firmware"), self.__flashPython)
         act.setEnabled(not connected)
-    
+
     def hasFlashMenuEntry(self):
         """
         Public method to check, if the device has its own flash menu entry.
-        
+
         @return flag indicating a specific flash menu entry
         @rtype bool
         """
         return True
-    
+
     @pyqtSlot()
     def __flashPython(self):
         """
         Private slot to flash a MicroPython firmware to the device.
         """
         from .UF2FlashDialog import UF2FlashDialog
+
         dlg = UF2FlashDialog(boardType="rp2040")
         dlg.exec()
-    
+
     def __activateBootloader(self):
         """
         Private method to switch the board into 'bootloader' mode.
         """
         if self.microPython.isConnected():
-            self.microPython.commandsInterface().execute([
-                "import machine",
-                "machine.bootloader()",
-            ])
+            self.microPython.commandsInterface().execute(
+                [
+                    "import machine",
+                    "machine.bootloader()",
+                ]
+            )
             # simulate pressing the disconnect button
             self.microPython.on_connectButton_clicked()
-    
+
     def getDocumentationUrl(self):
         """
         Public method to get the device documentation URL.
-        
+
         @return documentation URL of the device
         @rtype str
         """
         return Preferences.getMicroPython("MicroPythonDocuUrl")
-    
+
     def getDownloadMenuEntries(self):
         """
         Public method to retrieve the entries for the downloads menu.
-        
+
         @return list of tuples with menu text and URL to be opened for each
             entry
         @rtype list of tuple of (str, str)
         """
         return [
-            (self.tr("MicroPython Firmware"),
-             Preferences.getMicroPython("MicroPythonFirmwareUrl")),
+            (
+                self.tr("MicroPython Firmware"),
+                Preferences.getMicroPython("MicroPythonFirmwareUrl"),
+            ),
             ("<separator>", ""),
-            (self.tr("CircuitPython Firmware"),
-             Preferences.getMicroPython("CircuitPythonFirmwareUrl")),
-            (self.tr("CircuitPython Libraries"),
-             Preferences.getMicroPython("CircuitPythonLibrariesUrl"))
+            (
+                self.tr("CircuitPython Firmware"),
+                Preferences.getMicroPython("CircuitPythonFirmwareUrl"),
+            ),
+            (
+                self.tr("CircuitPython Libraries"),
+                Preferences.getMicroPython("CircuitPythonLibrariesUrl"),
+            ),
         ]

eric ide

mercurial