21 |
21 |
22 from .CircuitPythonUpdater.CircuitPythonUpdaterInterface import ( |
22 from .CircuitPythonUpdater.CircuitPythonUpdaterInterface import ( |
23 CircuitPythonUpdaterInterface, |
23 CircuitPythonUpdaterInterface, |
24 isCircupAvailable, |
24 isCircupAvailable, |
25 ) |
25 ) |
26 from .MicroPythonDevices import MicroPythonDevice |
26 from .MicroPythonDevices import FirmwareGithubUrls, MicroPythonDevice |
27 from .MicroPythonWidget import HAS_QTCHART |
27 from .MicroPythonWidget import HAS_QTCHART |
28 |
28 |
29 |
29 |
30 class CircuitPythonDevice(MicroPythonDevice): |
30 class CircuitPythonDevice(MicroPythonDevice): |
31 """ |
31 """ |
32 Class implementing the device for CircuitPython boards. |
32 Class implementing the device for CircuitPython boards. |
33 """ |
33 """ |
34 |
34 |
35 DeviceVolumeName = "CIRCUITPY" |
35 DeviceVolumeName = "CIRCUITPY" |
36 GitHubFirmwareUrl = "https://github.com/adafruit/circuitpython/releases/latest" |
|
37 |
36 |
38 def __init__(self, microPythonWidget, deviceType, boardName, parent=None): |
37 def __init__(self, microPythonWidget, deviceType, boardName, parent=None): |
39 """ |
38 """ |
40 Constructor |
39 Constructor |
41 |
40 |
252 |
251 |
253 self.__libraryMenu = QMenu(self.tr("Library Management")) |
252 self.__libraryMenu = QMenu(self.tr("Library Management")) |
254 self.__libraryMenu.aboutToShow.connect(self.__aboutToShowLibraryMenu) |
253 self.__libraryMenu.aboutToShow.connect(self.__aboutToShowLibraryMenu) |
255 self.__libraryMenu.setTearOffEnabled(True) |
254 self.__libraryMenu.setTearOffEnabled(True) |
256 |
255 |
257 act = menu.addAction( |
256 menu.addAction( |
258 self.tr("Show CircuitPython Versions"), self.__showCircuitPythonVersions |
257 self.tr("Show CircuitPython Versions"), self.__showCircuitPythonVersions |
259 ) |
258 ) |
260 act = menu.addAction( |
259 act = menu.addAction( |
261 self.tr("Flash CircuitPython Firmware"), self.__flashCircuitPython |
260 self.tr("Flash CircuitPython Firmware"), self.__flashCircuitPython |
262 ) |
261 ) |
338 """ |
337 """ |
339 Private slot to show the CircuitPython version of a connected device and |
338 Private slot to show the CircuitPython version of a connected device and |
340 the latest available one (from Github). |
339 the latest available one (from Github). |
341 """ |
340 """ |
342 ui = ericApp().getObject("UserInterface") |
341 ui = ericApp().getObject("UserInterface") |
343 request = QNetworkRequest(QUrl(CircuitPythonDevice.GitHubFirmwareUrl)) |
342 request = QNetworkRequest(QUrl(FirmwareGithubUrls["circuitpython"])) |
344 reply = ui.networkAccessManager().head(request) |
343 reply = ui.networkAccessManager().head(request) |
345 reply.finished.connect(lambda: self.__cpyVersionResponse(reply)) |
344 reply.finished.connect(lambda: self.__cpyVersionResponse(reply)) |
346 |
345 |
347 def __cpyVersionResponse(self, reply): |
346 def __cpyVersionResponse(self, reply): |
348 """ |
347 """ |