eric6/MicroPython/CircuitPythonDevices.py

changeset 8096
5425a9072300
parent 8072
58491f4c99d6
child 8117
aaa5e0eacd4e
equal deleted inserted replaced
8095:d8caff84ffcf 8096:5425a9072300
212 menu.addSeparator() 212 menu.addSeparator()
213 act = menu.addAction(self.tr("Install Library Files"), 213 act = menu.addAction(self.tr("Install Library Files"),
214 self.__installLibraryFiles) 214 self.__installLibraryFiles)
215 act.setEnabled(self.__deviceVolumeMounted()) 215 act.setEnabled(self.__deviceVolumeMounted())
216 216
217 def hasFlashMenuEntry(self):
218 """
219 Public method to check, if the device has its own flash menu entry.
220
221 @return flag indicating a specific flash menu entry
222 @rtype bool
223 """
224 return True
225
217 @pyqtSlot() 226 @pyqtSlot()
218 def __flashCircuitPython(self): 227 def __flashCircuitPython(self):
219 """ 228 """
220 Private slot to flash a CircuitPython firmware to the device. 229 Private slot to flash a CircuitPython firmware to the device.
221 """ 230 """
224 for name in self.__nonUF2devices: 233 for name in self.__nonUF2devices:
225 if name in lBoardName: 234 if name in lBoardName:
226 self.__nonUF2devices[name]() 235 self.__nonUF2devices[name]()
227 break 236 break
228 else: 237 else:
229 button = E5MessageBox.information( 238 from .UF2FlashDialog import UF2FlashDialog
230 self.microPython, 239 dlg = UF2FlashDialog(boardType="circuitpython")
231 self.tr("Flash CircuitPython Firmware"), 240 dlg.exec()
232 self.tr("Please reset the device to bootloader mode and"
233 " confirm when ready."),
234 E5MessageBox.StandardButtons(
235 E5MessageBox.Abort |
236 E5MessageBox.Ok))
237 if button == E5MessageBox.Ok:
238 from .CircuitPythonFirmwareSelectionDialog import (
239 CircuitPythonFirmwareSelectionDialog)
240 dlg = CircuitPythonFirmwareSelectionDialog()
241 if dlg.exec() == QDialog.Accepted:
242 cpyPath, devicePath = dlg.getData()
243 shutil.copy2(cpyPath, devicePath)
244 241
245 def __flashTeensy(self): 242 def __flashTeensy(self):
246 """ 243 """
247 Private method to show a message box because Teens does not support 244 Private method to show a message box because Teens does not support
248 the UF2 bootloader yet. 245 the UF2 bootloader yet.

eric ide

mercurial