Sat, 02 Dec 2023 12:19:16 +0100
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
8096 | 1 | # -*- coding: utf-8 -*- |
2 | ||
9653
e67609152c5e
Updated copyright for 2023.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9624
diff
changeset
|
3 | # Copyright (c) 2021 - 2023 Detlev Offenbach <detlev@die-offenbachs.de> |
8096 | 4 | # |
5 | ||
6 | """ | |
7 | Module implementing a dialog to flash any UF2 capable device. | |
8 | """ | |
9 | ||
10172 | 10 | import contextlib |
8096 | 11 | import os |
12 | import shutil | |
13 | ||
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
14 | from PyQt6.QtCore import QCoreApplication, QEventLoop, Qt, QThread, pyqtSlot |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
15 | from PyQt6.QtSerialPort import QSerialPortInfo |
9815 | 16 | from PyQt6.QtWidgets import QDialog, QInputDialog |
8096 | 17 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
18 | from eric7.EricGui import EricPixmapCache |
9903 | 19 | from eric7.EricWidgets import EricMessageBox |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9248
diff
changeset
|
20 | from eric7.EricWidgets.EricApplication import ericApp |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
21 | from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
22 | from eric7.SystemUtilities import FileSystemUtilities, OSUtilities |
8096 | 23 | |
9759
4543b7876047
Adapted some MicroPython modules to the new package layout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9736
diff
changeset
|
24 | from . import Devices |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
25 | from .Ui_UF2FlashDialog import Ui_UF2FlashDialog |
8096 | 26 | |
27 | SupportedUF2Boards = { | |
28 | "circuitpython": { | |
29 | "volumes": { | |
30 | (0x03EB, 0x2402): [ | |
9903 | 31 | ("SAMD21", "SAMD21 Board"), |
32 | ("SAME54", "SAME54 Board"), | |
8096 | 33 | ], |
9248 | 34 | (0x04D8, 0xE799): [ |
10208 | 35 | ("ZEROBOOT", "Maker Zero SAMD21"), |
9248 | 36 | ], |
8096 | 37 | (0x04D8, 0xEC44): [ |
9903 | 38 | ("PYCUBEDBOOT", "PyCubedv04"), |
8096 | 39 | ], |
40 | (0x04D8, 0xEC63): [ | |
9903 | 41 | ("BOOT", "CircuitBrains Basic"), |
8096 | 42 | ], |
43 | (0x04D8, 0xEC64): [ | |
9903 | 44 | ("BOOT", "CircuitBrains Deluxe"), |
8096 | 45 | ], |
46 | (0x04D8, 0xED5F): [ | |
9903 | 47 | ("UCHIPYBOOT", "uChip CircuitPython"), |
8096 | 48 | ], |
49 | (0x04D8, 0xEDB3): [ | |
9903 | 50 | ("USBHUBBOOT", "Programmable USB Hub"), |
8096 | 51 | ], |
52 | (0x04D8, 0xEDBE): [ | |
9903 | 53 | ("SAM32BOOT", "SAM32"), |
8096 | 54 | ], |
55 | (0x04D8, 0xEF66): [ | |
9903 | 56 | ("SENSEBOX", "senseBox MCU"), |
8096 | 57 | ], |
58 | (0x1209, 0x2017): [ | |
9903 | 59 | ("MINISAMBOOT", "Mini SAM M4"), |
8096 | 60 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
61 | (0x1209, 0x3252): [ |
9903 | 62 | ("MCBS2OMBOOT", "Module Clip w/Wroom"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
63 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
64 | (0x1209, 0x3253): [ |
9903 | 65 | ("MCBS2ERBOOT", "Module Clip w/Wrover"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
66 | ], |
8096 | 67 | (0x1209, 0x4D44): [ |
9903 | 68 | ("ROBOM0BOOT", "Robo HAT MM1"), |
69 | ("ROBOM4BOOT", "Robo HAT MM1 M4"), | |
8096 | 70 | ], |
71 | (0x1209, 0x4DDD): [ | |
9903 | 72 | ("SapBOOT", "CP Sapling"), |
8096 | 73 | ], |
74 | (0x1209, 0x7102): [ | |
9903 | 75 | ("MINISAMBOOT", "Mini SAM M0"), |
8096 | 76 | ], |
9248 | 77 | (0x1209, 0x7380): [ |
9903 | 78 | ("CH840BOOT", "ILabs Challenger 840"), |
9248 | 79 | ], |
8919 | 80 | (0x1209, 0x7A01): [ |
9903 | 81 | ("MIKOTO-BOOT", "Mikoto nRF52840"), |
8919 | 82 | ], |
8096 | 83 | (0x1209, 0x805A): [ |
9903 | 84 | ("BASTBLE", "Bast BLE"), |
8096 | 85 | ], |
86 | (0x1209, 0xE3E2): [ | |
9903 | 87 | ("StackRduino", "StackRduino M0 PRO"), |
8096 | 88 | ], |
89 | (0x1209, 0xF501): [ | |
9903 | 90 | ("M4SHIMBOOT", "M4-Shim"), |
8096 | 91 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
92 | (0x15BA, 0x28DC): [ |
9903 | 93 | ("OLMLIPOBOOT", "ESP32S2 DevKit Lipo"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
94 | ], |
8096 | 95 | (0x16D0, 0x0CDA): [ |
9903 | 96 | ("AUTOMAT", "automat"), |
8096 | 97 | ], |
9614 | 98 | (0x16D0, 0x10ED): [ |
9903 | 99 | ("PillBug", "PillBug"), |
9614 | 100 | ], |
9248 | 101 | (0x1B4F, 0x0019): [ |
9903 | 102 | ("QwiicMicro", "Qwiic Micro SamD21"), |
9248 | 103 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
104 | (0x1B4F, 0x0022): [ |
9903 | 105 | ("SFMM852BOOT", "MicroMod nRF52840"), |
8096 | 106 | ], |
8956 | 107 | (0x1B4F, 0x002C): [ |
9903 | 108 | ("THNG+32BOOT", "Thing Plus - STM32"), |
8956 | 109 | ], |
8096 | 110 | (0x1B4F, 0x0D22): [ |
9903 | 111 | ("SPARKFUN", "SAMD21 Mini Breakout"), |
8096 | 112 | ], |
113 | (0x1B4F, 0x0D23): [ | |
9903 | 114 | ("SPARKFUN", "SAMD21 Dev Breakout"), |
8096 | 115 | ], |
116 | (0x1D50, 0x6110): [ | |
9903 | 117 | ("ROBOTICS", "Robotics"), |
8096 | 118 | ], |
119 | (0x1D50, 0x6112): [ | |
9903 | 120 | ("RCBOOT", "Wattuino RC"), |
8096 | 121 | ], |
8919 | 122 | (0x1D50, 0x6157): [ |
9903 | 123 | ("BBOARDBOOT", "nRF52840 BBoard"), |
8919 | 124 | ], |
8096 | 125 | (0x1D50, 0x6160): [ |
9903 | 126 | ("BLUEMICRO", "BlueMicro"), |
8096 | 127 | ], |
8919 | 128 | (0x1D50, 0x616F): [ |
9903 | 129 | ("BLUEMICRO", "BlueMicro"), |
8919 | 130 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
131 | (0x1FC9, 0x0094): [ |
9903 | 132 | ("DblM33BOOT", "Double M33"), |
133 | ("LPC5528BOOT", "LPCXpresso 55s28"), | |
134 | ("LPC5569BOOT", "LPCXpresso 55s69"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
135 | ], |
8919 | 136 | (0x1FC9, 0x0154): [ |
9903 | 137 | ("K32L2BOOT", "FRDM-K32L2B3"), |
138 | ("K32L2BOOT", "KUIIC"), | |
8919 | 139 | ], |
8096 | 140 | (0x230A, 0x00E9): [ |
9903 | 141 | ("TAU_BOOT", "Tau"), |
8096 | 142 | ], |
143 | (0x2341, 0x0057): [ | |
9903 | 144 | ("NANOBOOT", "NANO 33 IoT"), |
8096 | 145 | ], |
146 | (0x2341, 0x8053): [ | |
9903 | 147 | ("MKR1300", "MKR1300"), |
148 | ], | |
149 | (0x2341, 0x8056): [ | |
150 | ("VIDOR4000", "MKR Vidor 4000"), | |
8096 | 151 | ], |
152 | (0x239A, 0x000F): [ | |
9903 | 153 | ("ITSYBOOT", "ItsyBitsy M0 Express"), |
8096 | 154 | ], |
155 | (0x239A, 0x0013): [ | |
9903 | 156 | ("METROBOOT", "Metro M0"), |
8096 | 157 | ], |
158 | (0x239A, 0x0015): [ | |
9903 | 159 | ("FEATHERBOOT", "Feather M0"), |
8096 | 160 | ], |
161 | (0x239A, 0x0018): [ | |
9903 | 162 | ("CPLAYBOOT", "CPlay Express"), |
8096 | 163 | ], |
164 | (0x239A, 0x001B): [ | |
9903 | 165 | ("FEATHERBOOT", "Feather M0 Express"), |
8096 | 166 | ], |
167 | (0x239A, 0x001C): [ | |
9903 | 168 | ("GEMMABOOT", "Gemma M0"), |
8096 | 169 | ], |
170 | (0x239A, 0x001E): [ | |
9903 | 171 | ("TRINKETBOOT", "Trinket M0"), |
8096 | 172 | ], |
173 | (0x239A, 0x0021): [ | |
9903 | 174 | ("METROM4BOOT", "Metro M4 Express"), |
8096 | 175 | ], |
176 | (0x239A, 0x0022): [ | |
9903 | 177 | ("ARCADE-D5", "Feather Arcade D51"), |
178 | ("FEATHERBOOT", "Feather M4 Express"), | |
8096 | 179 | ], |
180 | (0x239A, 0x0024): [ | |
9903 | 181 | ("RADIOBOOT", "Radiofruit M0"), |
8096 | 182 | ], |
183 | (0x239A, 0x0027): [ | |
9903 | 184 | ("PIRKEYBOOT", "pIRKey M0"), |
8096 | 185 | ], |
186 | (0x239A, 0x0029): [ | |
10208 | 187 | ("ARCADE-N4", "Feather nRF52840 Express"), |
9903 | 188 | ("ARGONBOOT ", "Argon"), |
189 | ("BORONBOOT ", "Boron"), | |
190 | ("FTHR833BOOT", "Feather nRF52833 Express"), | |
191 | ("FTHR840BOOT", "Feather nRF52840 Express"), | |
192 | ("MDK840DONGL", "MDK nRF52840 USB Dongle"), | |
193 | ("WS52840EVK", "Waveshare nRF52840 Eval"), | |
194 | ("XENONBOOT ", "Xenon"), | |
8096 | 195 | ], |
196 | (0x239A, 0x002B): [ | |
9903 | 197 | ("ARCADE-D5", "Itsy Arcade D51"), |
198 | ("ITSYM4BOOT", "ItsyBitsy M4 Express"), | |
8096 | 199 | ], |
200 | (0x239A, 0x002D): [ | |
9903 | 201 | ("CRICKITBOOT", "crickit"), |
8096 | 202 | ], |
203 | (0x239A, 0x002F): [ | |
9903 | 204 | ("TRELM4BOOT", "Trellis M4 Express"), |
8096 | 205 | ], |
206 | (0x239A, 0x0031): [ | |
9903 | 207 | ("GCM4BOOT", "Grand Central M4 Express"), |
8096 | 208 | ], |
209 | (0x239A, 0x0033): [ | |
9903 | 210 | ("PYBADGEBOOT", "PyBadge"), |
8096 | 211 | ], |
212 | (0x239A, 0x0034): [ | |
9903 | 213 | ("BADGELCBOOT", "BadgeLC"), |
214 | ("PEWBOOT", "PewPew"), | |
8096 | 215 | ], |
216 | (0x239A, 0x0035): [ | |
9903 | 217 | ("MKRZEROBOOT", "MKRZero"), |
218 | ("PORTALBOOT", "PyPortal M4 Express"), | |
8096 | 219 | ], |
220 | (0x239A, 0x0037): [ | |
9903 | 221 | ("METROM4BOOT", "Metro M4 AirLift"), |
8096 | 222 | ], |
223 | (0x239A, 0x003D): [ | |
9903 | 224 | ("PYGAMERBOOT", "PyGamer"), |
8096 | 225 | ], |
226 | (0x239A, 0x003F): [ | |
9903 | 227 | ("METR840BOOT", "Metro nRF52840 Express"), |
8096 | 228 | ], |
229 | (0x239A, 0x0045): [ | |
9903 | 230 | ("CPLAYBTBOOT", "Circuit Playground nRF52840"), |
8096 | 231 | ], |
232 | (0x239A, 0x0047): [ | |
9903 | 233 | ("MASKM4BOOT", "Hallowing Mask M4"), |
8096 | 234 | ], |
235 | (0x239A, 0x0049): [ | |
9903 | 236 | ("HALLOM4BOOT", "HalloWing M4"), |
8096 | 237 | ], |
238 | (0x239A, 0x004D): [ | |
9903 | 239 | ("SNEKBOOT", "snekboard"), |
8096 | 240 | ], |
241 | (0x239A, 0x0051): [ | |
9903 | 242 | ("ITSY840BOOT", "ItsyBitsy nRF52840 Express"), |
8096 | 243 | ], |
244 | (0x239A, 0x0057): [ | |
9903 | 245 | ("SERPENTBOOT", "Serpente"), |
8096 | 246 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
247 | (0x239A, 0x0059): [ |
9903 | 248 | ("FTHR405BOOT", "Feather STM32F405 Express"), |
8101
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, 0x005D): [ |
9903 | 251 | ("BlackPill", "STM32F401CxUx"), |
252 | ("STMF411BOOT", "STM32F411 Discovery"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
253 | ], |
8096 | 254 | (0x239A, 0x0061): [ |
9903 | 255 | ("SOLBOOT", "Sol"), |
8096 | 256 | ], |
257 | (0x239A, 0x0063): [ | |
9903 | 258 | ("NANO33BOOT", "Nano 33 BLE"), |
8096 | 259 | ], |
260 | (0x239A, 0x0065): [ | |
9903 | 261 | ("ND6BOOT", "ndBit6"), |
8096 | 262 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
263 | (0x239A, 0x0069): [ |
9903 | 264 | ("STMF411BOOT", "STM32F411 BlackPill"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
265 | ], |
8096 | 266 | (0x239A, 0x006B): [ |
9903 | 267 | ("shIRtty", "shIRtty"), |
8096 | 268 | ], |
269 | (0x239A, 0x0071): [ | |
9903 | 270 | ("CLUEBOOT", "CLUE nRF52840"), |
8096 | 271 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
272 | (0x239A, 0x0077): [ |
9903 | 273 | ("RT1010BOOT", "RT1010 EVK"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
274 | ], |
8096 | 275 | (0x239A, 0x0079): [ |
9903 | 276 | ("ARAMBOOT", "ARAMCON Badge 2019"), |
8096 | 277 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
278 | (0x239A, 0x007B): [ |
9903 | 279 | ("ARAMBOOT", "ARAMCON2 Badge"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
280 | ], |
8096 | 281 | (0x239A, 0x007D): [ |
9903 | 282 | ("BOOKBOOT", "The Open Book Feather"), |
8096 | 283 | ], |
284 | (0x239A, 0x007F): [ | |
9903 | 285 | ("BADGEBOOT", "OHS2020 Badge"), |
8096 | 286 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
287 | (0x239A, 0x0081): [ |
9903 | 288 | ("RT1020BOOT", "RT1020 EVK"), |
289 | ("RT1024BOOT", "RT1024 EVK"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
290 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
291 | (0x239A, 0x0083): [ |
9903 | 292 | ("RT1060BOOT", "RT1060 EVK"), |
293 | ("RT1064BOOT", "RT1064 EVK"), | |
294 | ], | |
295 | (0x239A, 0x0085): [ | |
296 | ("TNSY40BOOT", "Teensy 4.0"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
297 | ], |
8096 | 298 | (0x239A, 0x0087): [ |
9903 | 299 | ("FTHRSNSBOOT", "Feather nRF52840 Sense"), |
8096 | 300 | ], |
301 | (0x239A, 0x0093): [ | |
9903 | 302 | ("ISVITABoot", "IkigaiSense Vita nRF52840"), |
8096 | 303 | ], |
304 | (0x239A, 0x0095): [ | |
9903 | 305 | ("UARTLOGBOOT", "UARTLogger II"), |
8096 | 306 | ], |
307 | (0x239A, 0x009F): [ | |
9903 | 308 | ("ADM840BOOT", "AtelierDuMaker NRF52840 Breakout"), |
8096 | 309 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
310 | (0x239A, 0x00A5): [ |
9903 | 311 | ("S3DKC1BOOT", "ESP32S3 DevKitC 1"), |
312 | ("S3DKM1BOOT", "ESP32S3 DevKitM 1"), | |
313 | ("SAOLA1RBOOT", "Saola 1R WROVER"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
314 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
315 | (0x239A, 0x00A7): [ |
9903 | 316 | ("SAOLA1MBOOT", "Saola 1M WROOM"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
317 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
318 | (0x239A, 0x00AB): [ |
9903 | 319 | ("UFTHRS2BOOT", "FeatherS2"), |
320 | ], | |
321 | (0x239A, 0x00AD): [ | |
322 | ("TNSY41BOOT", "Teensy 4.1"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
323 | ], |
8096 | 324 | (0x239A, 0x00AF): [ |
9903 | 325 | ("FLUFFBOOT", "Fluff M0"), |
8096 | 326 | ], |
327 | (0x239A, 0x00B3): [ | |
9903 | 328 | ("NICENANO", "nice!nano"), |
8096 | 329 | ], |
330 | (0x239A, 0x00B5): [ | |
9903 | 331 | ("E54XBOOT", "SAME54 Xplained"), |
8096 | 332 | ], |
333 | (0x239A, 0x00B9): [ | |
9903 | 334 | ("ND7BOOT", "ndBit7"), |
8096 | 335 | ], |
8919 | 336 | (0x239A, 0x00BB): [ |
9903 | 337 | ("MDBT50QBOOT", "Raytac MDBT50Q Demo Board 40"), |
8919 | 338 | ], |
8096 | 339 | (0x239A, 0x00BF): [ |
9903 | 340 | ("BADGEBOOT", "BLM Badge"), |
8096 | 341 | ], |
342 | (0x239A, 0x00C3): [ | |
9903 | 343 | ("GEMINIBOOT", "Gemini"), |
8096 | 344 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
345 | (0x239A, 0x00C5): [ |
9903 | 346 | ("MICROS2BOOT", "microS2"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
347 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
348 | (0x239A, 0x00C7): [ |
9903 | 349 | ("KALUGA1BOOT", "Kaluga 1"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
350 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
351 | (0x239A, 0x00C9): [ |
9903 | 352 | ("MATRIXBOOT", "Matrix Portal M4"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
353 | ], |
8096 | 354 | (0x239A, 0x00CB): [ |
9903 | 355 | ("QTPY_BOOT", "QT Py M0"), |
8096 | 356 | ], |
357 | (0x239A, 0x00CD): [ | |
9903 | 358 | ("FTHRCANBOOT", "Feather M4 CAN Express"), |
8096 | 359 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
360 | (0x239A, 0x00DE): [ |
9903 | 361 | ("NANOESPBOOT", "nanoESP32-S2 WROOM"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
362 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
363 | (0x239A, 0x00DF): [ |
9903 | 364 | ("METROS2BOOT", "Metro ESP32-S2"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
365 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
366 | (0x239A, 0x00E1): [ |
9903 | 367 | ("METROM7BOOT", "Metro M7 iMX RT1011"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
368 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
369 | (0x239A, 0x00E5): [ |
9903 | 370 | ("MAGTAGBOOT", "Metro MagTag 2.9 Grayscale"), |
371 | ("MAGTAGBOOT", "MagTag 2.9 Grayscale"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
372 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
373 | (0x239A, 0x00EB): [ |
9903 | 374 | ("FTHRS2BOOT", "Feather ESP32-S2"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
375 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
376 | (0x239A, 0x00ED): [ |
9903 | 377 | ("FTHRS2BOOT", "Feather ESP32-S2 Reverse TFT"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
378 | ], |
8096 | 379 | (0x239A, 0x00EF): [ |
9903 | 380 | ("TRINKEYBOOT", "NeoPixel Trinkey M0"), |
8096 | 381 | ], |
382 | (0x239A, 0x00F5): [ | |
9903 | 383 | ("STARBOOT", "Binary Star"), |
8096 | 384 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
385 | (0x239A, 0x00F9): [ |
9903 | 386 | ("HOUSEBOOT", "FunHouse"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
387 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
388 | (0x239A, 0x00FB): [ |
9903 | 389 | ("TRINKEYBOOT", "Rotary Trinkey M0"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
390 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
391 | (0x239A, 0x00FF): [ |
9903 | 392 | ("TRINKEYBOOT", "NeoKey Trinkey M0"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
393 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
394 | (0x239A, 0x0101): [ |
9903 | 395 | ("TRINKEYBOOT", "Slide Trinkey M0"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
396 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
397 | (0x239A, 0x0103): [ |
9903 | 398 | ("TRINKEYBOOT", "ProxSense Trinkey M0"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
399 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
400 | (0x239A, 0x010B): [ |
9903 | 401 | ("MDBT50QBOOT", "Raytac MDBT50Q-RX"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
402 | ], |
8919 | 403 | (0x239A, 0x010D): [ |
9903 | 404 | ("GLASSESBOOT", "LED Glasses Driver nRF52840"), |
8919 | 405 | ], |
406 | (0x239A, 0x010F): [ | |
9903 | 407 | ("FTHRS2BOOT", "Feather ESP32-S2 TFT"), |
8919 | 408 | ], |
409 | (0x239A, 0x0111): [ | |
9903 | 410 | ("QTPYS2BOOT", "QT Py ESP32-S2"), |
8919 | 411 | ], |
9051 | 412 | (0x239A, 0x0113): [ |
9903 | 413 | ("FTHRS3BOOT", "Feather ESP32-S3 No PSRAM"), |
9051 | 414 | ], |
8919 | 415 | (0x239A, 0x0115): [ |
9903 | 416 | ("FEATHERBOOT", "Feather M4 Adalogger"), |
8919 | 417 | ], |
418 | (0x239A, 0x0117): [ | |
9903 | 419 | ("CAMERABOOT", "Camera"), |
8919 | 420 | ], |
8956 | 421 | (0x239A, 0x0119): [ |
9903 | 422 | ("QTPYS3BOOT", "QT Py ESP32-S3"), |
8956 | 423 | ], |
9248 | 424 | (0x239A, 0x011D): [ |
9903 | 425 | ("FTHRS3BOOT", "Feather ESP32-S3 TFT"), |
9248 | 426 | ], |
9614 | 427 | (0x239A, 0x0123): [ |
9903 | 428 | ("FTHRS3BOOT", "Feather ESP32-S3 Reverse TFT"), |
9614 | 429 | ], |
430 | (0x239A, 0x0125): [ | |
9903 | 431 | ("MATRIXBOOT", "MatrixPortal ESP32-S2"), |
10112 | 432 | ("MATRXS3BOOT", "MatrixPortal S3"), |
433 | ], | |
434 | (0x239A, 0x0133): [ | |
435 | ("RT1050BOOT", "RT1050 EVK"), | |
436 | ], | |
437 | (0x239A, 0x0135): [ | |
438 | ("RT1040BOOT", "RT1040 EVK"), | |
439 | ], | |
440 | (0x239A, 0x0137): [ | |
441 | ("RT1015BOOT", "RT1015 EVK"), | |
442 | ], | |
443 | (0x239A, 0x013F): [ | |
444 | ("TOYS2BOOT", "My Little Hacker ESP32-S2"), | |
445 | ], | |
446 | (0x239A, 0x0143): [ | |
447 | ("QTPYS3BOOT", "QT Py ESP32-S3 (4M Flash, 2M PSRAM)"), | |
9614 | 448 | ], |
449 | (0x239A, 0x2030): [ | |
9903 | 450 | ("MBBOOT", "Maker badge"), |
9614 | 451 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
452 | (0x239A, 0x800B): [ |
9903 | 453 | ("ATMZBOOT", "ATMegaZero ESP32-S2"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
454 | ], |
8096 | 455 | (0x239A, 0xB000): [ |
9903 | 456 | ("HALLOWBOOT", "Hallowing M0"), |
8096 | 457 | ], |
458 | (0x239A, 0xE005): [ | |
9903 | 459 | ("HONKBOOT", "Big Honking Button"), |
8096 | 460 | ], |
461 | (0x2886, 0x000D): [ | |
9903 | 462 | ("Grove Zero", "Grove Zero"), |
8096 | 463 | ], |
464 | (0x2886, 0x002F): [ | |
9903 | 465 | ("Seeed XIAO", "Seeeduino XIAO"), |
466 | ], | |
467 | (0x2886, 0x0044): [ | |
468 | ("XIAO-BOOT", "XIAO nRF52840"), | |
469 | ], | |
470 | (0x2886, 0x0045): [ | |
471 | ("XIAO-SENSE", "XIAO nRF52840"), | |
8096 | 472 | ], |
10112 | 473 | (0x2886, 0x8056): [ |
474 | ("XIAOS3BOOT", "XIAO ESP32-S3"), | |
475 | ], | |
8096 | 476 | (0x2886, 0xF00E): [ |
9903 | 477 | ("PITAYAGO", "Pitaya Go"), |
8096 | 478 | ], |
479 | (0x2886, 0xF00F): [ | |
9903 | 480 | ("M60KEYBOARD", "MakerDiary M60 Mechanical Keyboard"), |
481 | ("nRF52840M2", "MakerDiary nRF52840 M.2 Module"), | |
8096 | 482 | ], |
8919 | 483 | (0x303A, 0x7000): [ |
9903 | 484 | ("ESPHMI1BOOT", "HMI 1"), |
8919 | 485 | ], |
9614 | 486 | (0x303A, 0x7004): [ |
9903 | 487 | ("S3BOXBOOT", "ESP32S3 Box 2.5"), |
9614 | 488 | ], |
489 | (0x303A, 0x700E): [ | |
9903 | 490 | ("S3EYEBOOT", "ESP32S3 EYE"), |
9614 | 491 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
492 | (0x303A, 0x8005): [ |
9903 | 493 | ("TINYS2BOOT", "TinyS2"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
494 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
495 | (0x303A, 0x8008): [ |
9903 | 496 | ("TTGOS2BOOT", "TTGO_T8_S2_Display"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
497 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
498 | (0x303A, 0x800E): [ |
9903 | 499 | ("CCMBRISBOOT", "CucumberRIS v1.1"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
500 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
501 | (0x303A, 0x80B0): [ |
9903 | 502 | ("RD00RBOOT", "Reference Design RD00"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
503 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
504 | (0x303A, 0x80B3): [ |
9903 | 505 | ("NANOESPBOOT", "nanoESP32-S2 WROVER"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
506 | ], |
8919 | 507 | (0x303A, 0x80B5): [ |
9903 | 508 | ("FS2NEOBOOT", "FeatherS2 Neo"), |
8919 | 509 | ], |
510 | (0x303A, 0x80B6): [ | |
9903 | 511 | ("MORPHBOOT", "MORPHESP-240"), |
8919 | 512 | ], |
513 | (0x303A, 0x80C4): [ | |
9903 | 514 | ("S2MINIBOOT", "S2 Mini"), |
8919 | 515 | ], |
516 | (0x303A, 0x80C7): [ | |
9903 | 517 | ("S2PICOBOOT", "S2 Pico"), |
8919 | 518 | ], |
8956 | 519 | (0x303A, 0x80D2): [ |
9903 | 520 | ("TINYS3BOOT", "TinyS3"), |
8956 | 521 | ], |
522 | (0x303A, 0x80D5): [ | |
9903 | 523 | ("PROS3BOOT", "ProS3"), |
8956 | 524 | ], |
525 | (0x303A, 0x80D8): [ | |
9903 | 526 | ("UFTHRS3BOOT", "FeatherS3"), |
8956 | 527 | ], |
8919 | 528 | (0x303A, 0x80DA): [ |
9903 | 529 | ("HEXKYBOOT", "HexKy-S2"), |
8919 | 530 | ], |
10112 | 531 | (0x303A, 0x80DC): [ |
532 | ("ZEROS3BOOT", "ZeroS3"), | |
533 | ], | |
9051 | 534 | (0x303A, 0x80DE): [ |
9903 | 535 | ("LEAFS3BOOT", "BPI-Leaf-S3"), |
9051 | 536 | ], |
537 | (0x303A, 0x80E1): [ | |
9903 | 538 | ("LEAFS2BOOT", "BPI-Leaf-S2"), |
9051 | 539 | ], |
540 | (0x303A, 0x80E4): [ | |
9903 | 541 | ("BITS2BOOT", "BPI-BIT-S2"), |
9051 | 542 | ], |
543 | (0x303A, 0x80EB): [ | |
9903 | 544 | ("TTGOS2BOOT", "TTGO_T8_S2_WROOM"), |
9051 | 545 | ], |
546 | (0x303A, 0x80EE): [ | |
9903 | 547 | ("TTGOS2BOOT", "TTGO_T8_S2"), |
9051 | 548 | ], |
9614 | 549 | (0x303A, 0x80FA): [ |
9903 | 550 | ("MFAS3BOOT", "Maker Feather AIoT S3"), |
9614 | 551 | ], |
9248 | 552 | (0x303A, 0x8101): [ |
9903 | 553 | ("MMAINS2BOOT", "MiniMain ESP32-S2"), |
9248 | 554 | ], |
9614 | 555 | (0x303A, 0x8109): [ |
9903 | 556 | ("ESP32S2PICO", "ESP32-S2-Pico"), |
9614 | 557 | ], |
558 | (0x303A, 0x810B): [ | |
9903 | 559 | ("ESP32S2PICO", "ESP32-S2-Pico-LCD"), |
9614 | 560 | ], |
561 | (0x303A, 0x8112): [ | |
9903 | 562 | ("BEES3BOOT", "Bee S3"), |
9614 | 563 | ], |
564 | (0x303A, 0x8115): [ | |
9903 | 565 | ("BMS3BOOT", "Bee Motion S3"), |
9614 | 566 | ], |
567 | (0x303A, 0x8118): [ | |
9903 | 568 | ("LOLIN3BOOT", "S3"), |
9614 | 569 | ], |
10112 | 570 | (0x303A, 0x8121): [ |
571 | ("ATOMS3BOOT", "AtomS3"), | |
572 | ], | |
9614 | 573 | (0x303A, 0x812D): [ |
9903 | 574 | ("UF2BOOT", "BPI-PicoW-S3"), |
9614 | 575 | ], |
576 | (0x303A, 0x8134): [ | |
9903 | 577 | ("TBEAMBOOT", "T-Beam Supreme"), |
9614 | 578 | ], |
10112 | 579 | (0x303A, 0x8143): [ |
580 | ("DYMBOOT", "Deneyap Mini"), | |
581 | ], | |
582 | (0x303A, 0x8146): [ | |
583 | ("DYM2BOOT", "Deneyap Mini v2"), | |
584 | ], | |
585 | (0x303A, 0x8149): [ | |
586 | ("DY1A2BOOT", "Deneyap Kart 1A v2"), | |
587 | ], | |
588 | (0x303A, 0x8160): [ | |
589 | ("ATOMS3BOOT", "AtomS3 Lite"), | |
590 | ], | |
591 | (0x303A, 0x8165): [ | |
592 | ("YDESP32S3", "YD-ESP32-S3"), | |
593 | ], | |
9248 | 594 | (0x30A4, 0x0002): [ |
9903 | 595 | ("SWANBOOT", "Swan R5"), |
9248 | 596 | ], |
8096 | 597 | (0x3171, 0x0100): [ |
9903 | 598 | ("CMDBOOT", "COMMANDER"), |
8096 | 599 | ], |
8956 | 600 | (0x80E7, 0x8111): [ |
9903 | 601 | ("IOTS2BOOT", "HiiBot IoTs2"), |
8956 | 602 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
603 | (0xCAFE, 0xFFFF): [ |
9903 | 604 | ("F303BOOT", "STM32F303 Discovery"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
605 | ], |
8096 | 606 | }, |
607 | "instructions": QCoreApplication.translate( | |
608 | "UF2FlashDialog", | |
609 | "<h3>CircuitPython Board</h3>" | |
610 | "<p>In order to prepare the board for flashing follow these" | |
611 | " steps:</p><ol>" | |
612 | "<li>Switch your device to 'bootloader' mode by double-pressing" | |
613 | " the reset button.</li>" | |
614 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
615 | "<li>(If this does not happen, then try shorter or longer" | |
616 | " pauses between presses.)</li>" | |
617 | "<li>Ensure the boot volume is available (this may require" | |
618 | " mounting it).</li>" | |
619 | "<li>Select the firmware file to be flashed and click the" | |
620 | " flash button.</li>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
621 | "</ol>", |
8096 | 622 | ), |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
623 | "show_all": True, |
8096 | 624 | "firmware": "CircuitPython", |
625 | }, | |
626 | "rp2040": { | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
627 | "volumes": { |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
628 | (0x0000, 0x0000): [ |
9903 | 629 | ("RPI-RP2", "Raspberry Pi Pico"), # we don't have valid VID/PID |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
630 | ], |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
631 | }, |
8096 | 632 | "instructions": QCoreApplication.translate( |
633 | "UF2FlashDialog", | |
634 | "<h3>Pi Pico (RP2040) Board</h3>" | |
635 | "<p>In order to prepare the board for flashing follow these" | |
636 | " steps:</p><ol>" | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
637 | "<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
|
638 | "<ul>" |
8096 | 639 | "<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
|
640 | "</ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
641 | "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
|
642 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
643 | "<li>hold down RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
644 | "<li>hold down BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
645 | "<li>release RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
646 | "<li>release BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
647 | "</ul></li>" |
8096 | 648 | "<li>Wait until the device has entered 'bootloader' mode.</li>" |
649 | "<li>Ensure the boot volume is available (this may require" | |
650 | " mounting it).</li>" | |
651 | "<li>Select the firmware file to be flashed and click the" | |
652 | " flash button.</li>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
653 | "</ol>", |
8096 | 654 | ), |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
655 | "show_all": True, |
8120
84928e9f446f
UF2FlashDialog: updated a string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8111
diff
changeset
|
656 | "firmware": "MicroPython / CircuitPython", |
8096 | 657 | }, |
658 | } | |
659 | ||
660 | ||
661 | def getFoundDevices(boardType=""): | |
662 | """ | |
663 | Function to get the list of known serial devices supporting UF2. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
664 | |
8096 | 665 | @param boardType specific board type to search for |
666 | @type str | |
667 | @return list of tuples with the board type, the port description, the | |
668 | VID and PID | |
9904
5d9a7d1afbd9
Changed the UF2 Dialog slightly to eliminate duplicate device entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9903
diff
changeset
|
669 | @rtype list of tuple of (str, str, (int, int)) |
8096 | 670 | """ |
9904
5d9a7d1afbd9
Changed the UF2 Dialog slightly to eliminate duplicate device entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9903
diff
changeset
|
671 | foundDevices = set() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
672 | |
9954 | 673 | # step 1: determine all known UF2 volumes that are mounted |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
674 | if not OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
675 | userMounts = FileSystemUtilities.getUserMounts() |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
676 | |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
677 | boardTypes = [boardType] if boardType else [*SupportedUF2Boards.keys()] |
9954 | 678 | for board in boardTypes: |
679 | for vidpid, volumes in SupportedUF2Boards[board]["volumes"].items(): | |
680 | for volume, description in volumes: | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
681 | if OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
682 | if FileSystemUtilities.findVolume(volume, findAll=True): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
683 | foundDevices.add((board, description, vidpid)) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
684 | else: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
685 | # check only user mounted devices on non-Windows systems |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
686 | for userMount in userMounts: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
687 | if os.path.basename(userMount).startswith(volume): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
688 | foundDevices.add((board, description, vidpid)) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
689 | break |
9954 | 690 | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
691 | # step 2: determine all devices that have their UF2 volume not mounted |
8096 | 692 | availablePorts = QSerialPortInfo.availablePorts() |
693 | for port in availablePorts: | |
694 | vid = port.vendorIdentifier() | |
695 | pid = port.productIdentifier() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
696 | |
8096 | 697 | if vid == 0 and pid == 0: |
698 | # no device detected at port | |
699 | continue | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
700 | |
8096 | 701 | for board in SupportedUF2Boards: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
702 | if (not boardType or (board.startswith(boardType))) and ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
703 | vid, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
704 | pid, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
705 | ) in SupportedUF2Boards[board]["volumes"]: |
9954 | 706 | for device in foundDevices: |
707 | if (vid, pid) == device[2]: | |
708 | break | |
709 | else: | |
710 | foundDevices.add( | |
711 | ( | |
712 | board, | |
713 | port.description(), | |
714 | (vid, pid), | |
715 | ) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
716 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
717 | |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
718 | return [*foundDevices] |
8096 | 719 | |
720 | ||
721 | class UF2FlashDialog(QDialog, Ui_UF2FlashDialog): | |
722 | """ | |
723 | Class implementing a dialog to flash any UF2 capable device. | |
724 | """ | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
725 | |
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
|
726 | 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
|
727 | DeviceVidPidRole = Qt.ItemDataRole.UserRole + 1 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
728 | |
8096 | 729 | def __init__(self, boardType="", parent=None): |
730 | """ | |
731 | Constructor | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
732 | |
8096 | 733 | @param boardType specific board type to show the dialog for |
734 | @type str | |
735 | @param parent reference to the parent widget (defaults to None) | |
736 | @type QWidget (optional) | |
737 | """ | |
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
|
738 | super().__init__(parent) |
8096 | 739 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
740 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9248
diff
changeset
|
741 | self.refreshButton.setIcon(EricPixmapCache.getIcon("rescan")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
742 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8327
diff
changeset
|
743 | self.firmwarePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
8096 | 744 | self.firmwarePicker.setFilters( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9482
diff
changeset
|
745 | self.tr("MicroPython/CircuitPython Files (*.uf2);;All Files (*)") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
746 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
747 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8327
diff
changeset
|
748 | self.bootPicker.setMode(EricPathPickerModes.DIRECTORY_SHOW_FILES_MODE) |
8096 | 749 | self.bootPicker.setEnabled(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
750 | |
9815 | 751 | self.searchBootButton.setIcon(EricPixmapCache.getIcon("question")) |
752 | self.searchBootButton.setEnabled(False) | |
753 | ||
8096 | 754 | self.__mandatoryStyleSheet = ( |
8862
99459beb81b1
Adapted some style sheet usages to observe the palette lightness (dark/light).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8462
diff
changeset
|
755 | "QLineEdit {border: 2px solid; border-color: #dd8888}" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
756 | if ericApp().usesDarkPalette() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
757 | else "QLineEdit {border: 2px solid; border-color: #800000}" |
8096 | 758 | ) |
759 | self.__manualType = "<manual>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
760 | |
8096 | 761 | self.__boardType = boardType |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
762 | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
763 | self.on_refreshButton_clicked() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
764 | |
8096 | 765 | def __populate(self): |
766 | """ | |
767 | Private method to (re-)populate the dialog. | |
768 | """ | |
769 | # save the currently selected device | |
770 | currentDevice = self.devicesComboBox.currentText() | |
771 | firmwareFile = self.firmwarePicker.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
772 | |
8096 | 773 | # clear the entries first |
774 | self.devicesComboBox.clear() | |
775 | self.firmwarePicker.clear() | |
776 | self.bootPicker.clear() | |
777 | self.infoLabel.clear() | |
778 | self.infoEdit.clear() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
779 | |
8096 | 780 | # now populate the entries with data |
781 | devices = getFoundDevices(boardType=self.__boardType) | |
782 | if len(devices) == 0: | |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
783 | # no device set yet |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
784 | devices = [ |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
785 | d |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
786 | for d in Devices.getFoundDevices()[0] |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
787 | if d[0] in SupportedUF2Boards |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
788 | ] |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
789 | self.devicesComboBox.addItem("") |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
790 | self.devicesComboBox.addItem(self.tr("Manual Select")) |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
791 | self.devicesComboBox.setItemData( |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
792 | self.devicesComboBox.count() - 1, self.__manualType, self.DeviceTypeRole |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
793 | ) |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
794 | self.on_devicesComboBox_currentIndexChanged(0) |
8096 | 795 | if devices: |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
796 | self.__showSpecificInstructions(devices) |
8096 | 797 | else: |
798 | self.__showAllInstructions() | |
799 | elif len(devices) == 1: | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
800 | # 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
|
801 | self.__boardType = devices[0][0] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
802 | |
8096 | 803 | self.devicesComboBox.addItem(devices[0][1]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
804 | self.devicesComboBox.setItemData(0, devices[0][0], self.DeviceTypeRole) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
805 | self.devicesComboBox.setItemData(0, devices[0][2], self.DeviceVidPidRole) |
8096 | 806 | self.devicesComboBox.addItem(self.tr("Manual Select")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
807 | self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole) |
8096 | 808 | self.on_devicesComboBox_currentIndexChanged(0) |
809 | else: | |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
810 | for index, (boardType, description, vidpid) in enumerate(sorted(devices)): |
8096 | 811 | self.devicesComboBox.addItem(description) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
812 | self.devicesComboBox.setItemData(index, boardType, self.DeviceTypeRole) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
813 | self.devicesComboBox.setItemData(index, vidpid, self.DeviceVidPidRole) |
8096 | 814 | self.devicesComboBox.addItem(self.tr("Manual Select")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
815 | self.devicesComboBox.setItemData( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
816 | index + 1, self.__manualType, self.DeviceTypeRole |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
817 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
818 | |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
819 | # select the remembered device, if it is still there |
8096 | 820 | if currentDevice: |
821 | self.devicesComboBox.setCurrentText(currentDevice) | |
9954 | 822 | if self.devicesComboBox.currentIndex() == -1 and len(devices) == 1: |
823 | # the device name has changed but only one is present; select it | |
824 | self.devicesComboBox.setCurrentIndex(0) | |
8096 | 825 | self.firmwarePicker.setText(firmwareFile) |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
826 | elif len(devices) == 1: |
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
827 | self.devicesComboBox.setCurrentIndex(0) |
8096 | 828 | else: |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
829 | self.devicesComboBox.setCurrentIndex(-1) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
830 | |
8096 | 831 | def __updateFlashButton(self): |
832 | """ | |
833 | Private method to update the state of the Flash button and the retest | |
834 | button. | |
835 | """ | |
836 | firmwareFile = self.firmwarePicker.text() | |
837 | if self.devicesComboBox.currentData(self.DeviceTypeRole) is not None: | |
838 | if bool(firmwareFile) and os.path.exists(firmwareFile): | |
839 | self.firmwarePicker.setStyleSheet("") | |
840 | else: | |
841 | self.firmwarePicker.setStyleSheet(self.__mandatoryStyleSheet) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
842 | |
8096 | 843 | if bool(self.bootPicker.text()): |
844 | self.bootPicker.setStyleSheet("") | |
845 | else: | |
846 | self.bootPicker.setStyleSheet(self.__mandatoryStyleSheet) | |
847 | else: | |
848 | self.firmwarePicker.setStyleSheet("") | |
849 | self.bootPicker.setStyleSheet("") | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
850 | |
8096 | 851 | enable = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
852 | bool(self.bootPicker.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
853 | and bool(firmwareFile) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
854 | and os.path.exists(firmwareFile) |
8096 | 855 | ) |
856 | self.flashButton.setEnabled(enable) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
857 | |
8096 | 858 | def __showAllInstructions(self): |
859 | """ | |
860 | Private method to show instructions for resetting devices to bootloader | |
861 | mode. | |
862 | """ | |
863 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
864 | |
8096 | 865 | htmlText = self.tr( |
866 | "<h4>No known devices detected.</h4>" | |
867 | "<p>Follow the appropriate instructions below to set <b>one</b>" | |
868 | " board into 'bootloader' mode. Press <b>Refresh</b> when ready." | |
869 | "</p>" | |
870 | ) | |
871 | 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
|
872 | if SupportedUF2Boards[boardType]["show_all"]: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
873 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
8096 | 874 | self.infoEdit.setHtml(htmlText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
875 | |
8096 | 876 | def __showSpecificInstructions(self, devices): |
877 | """ | |
878 | Private method to show instructions for resetting devices to bootloader | |
879 | mode for a list of detected devices. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
880 | |
8096 | 881 | @param devices list of detected devices |
882 | @type list of str | |
883 | """ | |
8099
522946e53835
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8097
diff
changeset
|
884 | boardTypes = {x[0] for x in devices} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
885 | |
8096 | 886 | self.infoLabel.setText(self.tr("Reset Instructions:")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
887 | |
8096 | 888 | if self.__boardType: |
889 | htmlText = self.tr( | |
890 | "<h4>Flash {0} Firmware</h4>" | |
891 | "<p>Follow the instructions below to set <b>one</b> board into" | |
892 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
893 | "<hr/>{1}" | |
894 | ).format( | |
895 | SupportedUF2Boards[self.__boardType]["firmware"], | |
896 | SupportedUF2Boards[self.__boardType]["instructions"], | |
897 | ) | |
898 | else: | |
899 | htmlText = self.tr( | |
900 | "<h4>Potentially UF2 capable devices found</h4>" | |
901 | "<p>Found these potentially UF2 capable devices:</p>" | |
902 | "<ul><li>{0}</li></ul>" | |
903 | "<p>Follow the instructions below to set <b>one</b> board into" | |
904 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
905 | ).format("</li><li>".join(sorted(x[1] for x in devices))) |
8096 | 906 | for boardType in sorted(boardTypes): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
907 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
8096 | 908 | self.infoEdit.setHtml(htmlText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
909 | |
8096 | 910 | def __showTypedInstructions(self, boardType): |
911 | """ | |
912 | Private method to show instructions for resetting devices to bootloader | |
913 | mode for a specific board type. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
914 | |
8096 | 915 | @param boardType type of the board to show instructions for |
916 | @type str | |
917 | """ | |
918 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
919 | |
8096 | 920 | htmlText = self.tr( |
921 | "<h4>No known devices detected.</h4>" | |
922 | "<p>Follow the instructions below to set <b>one</b> board into" | |
923 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
924 | ) | |
925 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
926 | self.infoEdit.setHtml(htmlText) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
927 | |
8096 | 928 | def __showManualInstructions(self): |
929 | """ | |
930 | Private method to show instructions for flashing devices manually. | |
931 | """ | |
932 | self.infoLabel.setText(self.tr("Flash Instructions:")) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
933 | |
8096 | 934 | htmlText = self.tr( |
935 | "<h4>Flash method 'manual' selected.</h4>" | |
936 | "<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
|
937 | " the data manually.</p><ol>" |
8096 | 938 | "<li>Change the device to 'bootloader' mode.</li>" |
939 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
940 | "<li>Ensure the boot volume is available (this may require" | |
941 | " mounting it) and select its path.</li>" | |
942 | "<li>Select the firmware file to be flashed and click the" | |
943 | " flash button.</li>" | |
944 | "</ol>" | |
945 | ) | |
946 | for boardType in SupportedUF2Boards: | |
947 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
948 | self.infoEdit.setHtml(htmlText) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
949 | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
950 | def __showNoVolumeInformation(self, volumes, boardType): |
8096 | 951 | """ |
952 | Private method to show information about the expected boot volume(s). | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
953 | |
8096 | 954 | @param volumes list of expected volume names |
955 | @type list of str | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
956 | @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
|
957 | @type str |
8096 | 958 | """ |
959 | self.infoLabel.setText(self.tr("Boot Volume not found:")) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
960 | |
8096 | 961 | htmlText = self.tr( |
962 | "<h4>No Boot Volume detected.</h4>" | |
963 | "<p>Please ensure that the boot volume of the device to be flashed" | |
964 | " is available. " | |
965 | ) | |
966 | if len(volumes) == 1: | |
967 | htmlText += self.tr( | |
968 | "This volume should be named <b>{0}</b>." | |
969 | " Press <b>Refresh</b> when ready.</p>" | |
970 | ).format(volumes[0]) | |
971 | else: | |
972 | htmlText += self.tr( | |
973 | "This volume should have one of these names.</p>" | |
974 | "<ul><li>{0}</li></ul>" | |
975 | "<p>Press <b>Refresh</b> when ready.</p>" | |
976 | ).format("</li><li>".join(sorted(volumes))) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
977 | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
978 | if boardType: |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
979 | htmlText += self.tr( |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
980 | "<h4>Reset Instructions</h4>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
981 | "<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
|
982 | " '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
|
983 | ) |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
984 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
985 | |
8096 | 986 | self.infoEdit.setHtml(htmlText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
987 | |
8096 | 988 | def __showMultipleVolumesInformation(self, volumePaths): |
989 | """ | |
990 | Private method to show information because multiple devices of the | |
991 | same type are ready for flashing. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
992 | |
8096 | 993 | Note: This is a dangerous situation! |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
994 | |
8096 | 995 | @param volumePaths list of volume paths |
996 | @type list of str | |
997 | """ | |
998 | self.infoLabel.setText(self.tr("Multiple Boot Volumes found:")) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
999 | |
8096 | 1000 | htmlText = self.tr( |
1001 | "<h4>Multiple Boot Volumes were found</h4>" | |
1002 | "<p>These volume paths were found.</p><ul><li>{0}</li></ul>" | |
1003 | "<p>Please ensure that only one device of a type is ready for" | |
1004 | " flashing. Press <b>Refresh</b> when ready.</p>" | |
1005 | ).format("</li><li>".join(sorted(volumePaths))) | |
1006 | self.infoEdit.setHtml(htmlText) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1007 | |
8096 | 1008 | @pyqtSlot() |
1009 | def on_flashButton_clicked(self): | |
1010 | """ | |
1011 | Private slot to flash the selected MicroPython or CircuitPython | |
1012 | firmware onto the device. | |
1013 | """ | |
1014 | boardType = self.devicesComboBox.currentData(self.DeviceTypeRole) | |
1015 | firmwarePath = self.firmwarePicker.text() | |
1016 | volumePath = self.bootPicker.text() | |
1017 | 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
|
1018 | if boardType == self.__manualType: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1019 | self.infoLabel.setText(self.tr("Flashing Firmware")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1020 | self.infoEdit.setHtml( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1021 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1022 | "<p>Flashing the selected firmware to the device. Please" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1023 | " wait until the device resets automatically.</p>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1024 | ) |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1025 | ) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1026 | else: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1027 | firmwareType = SupportedUF2Boards[boardType]["firmware"] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1028 | self.infoLabel.setText(self.tr("Flashing {0}").format(firmwareType)) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1029 | self.infoEdit.setHtml( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1030 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1031 | "<p>Flashing the {0} firmware to the device. Please wait" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1032 | " until the device resets automatically.</p>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1033 | ).format(firmwareType) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1034 | ) |
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
|
1035 | QCoreApplication.processEvents( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1036 | QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1037 | ) |
10172 | 1038 | with contextlib.suppress(FileNotFoundError): |
1039 | shutil.copy(firmwarePath, volumePath) | |
8096 | 1040 | QThread.sleep(1) |
1041 | self.on_refreshButton_clicked() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1042 | |
8096 | 1043 | @pyqtSlot() |
1044 | def on_refreshButton_clicked(self): | |
1045 | """ | |
1046 | Private slot to refresh the dialog. | |
1047 | """ | |
1048 | self.__populate() | |
9954 | 1049 | self.__updateFlashButton() |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1050 | self.on_devicesComboBox_currentIndexChanged(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1051 | |
8096 | 1052 | @pyqtSlot(int) |
1053 | def on_devicesComboBox_currentIndexChanged(self, index): | |
1054 | """ | |
1055 | Private slot to handle the selection of a board. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1056 | |
8096 | 1057 | @param index selected index |
1058 | @type int | |
1059 | """ | |
1060 | vidpid = self.devicesComboBox.itemData(index, self.DeviceVidPidRole) | |
1061 | boardType = self.devicesComboBox.itemData(index, self.DeviceTypeRole) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1062 | |
9815 | 1063 | self.searchBootButton.setEnabled(boardType == self.__manualType) |
8096 | 1064 | self.bootPicker.setEnabled(boardType == self.__manualType) |
1065 | if boardType == self.__manualType: | |
1066 | self.__showManualInstructions() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1067 | |
8096 | 1068 | if vidpid is None: |
1069 | if boardType is None: | |
1070 | self.bootPicker.clear() | |
1071 | else: | |
1072 | volumes = SupportedUF2Boards[boardType]["volumes"][vidpid] | |
1073 | foundVolumes = [] | |
9903 | 1074 | for volume, _ in volumes: |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9614
diff
changeset
|
1075 | foundVolumes += FileSystemUtilities.findVolume(volume, findAll=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1076 | |
8096 | 1077 | if len(foundVolumes) == 0: |
9903 | 1078 | self.__showNoVolumeInformation([v[0] for v in volumes], boardType) |
8096 | 1079 | self.bootPicker.clear() |
1080 | elif len(foundVolumes) == 1: | |
1081 | self.bootPicker.setText(foundVolumes[0]) | |
1082 | else: | |
9954 | 1083 | self.__showMultipleVolumesInformation(foundVolumes) |
8096 | 1084 | self.bootPicker.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1085 | |
8096 | 1086 | self.__updateFlashButton() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1087 | |
8096 | 1088 | @pyqtSlot(str) |
1089 | def on_firmwarePicker_textChanged(self, text): | |
1090 | """ | |
1091 | Private slot handling a change of the firmware file. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1092 | |
8096 | 1093 | @param text current text of the firmware edit |
1094 | @type str | |
1095 | """ | |
1096 | self.__updateFlashButton() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1097 | |
8096 | 1098 | @pyqtSlot(str) |
1099 | def on_bootPicker_textChanged(self, text): | |
1100 | """ | |
1101 | Private slot handling a change of the boot volume. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1102 | |
8096 | 1103 | @param text current text of the boot volume edit |
1104 | @type str | |
1105 | """ | |
1106 | self.__updateFlashButton() | |
9815 | 1107 | |
1108 | @pyqtSlot() | |
1109 | def on_searchBootButton_clicked(self): | |
1110 | """ | |
1111 | Private slot to look for all known boot paths and present a list to select from. | |
1112 | """ | |
1113 | foundBootVolumes = set() | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1114 | if not OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1115 | userMounts = FileSystemUtilities.getUserMounts() |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1116 | |
9815 | 1117 | for boardType in SupportedUF2Boards: |
1118 | for volumes in SupportedUF2Boards[boardType]["volumes"].values(): | |
9903 | 1119 | for volume, _ in volumes: |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1120 | if OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1121 | foundBootVolumes.update( |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1122 | FileSystemUtilities.findVolume(volume, findAll=True) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1123 | ) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1124 | else: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1125 | # check only user mounted devices on non-Windows systems |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1126 | for userMount in userMounts: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1127 | if os.path.basename(userMount).startswith(volume): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1128 | foundBootVolumes.add(userMount) |
9815 | 1129 | |
1130 | if len(foundBootVolumes) == 0: | |
1131 | selectedVolume = "" | |
9903 | 1132 | EricMessageBox.information( |
1133 | self, | |
1134 | self.tr("Flash UF2 Device"), | |
1135 | self.tr("""No UF2 device 'boot' volumes found."""), | |
1136 | ) | |
9815 | 1137 | elif len(foundBootVolumes) == 1: |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
1138 | selectedVolume = [*foundBootVolumes][0] |
9815 | 1139 | else: |
1140 | result, ok = QInputDialog.getItem( | |
9903 | 1141 | self, |
9815 | 1142 | QCoreApplication.translate("UF2FlashDialog", "Flash UF2 Device"), |
1143 | QCoreApplication.translate( | |
1144 | "UF2FlashDialog", "Select the Boot Volume of the device:" | |
1145 | ), | |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
1146 | [*foundBootVolumes], |
9821
6b1b06d74532
Fixed some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9815
diff
changeset
|
1147 | 0, |
6b1b06d74532
Fixed some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9815
diff
changeset
|
1148 | True, |
9815 | 1149 | ) |
1150 | selectedVolume = result if ok else "" | |
1151 | ||
1152 | self.bootPicker.setText(selectedVolume) |