Sun, 11 Apr 2021 18:45:10 +0200
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
8096 | 1 | # -*- coding: utf-8 -*- |
2 | ||
3 | # Copyright (c) 2021 Detlev Offenbach <detlev@die-offenbachs.de> | |
4 | # | |
5 | ||
6 | """ | |
7 | Module implementing a dialog to flash any UF2 capable device. | |
8 | """ | |
9 | ||
10 | import os | |
11 | import shutil | |
12 | ||
13 | from PyQt5.QtCore import pyqtSlot, Qt, QCoreApplication, QThread, QEventLoop | |
14 | from PyQt5.QtWidgets import QDialog | |
15 | ||
16 | from E5Gui.E5PathPicker import E5PathPickerModes | |
17 | ||
18 | from .Ui_UF2FlashDialog import Ui_UF2FlashDialog | |
19 | ||
20 | import UI.PixmapCache | |
21 | import Utilities | |
22 | ||
23 | from . import MicroPythonDevices | |
24 | ||
25 | SupportedUF2Boards = { | |
26 | "circuitpython": { | |
27 | "volumes": { | |
28 | (0x03EB, 0x2402): [ | |
29 | "SAMD21", # SAMD21 Board | |
30 | "SAME54", # SAME54 Board | |
31 | ], | |
32 | (0x04D8, 0xEC44): [ | |
33 | "PYCUBEDBOOT", # PyCubedv04 | |
34 | ], | |
35 | (0x04D8, 0xEC63): [ | |
36 | "BOOT", # CircuitBrains Basic | |
37 | ], | |
38 | (0x04D8, 0xEC64): [ | |
39 | "BOOT", # CircuitBrains Deluxe | |
40 | ], | |
41 | (0x04D8, 0xED5F): [ | |
42 | "UCHIPYBOOT", # uChip CircuitPython | |
43 | ], | |
44 | (0x04D8, 0xEDB3): [ | |
45 | "USBHUBBOOT", # Programmable USB Hub | |
46 | ], | |
47 | (0x04D8, 0xEDBE): [ | |
48 | "SAM32BOOT", # SAM32 | |
49 | ], | |
50 | (0x04D8, 0xEF66): [ | |
51 | "SENSEBOX", # senseBox MCU | |
52 | ], | |
53 | (0x1209, 0x2017): [ | |
54 | "MINISAMBOOT", # Mini SAM M4 | |
55 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
56 | (0x1209, 0x3252): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
57 | "MCBS2OMBOOT", # Module Clip w/Wroom |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
58 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
59 | (0x1209, 0x3253): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
60 | "MCBS2ERBOOT", # Module Clip w/Wrover |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
61 | ], |
8096 | 62 | (0x1209, 0x4D44): [ |
63 | "ROBOM0BOOT", # Robo HAT MM1 | |
64 | "ROBOM4BOOT", # Robo HAT MM1 M4 | |
65 | ], | |
66 | (0x1209, 0x4DDD): [ | |
67 | "SapBOOT", # CP Sapling | |
68 | ], | |
69 | (0x1209, 0x7102): [ | |
70 | "MINISAMBOOT", # Mini SAM M0 | |
71 | ], | |
72 | (0x1209, 0x805A): [ | |
73 | "BASTBLE", # Bast BLE | |
74 | ], | |
75 | (0x1209, 0xE3E2): [ | |
76 | "StackRduino", # StackRduino M0 PRO | |
77 | ], | |
78 | (0x1209, 0xF501): [ | |
79 | "M4SHIMBOOT", # M4-Shim | |
80 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
81 | (0x15BA, 0x28DC): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
82 | "OLMLIPOBOOT", # ESP32S2 DevKit Lipo |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
83 | ], |
8096 | 84 | (0x16D0, 0x0CDA): [ |
85 | "AUTOMAT", # automat | |
86 | ], | |
87 | (0x1B4F, 0x0019): [ | |
88 | "QwiicMicro", # Sparkfun Qwiic Micro | |
89 | ], | |
90 | (0x1B4F, 0x0D22): [ | |
91 | "SPARKFUN", # Sparkfun SAMD21 Mini Breakout | |
92 | ], | |
93 | (0x1B4F, 0x0D23): [ | |
94 | "SPARKFUN", # Sparkfun SAMD21 Dev Breakout | |
95 | ], | |
96 | (0x1D50, 0x6110): [ | |
97 | "ROBOTICS", # Robotics | |
98 | ], | |
99 | (0x1D50, 0x6112): [ | |
100 | "RCBOOT", # Wattuino RC | |
101 | ], | |
102 | (0x1D50, 0x6160): [ | |
103 | "BLUEMICRO", # BlueMicro | |
104 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
105 | (0x1FC9, 0x0094): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
106 | "DblM33BOOT", # Double M33 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
107 | "LPC5528BOOT", # LPCXpresso 55s28 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
108 | "LPC5569BOOT", # LPCXpresso 55s69 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
109 | ], |
8096 | 110 | (0x230A, 0x00E9): [ |
111 | "TAU_BOOT", # Tau | |
112 | ], | |
113 | (0x2341, 0x0057): [ | |
114 | "NANOBOOT", # NANO 33 IoT | |
115 | ], | |
116 | (0x2341, 0x8053): [ | |
117 | "MKR1300", # MKR1300 | |
118 | ], | |
119 | (0x239A, 0x000F): [ | |
120 | "ITSYBOOT", # ItsyBitsy M0 Express | |
121 | ], | |
122 | (0x239A, 0x0013): [ | |
123 | "METROBOOT", # Metro M0 | |
124 | ], | |
125 | (0x239A, 0x0015): [ | |
126 | "FEATHERBOOT", # Feather M0 | |
127 | ], | |
128 | (0x239A, 0x0018): [ | |
129 | "CPLAYBOOT", # CPlay Express | |
130 | ], | |
131 | (0x239A, 0x001B): [ | |
132 | "FEATHERBOOT", # Feather M0 Express | |
133 | ], | |
134 | (0x239A, 0x001C): [ | |
135 | "GEMMABOOT", # Gemma M0 | |
136 | ], | |
137 | (0x239A, 0x001E): [ | |
138 | "TRINKETBOOT", # Trinket M0 | |
139 | ], | |
140 | (0x239A, 0x0021): [ | |
141 | "METROM4BOOT", # Metro M4 Express | |
142 | ], | |
143 | (0x239A, 0x0022): [ | |
144 | "ARCADE-D5", # Feather Arcade D51 | |
145 | "FEATHERBOOT", # Feather M4 Express | |
146 | ], | |
147 | (0x239A, 0x0024): [ | |
148 | "RADIOBOOT", # Radiofruit M0 | |
149 | ], | |
150 | (0x239A, 0x0027): [ | |
151 | "PIRKEYBOOT", # pIRKey M0 | |
152 | ], | |
153 | (0x239A, 0x0029): [ | |
154 | "ARGONBOOT ", # Argon | |
155 | "BORONBOOT ", # Boron | |
156 | "FTHR840BOOT", # Feather nRF52840 Express | |
157 | "MDBT50QBOOT", # Raytac MDBT50Q-RX | |
158 | "MDK840DONGL", # MDK nRF52840 USB Dongle | |
159 | "WS52840EVK", # Waveshare nRF52840 Eval | |
160 | "XENONBOOT ", # Xenon | |
161 | ], | |
162 | (0x239A, 0x002B): [ | |
163 | "ARCADE-D5", # Itsy Arcade D51 | |
164 | "ITSYM4BOOT", # ItsyBitsy M4 Express | |
165 | ], | |
166 | (0x239A, 0x002D): [ | |
167 | "CRICKITBOOT", # crickit | |
168 | ], | |
169 | (0x239A, 0x002F): [ | |
170 | "TRELM4BOOT", # Trellis M4 Express | |
171 | ], | |
172 | (0x239A, 0x0031): [ | |
173 | "GCM4BOOT", # Grand Central M4 Express | |
174 | ], | |
175 | (0x239A, 0x0033): [ | |
176 | "PYBADGEBOOT", # PyBadge | |
177 | ], | |
178 | (0x239A, 0x0034): [ | |
179 | "BADGELCBOOT", # BadgeLC | |
180 | "PEWBOOT", # PewPew | |
181 | ], | |
182 | (0x239A, 0x0035): [ | |
183 | "MKRZEROBOOT", # MKRZero | |
184 | "PORTALBOOT", # PyPortal M4 Express | |
185 | ], | |
186 | (0x239A, 0x0037): [ | |
187 | "METROM4BOOT", # Metro M4 AirLift | |
188 | ], | |
189 | (0x239A, 0x003D): [ | |
190 | "PYGAMERBOOT", # PyGamer | |
191 | ], | |
192 | (0x239A, 0x003F): [ | |
193 | "METR840BOOT", # Metro nRF52840 Express | |
194 | ], | |
195 | (0x239A, 0x0045): [ | |
196 | "CPLAYBTBOOT", # Circuit Playground nRF52840 | |
197 | ], | |
198 | (0x239A, 0x0047): [ | |
199 | "MASKM4BOOT", # Hallowing Mask M4 | |
200 | ], | |
201 | (0x239A, 0x0049): [ | |
202 | "HALLOM4BOOT", # HalloWing M4 | |
203 | ], | |
204 | (0x239A, 0x004D): [ | |
205 | "SNEKBOOT", # snekboard | |
206 | ], | |
207 | (0x239A, 0x0051): [ | |
208 | "ITSY840BOOT", # ItsyBitsy nRF52840 Express | |
209 | ], | |
210 | (0x239A, 0x0057): [ | |
211 | "SERPENTBOOT", # Serpente | |
212 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
213 | (0x239A, 0x0059): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
214 | "FTHR405BOOT", # Feather STM32F405 Express |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
215 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
216 | (0x239A, 0x005D): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
217 | "BlackPill", # STM32F401CxUx |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
218 | "STMF411BOOT", # STM32F411 Discovery |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
219 | ], |
8096 | 220 | (0x239A, 0x0061): [ |
221 | "SOLBOOT", # Sol | |
222 | ], | |
223 | (0x239A, 0x0063): [ | |
224 | "NANO33BOOT", # Nano 33 BLE | |
225 | ], | |
226 | (0x239A, 0x0065): [ | |
227 | "ND6BOOT", # ndBit6 | |
228 | ], | |
229 | (0x239A, 0x006B): [ | |
230 | "shIRtty", # shIRtty | |
231 | ], | |
232 | (0x239A, 0x0071): [ | |
233 | "CLUEBOOT", # CLUE nRF52840 | |
234 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
235 | (0x239A, 0x0077): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
236 | "RT1010BOOT", # RT1010 EVK |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
237 | ], |
8096 | 238 | (0x239A, 0x0079): [ |
239 | "ARAMBOOT", # ARAMCON Badge 2019 | |
240 | ], | |
241 | (0x239A, 0x007D): [ | |
242 | "BOOKBOOT", # The Open Book Feather | |
243 | ], | |
244 | (0x239A, 0x007F): [ | |
245 | "BADGEBOOT", # OHS2020 Badge | |
246 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
247 | (0x239A, 0x0081): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
248 | "RT1020BOOT", # RT1020 EVK |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
249 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
250 | (0x239A, 0x0083): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
251 | "RT1060BOOT", # RT1060 EVK |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
252 | ], |
8096 | 253 | (0x239A, 0x0087): [ |
254 | "FTHRSNSBOOT", # Feather nRF52840 Sense | |
255 | ], | |
256 | (0x239A, 0x0093): [ | |
257 | "ISVITABoot", # IkigaiSense Vita nRF52840 | |
258 | ], | |
259 | (0x239A, 0x0095): [ | |
260 | "UARTLOGBOOT", # UARTLogger II | |
261 | ], | |
262 | (0x239A, 0x009F): [ | |
263 | "ADM840BOOT", # AtelierDuMaker NRF52840 Breakout | |
264 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
265 | (0x239A, 0x00A5): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
266 | "SAOLA1RBOOT", # Saola 1R WROVER |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
267 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
268 | (0x239A, 0x00A7): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
269 | "SAOLA1MBOOT", # Saola 1M WROOM |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
270 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
271 | (0x239A, 0x00AB): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
272 | "UFTHRS2BOOT", # FeatherS2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
273 | ], |
8096 | 274 | (0x239A, 0x00AF): [ |
275 | "FLUFFBOOT", # Fluff M0 | |
276 | ], | |
277 | (0x239A, 0x00B3): [ | |
278 | "NICENANO", # nice!nano | |
279 | ], | |
280 | (0x239A, 0x00B5): [ | |
281 | "E54XBOOT", # SAME54 Xplained | |
282 | ], | |
283 | (0x239A, 0x00B9): [ | |
284 | "ND7BOOT", # ndBit7 | |
285 | ], | |
286 | (0x239A, 0x00BF): [ | |
287 | "BADGEBOOT", # BLM Badge | |
288 | ], | |
289 | (0x239A, 0x00C3): [ | |
290 | "GEMINIBOOT", # Gemini | |
291 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
292 | (0x239A, 0x00C5): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
293 | "MICROS2BOOT", # microS2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
294 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
295 | (0x239A, 0x00C7): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
296 | "KALUGA1BOOT", # Kaluga 1 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
297 | ], |
8096 | 298 | (0x239A, 0x00CB): [ |
299 | "QTPY_BOOT", # QT Py M0 | |
300 | ], | |
301 | (0x239A, 0x00CD): [ | |
302 | "FTHRCANBOOT", # Feather M4 CAN Express | |
303 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
304 | (0x239A, 0x00DF): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
305 | "METROS2BOOT", # Metro ESP32-S2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
306 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
307 | (0x239A, 0x00E1): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
308 | "METROM7BOOT", # Metro M7 1011 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
309 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
310 | (0x239A, 0x00E5): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
311 | "MAGTAGBOOT", # Metro MagTag 2.9 Grayscale |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
312 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
313 | (0x239A, 0x00EB): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
314 | "FTHRS2BOOT", # Feather ESP32-S2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
315 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
316 | (0x239A, 0x00ED): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
317 | "FTHRS2BOOT", # Feather ESP32-S2 Reverse TFT |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
318 | ], |
8096 | 319 | (0x239A, 0x00EF): [ |
320 | "TRINKEYBOOT", # NeoPixel Trinkey M0 | |
321 | ], | |
322 | (0x239A, 0x00F5): [ | |
323 | "STARBOOT", # Binary Star | |
324 | ], | |
325 | (0x239A, 0xB000): [ | |
326 | "HALLOWBOOT", # Hallowing M0 | |
327 | ], | |
328 | (0x239A, 0xE005): [ | |
329 | "HONKBOOT", # Big Honking Button | |
330 | ], | |
331 | (0x2886, 0x000D): [ | |
332 | "Grove Zero", # Grove Zero | |
333 | ], | |
334 | (0x2886, 0x002F): [ | |
335 | "Seeed XIAO", # Seeeduino XIAO | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
336 | "Arduino", # Seeeduino XIAO (old bootloader) |
8096 | 337 | ], |
338 | (0x2886, 0xF00E): [ | |
339 | "PITAYAGO", # Pitaya Go | |
340 | ], | |
341 | (0x2886, 0xF00F): [ | |
342 | "nRF52840M2", # MakerDiary nRF52840 M.2 Module | |
343 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
344 | (0x303A, 0x8008): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
345 | "TTGOS2BOOT", # TTGO_T8_S2_Display |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
346 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
347 | (0x303A, 0x800E): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
348 | "CCMBRISBOOT", # CucumberRIS v1.1 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
349 | ], |
8096 | 350 | (0x3171, 0x0100): [ |
351 | "CMDBOOT", # COMMANDER | |
352 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
353 | (0xCAFE, 0xFFFF): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
354 | "F303BOOT", # STM32F303 Discovery |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
355 | ], |
8096 | 356 | }, |
357 | "instructions": QCoreApplication.translate( | |
358 | "UF2FlashDialog", | |
359 | "<h3>CircuitPython Board</h3>" | |
360 | "<p>In order to prepare the board for flashing follow these" | |
361 | " steps:</p><ol>" | |
362 | "<li>Switch your device to 'bootloader' mode by double-pressing" | |
363 | " the reset button.</li>" | |
364 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
365 | "<li>(If this does not happen, then try shorter or longer" | |
366 | " pauses between presses.)</li>" | |
367 | "<li>Ensure the boot volume is available (this may require" | |
368 | " mounting it).</li>" | |
369 | "<li>Select the firmware file to be flashed and click the" | |
370 | " flash button.</li>" | |
371 | "</ol>" | |
372 | ), | |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
373 | "show_all": True, |
8096 | 374 | "firmware": "CircuitPython", |
375 | }, | |
376 | ||
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
377 | "circuitpython_rp2040": { |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
378 | "volumes": { |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
379 | (0x239A, 0x80F4): [ |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
380 | "RPI-RP2", # Raspberry Pi Pico loaded with CircuitPython |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
381 | ], |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
382 | }, |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
383 | "instructions": QCoreApplication.translate( |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
384 | "UF2FlashDialog", |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
385 | "<h3>Pi Pico (RP2040) Board</h3>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
386 | "<p>In order to prepare the board for flashing follow these" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
387 | " steps:</p><ol>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
388 | "<li>Enter 'bootloader' mode (board <b>without</b> RESET button):" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
389 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
390 | "<li>Plug in your board while holding the BOOTSEL button.</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
391 | "</ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
392 | "Enter 'bootloader' mode (board <b>with</b> RESET button):" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
393 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
394 | "<li>hold down RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
395 | "<li>hold down BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
396 | "<li>release RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
397 | "<li>release BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
398 | "</ul></li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
399 | "<li>Wait until the device has entered 'bootloader' mode.</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
400 | "<li>Ensure the boot volume is available (this may require" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
401 | " mounting it).</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
402 | "<li>Select the firmware file to be flashed and click the" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
403 | " flash button.</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
404 | "</ol>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
405 | ), |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
406 | "show_all": False, |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
407 | "firmware": "CircuitPython", |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
408 | }, |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
409 | |
8096 | 410 | "rp2040": { |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
411 | "volumes": { |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
412 | (0x0000, 0x0000): [ |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
413 | "RPI-RP2", # Raspberry Pi Pico does not present a TTY |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
414 | ], |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
415 | }, |
8096 | 416 | "instructions": QCoreApplication.translate( |
417 | "UF2FlashDialog", | |
418 | "<h3>Pi Pico (RP2040) Board</h3>" | |
419 | "<p>In order to prepare the board for flashing follow these" | |
420 | " steps:</p><ol>" | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
421 | "<li>Enter 'bootloader' mode (board <b>without</b> RESET button):" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
422 | "<ul>" |
8096 | 423 | "<li>Plug in your board while holding the BOOTSEL button.</li>" |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
424 | "</ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
425 | "Enter 'bootloader' mode (board <b>with</b> RESET button):" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
426 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
427 | "<li>hold down RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
428 | "<li>hold down BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
429 | "<li>release RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
430 | "<li>release BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
431 | "</ul></li>" |
8096 | 432 | "<li>Wait until the device has entered 'bootloader' mode.</li>" |
433 | "<li>Ensure the boot volume is available (this may require" | |
434 | " mounting it).</li>" | |
435 | "<li>Select the firmware file to be flashed and click the" | |
436 | " flash button.</li>" | |
437 | "</ol>" | |
438 | ), | |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
439 | "show_all": True, |
8120
84928e9f446f
UF2FlashDialog: updated a string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8111
diff
changeset
|
440 | "firmware": "MicroPython / CircuitPython", |
8096 | 441 | }, |
442 | } | |
443 | ||
444 | ||
445 | def getFoundDevices(boardType=""): | |
446 | """ | |
447 | Function to get the list of known serial devices supporting UF2. | |
448 | ||
449 | @param boardType specific board type to search for | |
450 | @type str | |
451 | @return list of tuples with the board type, the port description, the | |
452 | VID and PID | |
453 | @rtype list of tuple of (str, str, int, int) | |
454 | """ | |
455 | from PyQt5.QtSerialPort import QSerialPortInfo | |
456 | ||
457 | foundDevices = [] | |
458 | ||
459 | availablePorts = QSerialPortInfo.availablePorts() | |
460 | for port in availablePorts: | |
461 | vid = port.vendorIdentifier() | |
462 | pid = port.productIdentifier() | |
463 | ||
464 | if vid == 0 and pid == 0: | |
465 | # no device detected at port | |
466 | continue | |
467 | ||
468 | for board in SupportedUF2Boards: | |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
469 | if ( |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
470 | (not boardType or (board.startswith(boardType))) and |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
471 | (vid, pid) in SupportedUF2Boards[board]["volumes"] |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
472 | ): |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
473 | foundDevices.append(( |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
474 | board, |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
475 | port.description(), |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
476 | (vid, pid), |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
477 | )) |
8096 | 478 | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
479 | # second run for boards needing special treatment (e.g. RP2040) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
480 | for board in SupportedUF2Boards: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
481 | if not boardType or (board == boardType): |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
482 | try: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
483 | # find mounted volume |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
484 | volumes = SupportedUF2Boards[board]["volumes"][(0, 0)] |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
485 | foundVolumes = [] |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
486 | for volume in volumes: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
487 | foundVolumes += Utilities.findVolume(volume, findAll=True) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
488 | if foundVolumes: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
489 | foundDevices.append(( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
490 | board, |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
491 | QCoreApplication.translate( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
492 | "UF2FlashDialog", "'{0}' Board").format(board), |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
493 | (0, 0), # VID/PID of (0, 0) is special |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
494 | )) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
495 | except KeyError: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
496 | # no special treatment required, carry on |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
497 | pass |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
498 | |
8096 | 499 | return foundDevices |
500 | ||
501 | ||
502 | class UF2FlashDialog(QDialog, Ui_UF2FlashDialog): | |
503 | """ | |
504 | Class implementing a dialog to flash any UF2 capable device. | |
505 | """ | |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8120
diff
changeset
|
506 | DeviceTypeRole = Qt.ItemDataRole.UserRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8120
diff
changeset
|
507 | DeviceVidPidRole = Qt.ItemDataRole.UserRole + 1 |
8096 | 508 | |
509 | def __init__(self, boardType="", parent=None): | |
510 | """ | |
511 | Constructor | |
512 | ||
513 | @param boardType specific board type to show the dialog for | |
514 | @type str | |
515 | @param parent reference to the parent widget (defaults to None) | |
516 | @type QWidget (optional) | |
517 | """ | |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8170
diff
changeset
|
518 | super().__init__(parent) |
8096 | 519 | self.setupUi(self) |
520 | ||
521 | self.refreshButton.setIcon(UI.PixmapCache.getIcon("rescan")) | |
522 | ||
523 | self.firmwarePicker.setMode(E5PathPickerModes.OpenFileMode) | |
524 | self.firmwarePicker.setFilters( | |
525 | self.tr("MicroPython/CircuitPython Files (*.uf2);;" | |
526 | "All Files (*)")) | |
527 | ||
528 | self.bootPicker.setMode(E5PathPickerModes.DirectoryShowFilesMode) | |
529 | self.bootPicker.setEnabled(False) | |
530 | ||
531 | self.__mandatoryStyleSheet = ( | |
532 | "QLineEdit {border: 2px solid;border-color: #800000}" | |
533 | ) | |
534 | self.__manualType = "<manual>" | |
535 | ||
536 | self.__boardType = boardType | |
537 | ||
538 | self.__populate() | |
539 | ||
540 | self.__updateFlashButton() | |
541 | ||
542 | def __populate(self): | |
543 | """ | |
544 | Private method to (re-)populate the dialog. | |
545 | """ | |
546 | # save the currently selected device | |
547 | currentDevice = self.devicesComboBox.currentText() | |
548 | firmwareFile = self.firmwarePicker.text() | |
549 | ||
550 | # clear the entries first | |
551 | self.devicesComboBox.clear() | |
552 | self.firmwarePicker.clear() | |
553 | self.bootPicker.clear() | |
554 | self.infoLabel.clear() | |
555 | self.infoEdit.clear() | |
556 | ||
557 | # now populate the entries with data | |
558 | devices = getFoundDevices(boardType=self.__boardType) | |
559 | if len(devices) == 0: | |
560 | # no device detected | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
561 | devices = list(filter( |
8096 | 562 | lambda x: x[0] in SupportedUF2Boards, |
563 | MicroPythonDevices.getFoundDevices()[0] | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
564 | )) |
8096 | 565 | if devices: |
566 | self.__showSpecificInstructions(list(devices)) | |
567 | else: | |
568 | self.__showAllInstructions() | |
569 | self.devicesComboBox.addItem("") | |
570 | self.devicesComboBox.addItem(self.tr("Manual Select")) | |
571 | self.devicesComboBox.setItemData(1, self.__manualType, | |
572 | self.DeviceTypeRole) | |
573 | elif len(devices) == 1: | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
574 | # set the board type to the found one |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
575 | self.__boardType = devices[0][0] |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
576 | |
8096 | 577 | self.devicesComboBox.addItem(devices[0][1]) |
578 | self.devicesComboBox.setItemData( | |
579 | 0, devices[0][0], self.DeviceTypeRole) | |
580 | self.devicesComboBox.setItemData( | |
581 | 0, devices[0][2], self.DeviceVidPidRole) | |
582 | self.devicesComboBox.addItem(self.tr("Manual Select")) | |
583 | self.devicesComboBox.setItemData(1, self.__manualType, | |
584 | self.DeviceTypeRole) | |
585 | self.on_devicesComboBox_currentIndexChanged(0) | |
586 | else: | |
587 | self.devicesComboBox.addItem("") | |
588 | for index, (boardType, description, | |
589 | vidpid) in enumerate(sorted(devices), 1): | |
590 | self.devicesComboBox.addItem(description) | |
591 | self.devicesComboBox.setItemData( | |
592 | index, boardType, self.DeviceTypeRole) | |
593 | self.devicesComboBox.setItemData( | |
594 | index, vidpid, self.DeviceVidPidRole) | |
595 | self.devicesComboBox.addItem(self.tr("Manual Select")) | |
596 | self.devicesComboBox.setItemData(index + 1, self.__manualType, | |
597 | self.DeviceTypeRole) | |
598 | ||
599 | # reselect the remembered device, if it is still there | |
600 | if currentDevice: | |
601 | self.devicesComboBox.setCurrentText(currentDevice) | |
602 | self.firmwarePicker.setText(firmwareFile) | |
603 | else: | |
604 | self.devicesComboBox.setCurrentIndex(0) | |
605 | ||
606 | def __updateFlashButton(self): | |
607 | """ | |
608 | Private method to update the state of the Flash button and the retest | |
609 | button. | |
610 | """ | |
611 | firmwareFile = self.firmwarePicker.text() | |
612 | if self.devicesComboBox.currentData(self.DeviceTypeRole) is not None: | |
613 | if bool(firmwareFile) and os.path.exists(firmwareFile): | |
614 | self.firmwarePicker.setStyleSheet("") | |
615 | else: | |
616 | self.firmwarePicker.setStyleSheet(self.__mandatoryStyleSheet) | |
617 | ||
618 | if bool(self.bootPicker.text()): | |
619 | self.bootPicker.setStyleSheet("") | |
620 | else: | |
621 | self.bootPicker.setStyleSheet(self.__mandatoryStyleSheet) | |
622 | else: | |
623 | self.firmwarePicker.setStyleSheet("") | |
624 | self.bootPicker.setStyleSheet("") | |
625 | ||
626 | enable = ( | |
627 | bool(self.bootPicker.text()) and | |
628 | bool(firmwareFile) and | |
629 | os.path.exists(firmwareFile) | |
630 | ) | |
631 | self.flashButton.setEnabled(enable) | |
632 | ||
633 | def __showAllInstructions(self): | |
634 | """ | |
635 | Private method to show instructions for resetting devices to bootloader | |
636 | mode. | |
637 | """ | |
638 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
639 | ||
640 | htmlText = self.tr( | |
641 | "<h4>No known devices detected.</h4>" | |
642 | "<p>Follow the appropriate instructions below to set <b>one</b>" | |
643 | " board into 'bootloader' mode. Press <b>Refresh</b> when ready." | |
644 | "</p>" | |
645 | ) | |
646 | for boardType in SupportedUF2Boards: | |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
647 | if SupportedUF2Boards[boardType]["show_all"]: |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
648 | htmlText += ( |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
649 | "<hr/>" + |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
650 | SupportedUF2Boards[boardType]["instructions"] |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
651 | ) |
8096 | 652 | self.infoEdit.setHtml(htmlText) |
653 | ||
654 | def __showSpecificInstructions(self, devices): | |
655 | """ | |
656 | Private method to show instructions for resetting devices to bootloader | |
657 | mode for a list of detected devices. | |
658 | ||
659 | @param devices list of detected devices | |
660 | @type list of str | |
661 | """ | |
8099
522946e53835
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8097
diff
changeset
|
662 | boardTypes = {x[0] for x in devices} |
8096 | 663 | |
664 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
665 | ||
666 | if self.__boardType: | |
667 | htmlText = self.tr( | |
668 | "<h4>Flash {0} Firmware</h4>" | |
669 | "<p>Follow the instructions below to set <b>one</b> board into" | |
670 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
671 | "<hr/>{1}" | |
672 | ).format( | |
673 | SupportedUF2Boards[self.__boardType]["firmware"], | |
674 | SupportedUF2Boards[self.__boardType]["instructions"], | |
675 | ) | |
676 | else: | |
677 | htmlText = self.tr( | |
678 | "<h4>Potentially UF2 capable devices found</h4>" | |
679 | "<p>Found these potentially UF2 capable devices:</p>" | |
680 | "<ul><li>{0}</li></ul>" | |
681 | "<p>Follow the instructions below to set <b>one</b> board into" | |
682 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
683 | ).format( | |
684 | "</li><li>".join(sorted(x[1] for x in devices)) | |
685 | ) | |
686 | for boardType in sorted(boardTypes): | |
687 | htmlText += ( | |
688 | "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
689 | ) | |
690 | self.infoEdit.setHtml(htmlText) | |
691 | ||
692 | def __showTypedInstructions(self, boardType): | |
693 | """ | |
694 | Private method to show instructions for resetting devices to bootloader | |
695 | mode for a specific board type. | |
696 | ||
697 | @param boardType type of the board to show instructions for | |
698 | @type str | |
699 | """ | |
700 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
701 | ||
702 | htmlText = self.tr( | |
703 | "<h4>No known devices detected.</h4>" | |
704 | "<p>Follow the instructions below to set <b>one</b> board into" | |
705 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
706 | ) | |
707 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
708 | self.infoEdit.setHtml(htmlText) | |
709 | ||
710 | def __showManualInstructions(self): | |
711 | """ | |
712 | Private method to show instructions for flashing devices manually. | |
713 | """ | |
714 | self.infoLabel.setText(self.tr("Flash Instructions:")) | |
715 | ||
716 | htmlText = self.tr( | |
717 | "<h4>Flash method 'manual' selected.</h4>" | |
718 | "<p>Follow the instructions below to flash a device by entering" | |
8097
5af9c426c46b
Updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8096
diff
changeset
|
719 | " the data manually.</p><ol>" |
8096 | 720 | "<li>Change the device to 'bootloader' mode.</li>" |
721 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
722 | "<li>Ensure the boot volume is available (this may require" | |
723 | " mounting it) and select its path.</li>" | |
724 | "<li>Select the firmware file to be flashed and click the" | |
725 | " flash button.</li>" | |
726 | "</ol>" | |
727 | ) | |
728 | for boardType in SupportedUF2Boards: | |
729 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
730 | self.infoEdit.setHtml(htmlText) | |
731 | ||
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
732 | def __showNoVolumeInformation(self, volumes, boardType): |
8096 | 733 | """ |
734 | Private method to show information about the expected boot volume(s). | |
735 | ||
736 | @param volumes list of expected volume names | |
737 | @type list of str | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
738 | @param boardType type of the board to show instructions for |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
739 | @type str |
8096 | 740 | """ |
741 | self.infoLabel.setText(self.tr("Boot Volume not found:")) | |
742 | ||
743 | htmlText = self.tr( | |
744 | "<h4>No Boot Volume detected.</h4>" | |
745 | "<p>Please ensure that the boot volume of the device to be flashed" | |
746 | " is available. " | |
747 | ) | |
748 | if len(volumes) == 1: | |
749 | htmlText += self.tr( | |
750 | "This volume should be named <b>{0}</b>." | |
751 | " Press <b>Refresh</b> when ready.</p>" | |
752 | ).format(volumes[0]) | |
753 | else: | |
754 | htmlText += self.tr( | |
755 | "This volume should have one of these names.</p>" | |
756 | "<ul><li>{0}</li></ul>" | |
757 | "<p>Press <b>Refresh</b> when ready.</p>" | |
758 | ).format("</li><li>".join(sorted(volumes))) | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
759 | |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
760 | if boardType: |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
761 | htmlText += self.tr( |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
762 | "<h4>Reset Instructions</h4>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
763 | "<p>Follow the instructions below to set the board into" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
764 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
765 | ) |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
766 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
767 | |
8096 | 768 | self.infoEdit.setHtml(htmlText) |
769 | ||
770 | def __showMultipleVolumesInformation(self, volumePaths): | |
771 | """ | |
772 | Private method to show information because multiple devices of the | |
773 | same type are ready for flashing. | |
774 | ||
775 | Note: This is a dangerous situation! | |
776 | ||
777 | @param volumePaths list of volume paths | |
778 | @type list of str | |
779 | """ | |
780 | self.infoLabel.setText(self.tr("Multiple Boot Volumes found:")) | |
781 | ||
782 | htmlText = self.tr( | |
783 | "<h4>Multiple Boot Volumes were found</h4>" | |
784 | "<p>These volume paths were found.</p><ul><li>{0}</li></ul>" | |
785 | "<p>Please ensure that only one device of a type is ready for" | |
786 | " flashing. Press <b>Refresh</b> when ready.</p>" | |
787 | ).format("</li><li>".join(sorted(volumePaths))) | |
788 | self.infoEdit.setHtml(htmlText) | |
789 | ||
790 | @pyqtSlot() | |
791 | def on_flashButton_clicked(self): | |
792 | """ | |
793 | Private slot to flash the selected MicroPython or CircuitPython | |
794 | firmware onto the device. | |
795 | """ | |
796 | boardType = self.devicesComboBox.currentData(self.DeviceTypeRole) | |
797 | firmwarePath = self.firmwarePicker.text() | |
798 | volumePath = self.bootPicker.text() | |
799 | if os.path.exists(firmwarePath) and os.path.exists(volumePath): | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
800 | if boardType == self.__manualType: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
801 | self.infoLabel.setText(self.tr("Flashing Firmware")) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
802 | self.infoEdit.setHtml(self.tr( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
803 | "<p>Flashing the selected firmware to the device. Please" |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
804 | " wait until the device resets automatically.</p>") |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
805 | ) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
806 | else: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
807 | firmwareType = SupportedUF2Boards[boardType]["firmware"] |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
808 | self.infoLabel.setText( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
809 | self.tr("Flashing {0}").format(firmwareType)) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
810 | self.infoEdit.setHtml(self.tr( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
811 | "<p>Flashing the {0} firmware to the device. Please wait" |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
812 | " until the device resets automatically.</p>" |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
813 | ).format(firmwareType)) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8120
diff
changeset
|
814 | QCoreApplication.processEvents( |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8120
diff
changeset
|
815 | QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) |
8096 | 816 | shutil.copy2(firmwarePath, volumePath) |
817 | QThread.sleep(1) | |
818 | self.on_refreshButton_clicked() | |
819 | ||
820 | @pyqtSlot() | |
821 | def on_refreshButton_clicked(self): | |
822 | """ | |
823 | Private slot to refresh the dialog. | |
824 | """ | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
825 | # special treatment for RPi Pico |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
826 | if self.__boardType == "circuitpython_rp2040": |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
827 | self.__boardType = "rp2040" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
828 | |
8096 | 829 | self.__populate() |
830 | ||
831 | @pyqtSlot(int) | |
832 | def on_devicesComboBox_currentIndexChanged(self, index): | |
833 | """ | |
834 | Private slot to handle the selection of a board. | |
835 | ||
836 | @param index selected index | |
837 | @type int | |
838 | """ | |
839 | vidpid = self.devicesComboBox.itemData(index, self.DeviceVidPidRole) | |
840 | boardType = self.devicesComboBox.itemData(index, self.DeviceTypeRole) | |
841 | ||
842 | self.bootPicker.setEnabled(boardType == self.__manualType) | |
843 | if boardType == self.__manualType: | |
844 | self.__showManualInstructions() | |
845 | ||
846 | if vidpid is None: | |
847 | if boardType is None: | |
848 | self.bootPicker.clear() | |
849 | else: | |
850 | volumes = SupportedUF2Boards[boardType]["volumes"][vidpid] | |
851 | foundVolumes = [] | |
852 | for volume in volumes: | |
853 | foundVolumes += Utilities.findVolume(volume, findAll=True) | |
854 | ||
855 | if len(foundVolumes) == 0: | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
856 | self.__showNoVolumeInformation(volumes, boardType) |
8096 | 857 | self.bootPicker.clear() |
858 | elif len(foundVolumes) == 1: | |
859 | self.bootPicker.setText(foundVolumes[0]) | |
860 | else: | |
861 | self.__showMultipleVolumesInformation() | |
862 | self.bootPicker.clear() | |
863 | ||
864 | self.__updateFlashButton() | |
865 | ||
866 | @pyqtSlot(str) | |
867 | def on_firmwarePicker_textChanged(self, text): | |
868 | """ | |
869 | Private slot handling a change of the firmware file. | |
870 | ||
871 | @param text current text of the firmware edit | |
872 | @type str | |
873 | """ | |
874 | self.__updateFlashButton() | |
875 | ||
876 | @pyqtSlot(str) | |
877 | def on_bootPicker_textChanged(self, text): | |
878 | """ | |
879 | Private slot handling a change of the boot volume. | |
880 | ||
881 | @param text current text of the boot volume edit | |
882 | @type str | |
883 | """ | |
884 | self.__updateFlashButton() |