src/eric7/MicroPython/Devices/Nrf52Devices.py

branch
eric7
changeset 11221
6c05da6f8b0e
parent 11208
f776db7cc222
equal deleted inserted replaced
11220:044ea8893b81 11221:6c05da6f8b0e
211 """ determined or the board does not run MicroPython.""" 211 """ determined or the board does not run MicroPython."""
212 """ Aborting...""" 212 """ Aborting..."""
213 ), 213 ),
214 ) 214 )
215 else: 215 else:
216 if self._deviceData["mpy_variant"] == "Pimoroni Pico": 216 url = QUrl(FirmwareGithubUrls["micropython"])
217 # MicroPython with Pimoroni add-on libraries
218 url = QUrl(FirmwareGithubUrls["pimoroni_pico"])
219 else:
220 url = QUrl(FirmwareGithubUrls["micropython"])
221 ui = ericApp().getObject("UserInterface") 217 ui = ericApp().getObject("UserInterface")
222 request = QNetworkRequest(url) 218 request = QNetworkRequest(url)
223 reply = ui.networkAccessManager().head(request) 219 reply = ui.networkAccessManager().head(request)
224 reply.finished.connect(lambda: self.__firmwareVersionResponse(reply)) 220 reply.finished.connect(lambda: self.__firmwareVersionResponse(reply))
225 221
240 236
241 if self._deviceData["mpy_version"] == "unknown": 237 if self._deviceData["mpy_version"] == "unknown":
242 currentVersionStr = self.tr("unknown") 238 currentVersionStr = self.tr("unknown")
243 currentVersion = (0, 0, 0) 239 currentVersion = (0, 0, 0)
244 else: 240 else:
245 currentVersionStr = ( 241 currentVersionStr = self._deviceData["mpy_version"]
246 self._deviceData["mpy_variant_version"]
247 if bool(self._deviceData["mpy_variant_version"])
248 else self._deviceData["mpy_version"]
249 )
250 currentVersion = EricUtilities.versionToTuple(currentVersionStr) 242 currentVersion = EricUtilities.versionToTuple(currentVersionStr)
251 243
252 msg = self.tr( 244 msg = self.tr(
253 "<h4>MicroPython Version Information</h4>" 245 "<h4>MicroPython Version Information</h4>"
254 "<table>" 246 "<table>"
257 "{2}" 249 "{2}"
258 "</table>" 250 "</table>"
259 ).format( 251 ).format(
260 currentVersionStr, 252 currentVersionStr,
261 tag, 253 tag,
262 ( 254 "",
263 self.tr("<tr><td>Variant:</td><td>{0}</td></tr>").format( 255 )
264 self._deviceData["mpy_variant"] 256 if currentVersion < latestVersion:
265 )
266 if self._deviceData["mpy_variant"]
267 else ""
268 ),
269 )
270 if self._deviceData["mpy_variant"] in ["Pimoroni Pico"] and not bool(
271 self._deviceData["mpy_variant_version"]
272 ):
273 # cannot derive update info
274 msg += self.tr("<p>Update may be available.</p>")
275 elif currentVersion < latestVersion:
276 msg += self.tr("<p><b>Update available!</b></p>") 257 msg += self.tr("<p><b>Update available!</b></p>")
277 258
278 EricMessageBox.information( 259 EricMessageBox.information(
279 self.microPython, 260 self.microPython,
280 self.tr("MicroPython Version"), 261 self.tr("MicroPython Version"),

eric ide

mercurial