src/eric7/MicroPython/Devices/CircuitPythonDevices.py

branch
eric7
changeset 10806
2f6df822e3b9
parent 10683
779cda568acb
child 11005
b918c6c2736b
equal deleted inserted replaced
10805:c114e9476034 10806:2f6df822e3b9
15 15
16 from PyQt6.QtCore import QUrl, pyqtSlot 16 from PyQt6.QtCore import QUrl, pyqtSlot
17 from PyQt6.QtNetwork import QNetworkReply, QNetworkRequest 17 from PyQt6.QtNetwork import QNetworkReply, QNetworkRequest
18 from PyQt6.QtWidgets import QInputDialog, QMenu 18 from PyQt6.QtWidgets import QInputDialog, QMenu
19 19
20 from eric7 import Globals, Preferences 20 from eric7 import EricUtilities, Preferences
21 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor, EricOverridenCursor 21 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor, EricOverridenCursor
22 from eric7.EricWidgets import EricFileDialog, EricMessageBox 22 from eric7.EricWidgets import EricFileDialog, EricMessageBox
23 from eric7.EricWidgets.EricApplication import ericApp 23 from eric7.EricWidgets.EricApplication import ericApp
24 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities 24 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities
25 25
589 @param reply reference to the reply object 589 @param reply reference to the reply object
590 @type QNetworkReply 590 @type QNetworkReply
591 """ 591 """
592 latestUrl = reply.url().toString() 592 latestUrl = reply.url().toString()
593 tag = latestUrl.rsplit("/", 1)[-1] 593 tag = latestUrl.rsplit("/", 1)[-1]
594 latestVersion = Globals.versionToTuple(tag) 594 latestVersion = EricUtilities.versionToTuple(tag)
595 595
596 cpyVersionStr = self.tr("unknown") 596 cpyVersionStr = self.tr("unknown")
597 cpyVersion = (0, 0, 0) 597 cpyVersion = (0, 0, 0)
598 if self.supportsLocalFileAccess(): 598 if self.supportsLocalFileAccess():
599 bootFile = os.path.join(self.getWorkspace(), "boot_out.txt") 599 bootFile = os.path.join(self.getWorkspace(), "boot_out.txt")
600 if os.path.exists(bootFile): 600 if os.path.exists(bootFile):
601 with open(bootFile, "r") as f: 601 with open(bootFile, "r") as f:
602 line = f.readline() 602 line = f.readline()
603 cpyVersionStr = line.split(";")[0].split()[2] 603 cpyVersionStr = line.split(";")[0].split()[2]
604 cpyVersion = Globals.versionToTuple(cpyVersionStr) 604 cpyVersion = EricUtilities.versionToTuple(cpyVersionStr)
605 if ( 605 if (
606 cpyVersion == (0, 0, 0) 606 cpyVersion == (0, 0, 0)
607 and self._deviceData 607 and self._deviceData
608 and self._deviceData["mpy_version"] != "unknown" 608 and self._deviceData["mpy_version"] != "unknown"
609 ): 609 ):
610 # drive is not mounted or 'boot_out.txt' is missing but the device 610 # drive is not mounted or 'boot_out.txt' is missing but the device
611 # is connected via the serial console 611 # is connected via the serial console
612 cpyVersionStr = self._deviceData["mpy_version"] 612 cpyVersionStr = self._deviceData["mpy_version"]
613 cpyVersion = Globals.versionToTuple(cpyVersionStr) 613 cpyVersion = EricUtilities.versionToTuple(cpyVersionStr)
614 614
615 msg = self.tr( 615 msg = self.tr(
616 "<h4>CircuitPython Version Information</h4>" 616 "<h4>CircuitPython Version Information</h4>"
617 "<table>" 617 "<table>"
618 "<tr><td>Installed:</td><td>{0}</td></tr>" 618 "<tr><td>Installed:</td><td>{0}</td></tr>"
1013 if not self.__deviceVolumeMounted(): 1013 if not self.__deviceVolumeMounted():
1014 return False, self.tr("The device volume is not available.") 1014 return False, self.tr("The device volume is not available.")
1015 1015
1016 workspace = self.getWorkspace() 1016 workspace = self.getWorkspace()
1017 1017
1018 if Globals.versionToTuple(self._deviceData["release"]) >= (8, 0, 0): 1018 if EricUtilities.versionToTuple(self._deviceData["release"]) >= (8, 0, 0):
1019 # CircuitPython >= 8.0.0: generate 'settings.toml' file 1019 # CircuitPython >= 8.0.0: generate 'settings.toml' file
1020 contents = ( 1020 contents = (
1021 'CIRCUITPY_WIFI_SSID = "{0}"\nCIRCUITPY_WIFI_PASSWORD = "{1}"\n' 1021 'CIRCUITPY_WIFI_SSID = "{0}"\nCIRCUITPY_WIFI_PASSWORD = "{1}"\n'
1022 'CIRCUITPY_WIFI_HOSTNAME = "{2}"\n'.format(ssid, password, hostname) 1022 'CIRCUITPY_WIFI_HOSTNAME = "{2}"\n'.format(ssid, password, hostname)
1023 ) 1023 )
1583 if not self.__deviceVolumeMounted(): 1583 if not self.__deviceVolumeMounted():
1584 return False, self.tr("The device volume is not available.") 1584 return False, self.tr("The device volume is not available.")
1585 1585
1586 workspace = self.getWorkspace() 1586 workspace = self.getWorkspace()
1587 1587
1588 if Globals.versionToTuple(self._deviceData["release"]) >= (8, 0, 0): 1588 if EricUtilities.versionToTuple(self._deviceData["release"]) >= (8, 0, 0):
1589 # CircuitPython >= 8.0.0: generate 'settings.toml' file 1589 # CircuitPython >= 8.0.0: generate 'settings.toml' file
1590 newConfig = ( 1590 newConfig = (
1591 { 1591 {
1592 "WIZNET_IFCONFIG_0": '"dhcp"', 1592 "WIZNET_IFCONFIG_0": '"dhcp"',
1593 "WIZNET_IFCONFIG_1": "", 1593 "WIZNET_IFCONFIG_1": "",
1662 if not self.__deviceVolumeMounted(): 1662 if not self.__deviceVolumeMounted():
1663 return False, self.tr("The device volume is not available.") 1663 return False, self.tr("The device volume is not available.")
1664 1664
1665 workspace = self.getWorkspace() 1665 workspace = self.getWorkspace()
1666 1666
1667 if Globals.versionToTuple(self._deviceData["release"]) >= (8, 0, 0): 1667 if EricUtilities.versionToTuple(self._deviceData["release"]) >= (8, 0, 0):
1668 # CircuitPython >= 8.0.0: generate 'settings.toml' file 1668 # CircuitPython >= 8.0.0: generate 'settings.toml' file
1669 newConfig = { 1669 newConfig = {
1670 "WIZNET_IFCONFIG_0": "", 1670 "WIZNET_IFCONFIG_0": "",
1671 "WIZNET_IFCONFIG_1": "", 1671 "WIZNET_IFCONFIG_1": "",
1672 "WIZNET_IFCONFIG_2": "", 1672 "WIZNET_IFCONFIG_2": "",

eric ide

mercurial