eric6/MicroPython/CircuitPythonFirmwareSelectionDialog.py

changeset 8079
331e717c458e
parent 8067
a467ab075be0
child 8093
436e4de91f12
equal deleted inserted replaced
8078:d0e6c9ef0f15 8079:331e717c458e
7 Module implementing a dialog to enter the firmware flashing data. 7 Module implementing a dialog to enter the firmware flashing data.
8 """ 8 """
9 9
10 import os 10 import os
11 11
12 from PyQt5.QtCore import pyqtSlot 12 from PyQt5.QtCore import pyqtSlot, QCoreApplication
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox 13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
14 14
15 from E5Gui.E5PathPicker import E5PathPickerModes 15 from E5Gui.E5PathPicker import E5PathPickerModes
16 from E5Gui import E5MessageBox 16 from E5Gui import E5MessageBox
17 17
19 Ui_CircuitPythonFirmwareSelectionDialog 19 Ui_CircuitPythonFirmwareSelectionDialog
20 ) 20 )
21 21
22 import Utilities 22 import Utilities
23 import UI.PixmapCache 23 import UI.PixmapCache
24 import Preferences
24 25
25 26
26 class CircuitPythonFirmwareSelectionDialog( 27 class CircuitPythonFirmwareSelectionDialog(
27 QDialog, Ui_CircuitPythonFirmwareSelectionDialog): 28 QDialog, Ui_CircuitPythonFirmwareSelectionDialog):
28 """ 29 """
29 Class implementing a dialog to enter the firmware flashing data. 30 Class implementing a dialog to enter the firmware flashing data.
30 """ 31 """
32 Boards = (
33 # Adafruit boards
34 ("--- Adafruit ---", ""),
35 ("BadgeLC", "BADGELCBOOT"),
36 ("CLUE nRF52840 Express", "CLUEBOOT"),
37 ("Circuit Playground Bluefruit", "CPLAYBTBOOT"),
38 ("Circuit Playground Express", "CPLAYBOOT"),
39 ("Feather Arcade D51", "ARCADE-D5"),
40 ("Feather Bluefruit Sense", "FTHR840BOOT"),
41 ("Feather M0 Adalogger", "FEATHERBOOT"),
42 ("Feather M0 Basic", "FEATHERBOOT"),
43 ("Feather M0 Express", "FEATHERBOOT"),
44 ("Feather M0 RFM69", "FEATHERBOOT"),
45 ("Feather M0 RFM9x", "FEATHERBOOT"),
46 ("Feather M4 Express", "FEATHERBOOT"),
47 ("Feather nRF52840 Express", "FTHR840BOOT"),
48 ("Gemma M0", "GEMMABOOT"),
49 ("Grand Central M4 Express", "GCM4BOOT"),
50 ("Hallowing M0", "HALLOWBOOT"),
51 ("Hallowing M4 Express", "HALLOM4BOOT"),
52 ("Itsy Arcade D51", "ARCADE-D5"),
53 ("ItsyBitsy M0 Express", "ITSYBOOT"),
54 ("ItsyBitsy M4 Express", "ITSYM4BOOT"),
55 ("ItsyBitsy nRF52840 Express", " ITSY840BOOT"),
56 ("Metro M0 Express", "METROBOOT"),
57 ("Metro M4 Express", "METROM4BOOT"),
58 ("Metro M4 Express AirLift", "METROM4BOOT"),
59 ("NeoTrelis M4 Express", "TRELM4BOOT"),
60 ("PyBadge", "BADGEBOOT"),
61 ("PyGamer", "PYGAMERBOOT"),
62 ("PyPortal", "PORTALBOOT"),
63 ("PyPortal M4 Express", "PORTALBOOT"),
64 ("PyPortal Pynt", "PORTALBOOT"),
65 ("PyPortal Titano", "PORTALBOOT"),
66 ("PyRuler", "TRINKETBOOT"),
67 ("QT Py M0", "QTPY_BOOT"),
68 ("Radiofruit M0", "RADIOBOOT"),
69 ("Trellis M4 Express", "TRELM4BOOT"),
70 ("Trinket M0", "TRINKETBOOT"),
71 ("crickit", "CRICKITBOOT"),
72 ("pIRKey M0", "PIRKEYBOOT"),
73
74 # SparkFun boards
75 ("--- SparkFun ---", ""),
76 ("Qwiic Micro", "QwiicMicro"),
77 ("SAMD21 Dev Breakout", "SPARKFUN"),
78 ("SAMD21 Mini Breakout", "SPARKFUN"),
79 ("SAMD51 Thing Plus", "51THINGBOOT"),
80 ("RedBoard Turbo", "TURBOBOOT"),
81 ("Pro nRF52840 Mini", "NRF52BOOT"),
82
83 # Seed boards
84 ("--- Seeed Studio ---", ""),
85 ("Grove Zero", "Grove Zero"),
86 ("Seeduino XIAO", "Arduino"),
87
88 # other boards we know about
89 (QCoreApplication.translate(
90 "CircuitPythonFirmwareSelectionDialog",
91 "--- Others ---"), ""),
92 ("Arduino MKR1300", "MKR1300"),
93 ("Arduino MKRZero", "MKRZEROBOOT"),
94 ("Eitech Robotics", "ROBOTICS"),
95 ("Generic Corp. SAMD21 Board", "SAMD21"),
96 ("Generic Corp. SAME54 Board", "SAME54"),
97 ("Mini SAM M0", "MINISAMBOOT"),
98 ("Mini SAM M4", "MINISAMBOOT"),
99 ("Robo HAT MM1", "ROBOM0BOOT"),
100 ("Robo HAT MM1 M4", "ROBOM4BOOT"),
101 )
102
31 def __init__(self, parent=None): 103 def __init__(self, parent=None):
32 """ 104 """
33 Constructor 105 Constructor
34 106
35 @param parent reference to the parent widget 107 @param parent reference to the parent widget
46 "All Files (*)")) 118 "All Files (*)"))
47 119
48 self.bootPicker.setMode(E5PathPickerModes.DirectoryShowFilesMode) 120 self.bootPicker.setMode(E5PathPickerModes.DirectoryShowFilesMode)
49 121
50 self.__manualMarker = "<manual>" 122 self.__manualMarker = "<manual>"
51 boards = ( 123 self.boardComboBox.addItem("", ""), # indicator for no selection
52 ("", ""), # indicator for no selection 124 for boardName, bootVolume in self.Boards:
53
54 # Adafruit boards
55 ("--- Adafruit ---", ""),
56 ("BadgeLC", "BADGELCBOOT"),
57 ("CLUE nRF52840 Express", "CLUEBOOT"),
58 ("Circuit Playground Bluefruit", "CPLAYBTBOOT"),
59 ("Circuit Playground Express", "CPLAYBOOT"),
60 ("Feather Arcade D51", "ARCADE-D5"),
61 ("Feather Bluefruit Sense", "FTHR840BOOT"),
62 ("Feather M0 Adalogger", "FEATHERBOOT"),
63 ("Feather M0 Basic", "FEATHERBOOT"),
64 ("Feather M0 Express", "FEATHERBOOT"),
65 ("Feather M0 RFM69", "FEATHERBOOT"),
66 ("Feather M0 RFM9x", "FEATHERBOOT"),
67 ("Feather M4 Express", "FEATHERBOOT"),
68 ("Feather nRF52840 Express", "FTHR840BOOT"),
69 ("Gemma M0", "GEMMABOOT"),
70 ("Grand Central M4 Express", "GCM4BOOT"),
71 ("Hallowing M0", "HALLOWBOOT"),
72 ("Hallowing M4 Express", "HALLOM4BOOT"),
73 ("Itsy Arcade D51", "ARCADE-D5"),
74 ("ItsyBitsy M0 Express", "ITSYBOOT"),
75 ("ItsyBitsy M4 Express", "ITSYM4BOOT"),
76 ("ItsyBitsy nRF52840 Express", " ITSY840BOOT"),
77 ("Metro M0 Express", "METROBOOT"),
78 ("Metro M4 Express", "METROM4BOOT"),
79 ("Metro M4 Express AirLift", "METROM4BOOT"),
80 ("NeoTrelis M4 Express", "TRELM4BOOT"),
81 ("PyBadge", "BADGEBOOT"),
82 ("PyGamer", "PYGAMERBOOT"),
83 ("PyPortal", "PORTALBOOT"),
84 ("PyPortal M4 Express", "PORTALBOOT"),
85 ("PyPortal Pynt", "PORTALBOOT"),
86 ("PyPortal Titano", "PORTALBOOT"),
87 ("PyRuler", "TRINKETBOOT"),
88 ("QT Py M0", "QTPY_BOOT"),
89 ("Radiofruit M0", "RADIOBOOT"),
90 ("Trellis M4 Express", "TRELM4BOOT"),
91 ("Trinket M0", "TRINKETBOOT"),
92 ("crickit", "CRICKITBOOT"),
93 ("pIRKey M0", "PIRKEYBOOT"),
94
95 # SparkFun boards
96 ("--- SparkFun ---", ""),
97 ("Qwiic Micro", "QwiicMicro"),
98 ("SAMD21 Dev Breakout", "SPARKFUN"),
99 ("SAMD21 Mini Breakout", "SPARKFUN"),
100 ("SAMD51 Thing Plus", "51THINGBOOT"),
101 ("RedBoard Turbo", "TURBOBOOT"),
102 ("Pro nRF52840 Mini", "NRF52BOOT"),
103
104 # Seed boards
105 ("--- Seeed Studio ---", ""),
106 ("Grove Zero", "Grove Zero"),
107 ("Seeduino XIAO", "Arduino"),
108
109 # other boards we know about
110 (self.tr("--- Others ---"), ""),
111 ("Arduino MKR1300", "MKR1300"),
112 ("Arduino MKRZero", "MKRZEROBOOT"),
113 ("Eitech Robotics", "ROBOTICS"),
114 ("Generic Corp. SAMD21 Board", "SAMD21"),
115 ("Generic Corp. SAME54 Board", "SAME54"),
116 ("Mini SAM M0", "MINISAMBOOT"),
117 ("Mini SAM M4", "MINISAMBOOT"),
118 ("Robo HAT MM1", "ROBOM0BOOT"),
119 ("Robo HAT MM1 M4", "ROBOM4BOOT"),
120
121 (self.tr("Manual Select"), self.__manualMarker),
122 )
123 for boardName, bootVolume in boards:
124 self.boardComboBox.addItem(boardName, bootVolume) 125 self.boardComboBox.addItem(boardName, bootVolume)
126 manualDevices = Preferences.getMicroPython("ManualDevices")
127 if manualDevices:
128 self.boardComboBox.addItem(self.tr("--- Local Devices ---"), "")
129 for device in manualDevices:
130 self.boardComboBox.addItem(device["description"],
131 device["volume"])
132 self.boardComboBox.addItem(self.tr("Manual Select"),
133 self.__manualMarker),
125 134
126 msh = self.minimumSizeHint() 135 msh = self.minimumSizeHint()
127 self.resize(max(self.width(), msh.width()), msh.height()) 136 self.resize(max(self.width(), msh.width()), msh.height())
128 137
129 def __updateOkButton(self): 138 def __updateOkButton(self):

eric ide

mercurial