eric6/MicroPython/CircuitPythonFirmwareSelectionDialog.py

branch
maintenance
changeset 7607
dd1054be15aa
parent 7597
9dac5ef0126d
child 7780
41420f82c0ac
equal deleted inserted replaced
7569:707442ffadc3 7607:dd1054be15aa
46 self.tr("CircuitPython Firmware Files (*.uf2);;" 46 self.tr("CircuitPython Firmware Files (*.uf2);;"
47 "All Files (*)")) 47 "All Files (*)"))
48 48
49 self.bootPicker.setMode(E5PathPickerModes.DirectoryShowFilesMode) 49 self.bootPicker.setMode(E5PathPickerModes.DirectoryShowFilesMode)
50 50
51 self.__manualMarker = "<manual>"
51 boards = ( 52 boards = (
52 ("", ""), # indicator for no selection 53 ("", ""), # indicator for no selection
53 54
55 # Adafruit boards
56 ("--- Adafruit ---", ""),
57 ("CLUE nRF52840 Express", "CLUEBOOT"),
58 ("Circuit Playground Bluefruit", "CPLAYBTBOOT"),
54 ("Circuit Playground Express", "CPLAYBOOT"), 59 ("Circuit Playground Express", "CPLAYBOOT"),
60 ("Feather Bluefruit Sense", "FTHR840BOOT"),
61 ("Feather M0 Adalogger", "FEATHERBOOT"),
62 ("Feather M0 Basic", "FEATHERBOOT"),
55 ("Feather M0 Express", "FEATHERBOOT"), 63 ("Feather M0 Express", "FEATHERBOOT"),
64 ("Feather M0 RFM69", "FEATHERBOOT"),
65 ("Feather M0 RFM9x", "FEATHERBOOT"),
56 ("Feather M4 Express", "FEATHERBOOT"), 66 ("Feather M4 Express", "FEATHERBOOT"),
67 ("Feather nRF52840 Express", "FTHR840BOOT"),
57 ("Gemma M0", "GEMMABOOT"), 68 ("Gemma M0", "GEMMABOOT"),
58 ("Grand Central M4 Express", "GCM4BOOT"), 69 ("Grand Central M4 Express", "GCM4BOOT"),
70 ("Hallowing M4 Express", "HALLOM4BOOT"),
59 ("ItsyBitsy M0 Express", "ITSYBOOT"), 71 ("ItsyBitsy M0 Express", "ITSYBOOT"),
60 ("ItsyBitsy M4 Express", "ITSYM4BOOT"), 72 ("ItsyBitsy M4 Express", "ITSYM4BOOT"),
73 ("ItsyBitsy nRF52840 Express", " ITSY840BOOT"),
61 ("Metro M0 Express", "METROBOOT"), 74 ("Metro M0 Express", "METROBOOT"),
62 ("Metro M4 Express", "METROM4BOOT"), 75 ("Metro M4 Express", "METROM4BOOT"),
76 ("Metro M4 Express AirLift", "METROM4BOOT"),
63 ("NeoTrelis M4 Express", "TRELM4BOOT"), 77 ("NeoTrelis M4 Express", "TRELM4BOOT"),
78 ("PyBadge", "BADGEBOOT"),
79 ("PyGamer", "PYGAMERBOOT"),
80 ("PyPortal", "PORTALBOOT"),
81 ("PyPortal Pynt", "PORTALBOOT"),
82 ("PyPortal Titano", "PORTALBOOT"),
83 ("PyRuler", "TRINKETBOOT"),
64 ("Trinket M0", "TRINKETBOOT"), 84 ("Trinket M0", "TRINKETBOOT"),
65 85
66 ("Manual Select", "<manual>"), 86 # SparkFun boards
87 ("--- SparkFun ---", ""),
88 ("Qwiic Micro", "QwiicMicro"),
89 ("SAMD51 Thing Plus", "51THINGBOOT"),
90 ("RedBoard Turbo", "TURBOBOOT"),
91 ("Pro nRF52840 Mini", "NRF52BOOT"),
92
93 (self.tr("Manual Select"), self.__manualMarker),
67 ) 94 )
68 for boardName, bootVolume in boards: 95 for boardName, bootVolume in boards:
69 self.boardComboBox.addItem(boardName, bootVolume) 96 self.boardComboBox.addItem(boardName, bootVolume)
70 97
71 msh = self.minimumSizeHint() 98 msh = self.minimumSizeHint()
82 109
83 if not bool(firmwareFile) or not os.path.exists(firmwareFile): 110 if not bool(firmwareFile) or not os.path.exists(firmwareFile):
84 enable = False 111 enable = False
85 else: 112 else:
86 volumeName = self.boardComboBox.currentData() 113 volumeName = self.boardComboBox.currentData()
87 if volumeName and volumeName != "<manual>": 114 if volumeName and volumeName != self.__manualMarker:
88 # check if the user selected a board and the board is in 115 # check if the user selected a board and the board is in
89 # bootloader mode 116 # bootloader mode
90 deviceDirectory = Utilities.findVolume(volumeName) 117 deviceDirectory = Utilities.findVolume(volumeName)
91 if deviceDirectory: 118 if deviceDirectory:
92 self.bootPicker.setText(deviceDirectory) 119 self.bootPicker.setText(deviceDirectory)
102 """ select the "Manual Select" entry and""" 129 """ select the "Manual Select" entry and"""
103 """ enter the path to the device below.</p>""") 130 """ enter the path to the device below.</p>""")
104 .format(volumeName) 131 .format(volumeName)
105 ) 132 )
106 133
107 elif volumeName == "<manual>": 134 elif volumeName == self.__manualMarker:
108 # select the device path manually 135 # select the device path manually
109 deviceDirectory = self.bootPicker.text() 136 deviceDirectory = self.bootPicker.text()
110 enable = (bool(deviceDirectory) and 137 enable = (bool(deviceDirectory) and
111 os.path.exists(deviceDirectory)) 138 os.path.exists(deviceDirectory))
112 139
132 Private slot to handle the selection of a board type. 159 Private slot to handle the selection of a board type.
133 160
134 @param index index of the selected board type 161 @param index index of the selected board type
135 @type int 162 @type int
136 """ 163 """
137 if self.boardComboBox.itemData(index) == "<manual>": 164 if self.boardComboBox.itemData(index) == self.__manualMarker:
138 self.bootPicker.clear() 165 self.bootPicker.clear()
139 self.bootPicker.setEnabled(True) 166 self.bootPicker.setEnabled(True)
140 else: 167 else:
141 self.bootPicker.setEnabled(False) 168 self.bootPicker.setEnabled(False)
142 169

eric ide

mercurial