Wed, 22 Feb 2023 08:20:34 +0100
Corrected some code style and formatting issues.
--- a/eric7.epj Wed Feb 22 07:48:57 2023 +0100 +++ b/eric7.epj Wed Feb 22 08:20:34 2023 +0100 @@ -982,7 +982,7 @@ "OTHERTOOLSPARMS": { "Black": { "exclude": "/(\\.direnv|\\.eggs|\\.git|\\.hg|\\.mypy_cache|\\.nox|\\.tox|\\.venv|venv|\\.svn|\\.ipynb_checkpoints|_build|buck-out|build|dist|__pypackages__)/", - "extend-exclude": "/(\n\tExamples/\n\t| ThirdParty/\n\t| coverage/\n\t| Ui_.*\\.py\n\t| pycodestyle\\.py\n\t| pyflakes/checker\\.py\n\t| mccabe\\.py\n\t| eradicate\\.py\n\t| ast_unparse\\.py\n\t| piplicenses\\.py\n\t| pipdeptree\\.py\n)", + "extend-exclude": "/(\n\tExamples/\n\t| ThirdParty/\n\t| coverage/\n | MCUScripts/\n\t| Ui_.*\\.py\n\t| pycodestyle\\.py\n\t| pyflakes/checker\\.py\n\t| mccabe\\.py\n\t| eradicate\\.py\n\t| ast_unparse\\.py\n\t| piplicenses\\.py\n\t| pipdeptree\\.py\n)", "force-exclude": "", "line-length": 88, "skip-magic-trailing-comma": false, @@ -1009,6 +1009,7 @@ "*/Examples/*", "*/ThirdParty/*", "*/coverage/*", + "*/MCUScripts/*", "*/Ui_*.py", "*/pycodestyle.py", "*/pyflakes/checker.py",
--- a/src/eric7/MicroPython/Devices/DeviceBase.py Wed Feb 22 07:48:57 2023 +0100 +++ b/src/eric7/MicroPython/Devices/DeviceBase.py Wed Feb 22 08:20:34 2023 +0100 @@ -63,6 +63,7 @@ <ul> </ul> """ + # TODO: complete the list of supported commands def __init__(self, microPythonWidget, deviceType, parent=None): @@ -1175,7 +1176,6 @@ @return tuple containing a flag indicating the availability of WiFi and the WiFi type (picow or pimoroni) @rtype tuple of (bool, str) - @exception OSError raised to indicate an issue with the device """ return False, "" @@ -1190,7 +1190,7 @@ def getWifiData(self): """ - Public method to get data related to the current WiFi status + Public method to get data related to the current WiFi status. @return tuple of two dictionaries containing the WiFi status data for the WiFi client and access point @@ -1334,5 +1334,6 @@ """ return False + # # eflag: noqa = M613
--- a/src/eric7/MicroPython/Devices/RP2040Devices.py Wed Feb 22 07:48:57 2023 +0100 +++ b/src/eric7/MicroPython/Devices/RP2040Devices.py Wed Feb 22 08:20:34 2023 +0100 @@ -49,16 +49,16 @@ self.__statusTranslations = { "picow": { - -3: self.tr('authentication failed'), - -2: self.tr('no matching access point found'), - -1: self.tr('connection failed'), - 0: self.tr('idle'), - 1: self.tr('connecting'), - 2: self.tr('connected, waiting for IP address'), - 3: self.tr('connected'), + -3: self.tr("authentication failed"), + -2: self.tr("no matching access point found"), + -1: self.tr("connection failed"), + 0: self.tr("idle"), + 1: self.tr("connecting"), + 2: self.tr("connected, waiting for IP address"), + 3: self.tr("connected"), }, "pimoroni": { - # TODO: not yet implemented + # TODO: not yet implemented }, } self.__securityTranslations = { @@ -69,7 +69,7 @@ 4: "WPA/WPA2", 5: "WPA2 (CCMP)", 6: "WPA3", - 7: "WPA2/WPA3" + 7: "WPA2/WPA3", } def setButtons(self): @@ -421,11 +421,12 @@ def getWifiData(self): """ - Public method to get data related to the current WiFi status + Public method to get data related to the current WiFi status. @return tuple of two dictionaries containing the WiFi status data for the WiFi client and access point @rtype tuple of (dict, dict) + @exception OSError raised to indicate an issue with the device """ if self._deviceData["wifi_type"] == "picow": command = """ @@ -471,7 +472,7 @@ else: return super().getWifiData() - out, err = self._interface.execute(command)##, timeout=10000) + out, err = self._interface.execute(command) if err: raise OSError(self._shortError(err)) @@ -485,9 +486,9 @@ except KeyError: station["status"] = str(station["status"]) try: - ap["status"] = self.__statusTranslations[ - self._deviceData["wifi_type"] - ][ap["status"]] + ap["status"] = self.__statusTranslations[self._deviceData["wifi_type"]][ + ap["status"] + ] except KeyError: ap["status"] = str(ap["status"]) return station, ap @@ -530,10 +531,10 @@ connect_wifi({0}, {1}, {2}) del connect_wifi """.format( - repr(ssid), - repr(password if password else ""), - repr(country if country else "XX"), - ) + repr(ssid), + repr(password if password else ""), + repr(country if country else "XX"), + ) elif self._deviceData["wifi_type"] == "pimoroni": # TODO: not yet implemented pass @@ -550,9 +551,9 @@ error = "" else: try: - error = self.__statusTranslations[ - self._deviceData["wifi_type"] - ][result["status"]] + error = self.__statusTranslations[self._deviceData["wifi_type"]][ + result["status"] + ] except KeyError: error = str(result["status"]) @@ -629,7 +630,7 @@ secrets = "WIFI_SSID = {0}\nWIFI_KEY = {1}\nWIFI_COUNTRY={2}".format( repr(ssid), repr(password) if password else '""', - repr(country) if country else '""' + repr(country) if country else '""', ) wifiConnectFile = "picowWiFiConnect.py" else: @@ -643,9 +644,7 @@ self.putData("/secrets.py", secrets.encode("utf-8")) # copy auto-connect file self.put( - os.path.join( - os.path.dirname(__file__), "MCUScripts", wifiConnectFile - ), + os.path.join(os.path.dirname(__file__), "MCUScripts", wifiConnectFile), "/wifi_connect.py", ) except OSError as err: @@ -740,7 +739,9 @@ scan_networks() del scan_networks -""".format(repr(country if country else "XX")) +""".format( + repr(country if country else "XX") + ) elif self._deviceData["wifi_type"] == "pimoroni": # TODO: not yet implemented @@ -797,7 +798,9 @@ deactivate() del deactivate -""".format(interface) +""".format( + interface + ) elif self._deviceData["wifi_type"] == "pimoroni": # TODO: not yet implemented pass @@ -847,7 +850,9 @@ start_ap() del start_ap -""".format(repr(ssid), security, repr(password), repr(country if country else "XX")) +""".format( + repr(ssid), security, repr(password), repr(country if country else "XX") + ) elif self._deviceData["wifi_type"] == "pimoroni": # TODO: not yet implemented pass @@ -930,7 +935,9 @@ command = """ import rp2 rp2.country({0}) -""".format(repr(country)) +""".format( + repr(country) + ) out, err = self._interface.execute(command) if err:
--- a/src/eric7/MicroPython/WifiDialogs/WifiConnectionDialog.py Wed Feb 22 07:48:57 2023 +0100 +++ b/src/eric7/MicroPython/WifiDialogs/WifiConnectionDialog.py Wed Feb 22 08:20:34 2023 +0100 @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- +# Copyright (c) 2023 Detlev Offenbach <detlev@die-offenbachs.de> +# + """ -Module implementing WifiConnectionDialog. +Module implementing a dialog to enter the parameters needed to connect to a WiFi +network. """ from PyQt6.QtCore import pyqtSlot @@ -15,7 +19,8 @@ class WifiConnectionDialog(QDialog, Ui_WifiConnectionDialog): """ - Class documentation goes here. + Class implementing a dialog to enter the parameters needed to connect to a WiFi + network. """ def __init__(self, parent=None): @@ -42,7 +47,7 @@ @pyqtSlot(str) def on_ssidEdit_textChanged(self, ssid): """ - Private slot handling a change of the SSID + Private slot handling a change of the SSID. @param ssid entered SSID @type str
--- a/src/eric7/MicroPython/WifiDialogs/WifiController.py Wed Feb 22 07:48:57 2023 +0100 +++ b/src/eric7/MicroPython/WifiDialogs/WifiController.py Wed Feb 22 08:20:34 2023 +0100 @@ -204,7 +204,8 @@ self.tr("Write WiFi Credentials"), self.tr( "<p>The WiFi credentials were saved on the device. The device" - " will connect to the WiFi network at boot time.</p>"), + " will connect to the WiFi network at boot time.</p>" + ), ) else: EricMessageBox.critical( @@ -241,7 +242,8 @@ self.tr( "<p>The WiFi credentials were removed the device. The device" " will not connect to the WiFi network at boot time anymore." - "</p>"), + "</p>" + ), ) else: EricMessageBox.critical(
--- a/src/eric7/MicroPython/WifiDialogs/WifiNetworksWindow.py Wed Feb 22 07:48:57 2023 +0100 +++ b/src/eric7/MicroPython/WifiDialogs/WifiNetworksWindow.py Wed Feb 22 08:20:34 2023 +0100 @@ -49,7 +49,7 @@ def scanNetworks(self): """ - Private method to ask the device for a network scan and display the result. + Public method to ask the device for a network scan and display the result. """ self.networkList.clear() self.statusLabel.clear() @@ -67,7 +67,8 @@ self.tr("Scan WiFi Networks"), self.tr( """<p>The scan for available WiFi networks failed.</p>""" - """<p>Reason: {0}</p>"""), + """<p>Reason: {0}</p>""" + ), ) if self.periodicCheckBox.isChecked(): self.periodicCheckBox.setChecked(False) @@ -84,7 +85,7 @@ str(network[2]), network[1], str(network[3]), - network[4] + network[4], ], ) itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter) @@ -114,7 +115,7 @@ def closeEvent(self, evt): """ - Public method to handle a window close event. + Protected method to handle a window close event. @param evt reference to the close event @type QCloseEvent @@ -145,4 +146,4 @@ @type int """ if self.periodicCheckBox.isChecked(): - self.__scanTimer.setInterval(interval* 1000) + self.__scanTimer.setInterval(interval * 1000)
--- a/src/eric7/MicroPython/WifiDialogs/WifiStatusDialog.py Wed Feb 22 07:48:57 2023 +0100 +++ b/src/eric7/MicroPython/WifiDialogs/WifiStatusDialog.py Wed Feb 22 08:20:34 2023 +0100 @@ -111,9 +111,7 @@ QTreeWidgetItem(header, [self.tr("MAC-Address"), apStatus["mac"]]) QTreeWidgetItem(header, [self.tr("Channel"), str(apStatus["channel"])]) with contextlib.suppress(KeyError): - QTreeWidgetItem( - header, [self.tr("Country"), apStatus["country"]] - ) + QTreeWidgetItem(header, [self.tr("Country"), apStatus["country"]]) QTreeWidgetItem( header, [
--- a/src/eric7/Preferences/__init__.py Wed Feb 22 07:48:57 2023 +0100 +++ b/src/eric7/Preferences/__init__.py Wed Feb 22 08:20:34 2023 +0100 @@ -3807,9 +3807,8 @@ return None elif key in ("WifiPassword", "WifiApPassword"): return pwConvert( - Prefs.settings.value( - "MicroPython/" + key, Prefs.microPythonDefaults[key] - ), encode=False + Prefs.settings.value("MicroPython/" + key, Prefs.microPythonDefaults[key]), + encode=False, ) else: return Prefs.settings.value(