eric6/MicroPython/CircuitPythonFirmwareSelectionDialog.py

changeset 8079
331e717c458e
parent 8067
a467ab075be0
child 8093
436e4de91f12
--- a/eric6/MicroPython/CircuitPythonFirmwareSelectionDialog.py	Sat Feb 06 11:45:58 2021 +0100
+++ b/eric6/MicroPython/CircuitPythonFirmwareSelectionDialog.py	Sat Feb 06 16:05:27 2021 +0100
@@ -9,7 +9,7 @@
 
 import os
 
-from PyQt5.QtCore import pyqtSlot
+from PyQt5.QtCore import pyqtSlot, QCoreApplication
 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
 
 from E5Gui.E5PathPicker import E5PathPickerModes
@@ -21,6 +21,7 @@
 
 import Utilities
 import UI.PixmapCache
+import Preferences
 
 
 class CircuitPythonFirmwareSelectionDialog(
@@ -28,6 +29,77 @@
     """
     Class implementing a dialog to enter the firmware flashing data.
     """
+    Boards = (
+        # Adafruit boards
+        ("--- Adafruit ---", ""),
+        ("BadgeLC", "BADGELCBOOT"),
+        ("CLUE nRF52840 Express", "CLUEBOOT"),
+        ("Circuit Playground Bluefruit", "CPLAYBTBOOT"),
+        ("Circuit Playground Express", "CPLAYBOOT"),
+        ("Feather Arcade D51", "ARCADE-D5"),
+        ("Feather Bluefruit Sense", "FTHR840BOOT"),
+        ("Feather M0 Adalogger", "FEATHERBOOT"),
+        ("Feather M0 Basic", "FEATHERBOOT"),
+        ("Feather M0 Express", "FEATHERBOOT"),
+        ("Feather M0 RFM69", "FEATHERBOOT"),
+        ("Feather M0 RFM9x", "FEATHERBOOT"),
+        ("Feather M4 Express", "FEATHERBOOT"),
+        ("Feather nRF52840 Express", "FTHR840BOOT"),
+        ("Gemma M0", "GEMMABOOT"),
+        ("Grand Central M4 Express", "GCM4BOOT"),
+        ("Hallowing M0", "HALLOWBOOT"),
+        ("Hallowing M4 Express", "HALLOM4BOOT"),
+        ("Itsy Arcade D51", "ARCADE-D5"),
+        ("ItsyBitsy M0 Express", "ITSYBOOT"),
+        ("ItsyBitsy M4 Express", "ITSYM4BOOT"),
+        ("ItsyBitsy nRF52840 Express", " ITSY840BOOT"),
+        ("Metro M0 Express", "METROBOOT"),
+        ("Metro M4 Express", "METROM4BOOT"),
+        ("Metro M4 Express AirLift", "METROM4BOOT"),
+        ("NeoTrelis M4 Express", "TRELM4BOOT"),
+        ("PyBadge", "BADGEBOOT"),
+        ("PyGamer", "PYGAMERBOOT"),
+        ("PyPortal", "PORTALBOOT"),
+        ("PyPortal M4 Express", "PORTALBOOT"),
+        ("PyPortal Pynt", "PORTALBOOT"),
+        ("PyPortal Titano", "PORTALBOOT"),
+        ("PyRuler", "TRINKETBOOT"),
+        ("QT Py M0", "QTPY_BOOT"),
+        ("Radiofruit M0", "RADIOBOOT"),
+        ("Trellis M4 Express", "TRELM4BOOT"),
+        ("Trinket M0", "TRINKETBOOT"),
+        ("crickit", "CRICKITBOOT"),
+        ("pIRKey M0", "PIRKEYBOOT"),
+        
+        # SparkFun boards
+        ("--- SparkFun ---", ""),
+        ("Qwiic Micro", "QwiicMicro"),
+        ("SAMD21 Dev Breakout", "SPARKFUN"),
+        ("SAMD21 Mini Breakout", "SPARKFUN"),
+        ("SAMD51 Thing Plus", "51THINGBOOT"),
+        ("RedBoard Turbo", "TURBOBOOT"),
+        ("Pro nRF52840 Mini", "NRF52BOOT"),
+        
+        # Seed boards
+        ("--- Seeed Studio ---", ""),
+        ("Grove Zero", "Grove Zero"),
+        ("Seeduino XIAO", "Arduino"),
+        
+        # other boards we know about
+        (QCoreApplication.translate(
+            "CircuitPythonFirmwareSelectionDialog",
+            "--- Others ---"), ""),
+        ("Arduino MKR1300", "MKR1300"),
+        ("Arduino MKRZero", "MKRZEROBOOT"),
+        ("Eitech Robotics", "ROBOTICS"),
+        ("Generic Corp. SAMD21 Board", "SAMD21"),
+        ("Generic Corp. SAME54 Board", "SAME54"),
+        ("Mini SAM M0", "MINISAMBOOT"),
+        ("Mini SAM M4", "MINISAMBOOT"),
+        ("Robo HAT MM1", "ROBOM0BOOT"),
+        ("Robo HAT MM1 M4", "ROBOM4BOOT"),
+    )
+    
     def __init__(self, parent=None):
         """
         Constructor
@@ -48,80 +120,17 @@
         self.bootPicker.setMode(E5PathPickerModes.DirectoryShowFilesMode)
         
         self.__manualMarker = "<manual>"
-        boards = (
-            ("", ""),           # indicator for no selection
-            
-            # Adafruit boards
-            ("--- Adafruit ---", ""),
-            ("BadgeLC", "BADGELCBOOT"),
-            ("CLUE nRF52840 Express", "CLUEBOOT"),
-            ("Circuit Playground Bluefruit", "CPLAYBTBOOT"),
-            ("Circuit Playground Express", "CPLAYBOOT"),
-            ("Feather Arcade D51", "ARCADE-D5"),
-            ("Feather Bluefruit Sense", "FTHR840BOOT"),
-            ("Feather M0 Adalogger", "FEATHERBOOT"),
-            ("Feather M0 Basic", "FEATHERBOOT"),
-            ("Feather M0 Express", "FEATHERBOOT"),
-            ("Feather M0 RFM69", "FEATHERBOOT"),
-            ("Feather M0 RFM9x", "FEATHERBOOT"),
-            ("Feather M4 Express", "FEATHERBOOT"),
-            ("Feather nRF52840 Express", "FTHR840BOOT"),
-            ("Gemma M0", "GEMMABOOT"),
-            ("Grand Central M4 Express", "GCM4BOOT"),
-            ("Hallowing M0", "HALLOWBOOT"),
-            ("Hallowing M4 Express", "HALLOM4BOOT"),
-            ("Itsy Arcade D51", "ARCADE-D5"),
-            ("ItsyBitsy M0 Express", "ITSYBOOT"),
-            ("ItsyBitsy M4 Express", "ITSYM4BOOT"),
-            ("ItsyBitsy nRF52840 Express", " ITSY840BOOT"),
-            ("Metro M0 Express", "METROBOOT"),
-            ("Metro M4 Express", "METROM4BOOT"),
-            ("Metro M4 Express AirLift", "METROM4BOOT"),
-            ("NeoTrelis M4 Express", "TRELM4BOOT"),
-            ("PyBadge", "BADGEBOOT"),
-            ("PyGamer", "PYGAMERBOOT"),
-            ("PyPortal", "PORTALBOOT"),
-            ("PyPortal M4 Express", "PORTALBOOT"),
-            ("PyPortal Pynt", "PORTALBOOT"),
-            ("PyPortal Titano", "PORTALBOOT"),
-            ("PyRuler", "TRINKETBOOT"),
-            ("QT Py M0", "QTPY_BOOT"),
-            ("Radiofruit M0", "RADIOBOOT"),
-            ("Trellis M4 Express", "TRELM4BOOT"),
-            ("Trinket M0", "TRINKETBOOT"),
-            ("crickit", "CRICKITBOOT"),
-            ("pIRKey M0", "PIRKEYBOOT"),
-            
-            # SparkFun boards
-            ("--- SparkFun ---", ""),
-            ("Qwiic Micro", "QwiicMicro"),
-            ("SAMD21 Dev Breakout", "SPARKFUN"),
-            ("SAMD21 Mini Breakout", "SPARKFUN"),
-            ("SAMD51 Thing Plus", "51THINGBOOT"),
-            ("RedBoard Turbo", "TURBOBOOT"),
-            ("Pro nRF52840 Mini", "NRF52BOOT"),
-            
-            # Seed boards
-            ("--- Seeed Studio ---", ""),
-            ("Grove Zero", "Grove Zero"),
-            ("Seeduino XIAO", "Arduino"),
-            
-            # other boards we know about
-            (self.tr("--- Others ---"), ""),
-            ("Arduino MKR1300", "MKR1300"),
-            ("Arduino MKRZero", "MKRZEROBOOT"),
-            ("Eitech Robotics", "ROBOTICS"),
-            ("Generic Corp. SAMD21 Board", "SAMD21"),
-            ("Generic Corp. SAME54 Board", "SAME54"),
-            ("Mini SAM M0", "MINISAMBOOT"),
-            ("Mini SAM M4", "MINISAMBOOT"),
-            ("Robo HAT MM1", "ROBOM0BOOT"),
-            ("Robo HAT MM1 M4", "ROBOM4BOOT"),
-            
-            (self.tr("Manual Select"), self.__manualMarker),
-        )
-        for boardName, bootVolume in boards:
+        self.boardComboBox.addItem("", ""),     # indicator for no selection
+        for boardName, bootVolume in self.Boards:
             self.boardComboBox.addItem(boardName, bootVolume)
+        manualDevices = Preferences.getMicroPython("ManualDevices")
+        if manualDevices:
+            self.boardComboBox.addItem(self.tr("--- Local Devices ---"), "")
+            for device in manualDevices:
+                self.boardComboBox.addItem(device["description"],
+                                           device["volume"])
+        self.boardComboBox.addItem(self.tr("Manual Select"),
+                                   self.__manualMarker),
         
         msh = self.minimumSizeHint()
         self.resize(max(self.width(), msh.width()), msh.height())

eric ide

mercurial