12 import binascii |
12 import binascii |
13 import json |
13 import json |
14 import os |
14 import os |
15 |
15 |
16 from PyQt6.QtCore import QUrl, pyqtSlot |
16 from PyQt6.QtCore import QUrl, pyqtSlot |
17 from PyQt6.QtNetwork import QNetworkRequest |
17 from PyQt6.QtNetwork import QNetworkReply, QNetworkRequest |
18 from PyQt6.QtWidgets import QDialog, QMenu |
18 from PyQt6.QtWidgets import QDialog, QMenu |
19 |
19 |
20 from eric7 import Globals, Preferences |
20 from eric7 import Globals, Preferences |
21 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor |
21 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor |
22 from eric7.EricWidgets import EricMessageBox |
22 from eric7.EricWidgets import EricMessageBox |
201 from ..UF2FlashDialog import UF2FlashDialog |
201 from ..UF2FlashDialog import UF2FlashDialog |
202 |
202 |
203 dlg = UF2FlashDialog(boardType="rp2040") |
203 dlg = UF2FlashDialog(boardType="rp2040") |
204 dlg.exec() |
204 dlg.exec() |
205 |
205 |
|
206 @pyqtSlot() |
206 def __activateBootloader(self): |
207 def __activateBootloader(self): |
207 """ |
208 """ |
208 Private method to switch the board into 'bootloader' mode. |
209 Private slot to switch the board into 'bootloader' mode. |
209 """ |
210 """ |
210 if self.microPython.isConnected(): |
211 if self.microPython.isConnected(): |
211 self.microPython.deviceInterface().execute( |
212 self.microPython.deviceInterface().execute( |
212 [ |
213 [ |
213 "import machine", |
214 "import machine", |
243 ui = ericApp().getObject("UserInterface") |
244 ui = ericApp().getObject("UserInterface") |
244 request = QNetworkRequest(url) |
245 request = QNetworkRequest(url) |
245 reply = ui.networkAccessManager().head(request) |
246 reply = ui.networkAccessManager().head(request) |
246 reply.finished.connect(lambda: self.__firmwareVersionResponse(reply)) |
247 reply.finished.connect(lambda: self.__firmwareVersionResponse(reply)) |
247 |
248 |
|
249 @pyqtSlot(QNetworkReply) |
248 def __firmwareVersionResponse(self, reply): |
250 def __firmwareVersionResponse(self, reply): |
249 """ |
251 """ |
250 Private method handling the response of the latest version request. |
252 Private slot handling the response of the latest version request. |
251 |
253 |
252 @param reply reference to the reply object |
254 @param reply reference to the reply object |
253 @type QNetworkReply |
255 @type QNetworkReply |
254 """ |
256 """ |
255 latestUrl = reply.url().toString() |
257 latestUrl = reply.url().toString() |