diff -r c6806d24468b -r 210bf87ae5c7 src/eric7/MicroPython/MicroPythonWidget.py --- a/src/eric7/MicroPython/MicroPythonWidget.py Sat Feb 18 10:11:44 2023 +0100 +++ b/src/eric7/MicroPython/MicroPythonWidget.py Sat Feb 18 18:12:32 2023 +0100 @@ -41,6 +41,7 @@ from . import Devices, UF2FlashDialog from .MicroPythonFileManagerWidget import MicroPythonFileManagerWidget from .Ui_MicroPythonWidget import Ui_MicroPythonWidget +from .WifiDialogs.WifiController import WifiController try: from .MicroPythonGraphWidget import MicroPythonGraphWidget @@ -222,6 +223,7 @@ self.layout().setContentsMargins(0, 3, 0, 0) self.__ui = parent + self.__wifiController = WifiController(self, self) self.__superMenu = QMenu(self) self.__superMenu.aboutToShow.connect(self.__aboutToShowSuperMenu) @@ -1115,6 +1117,15 @@ boardName = self.deviceTypeComboBox.currentData(self.DeviceBoardRole) return boardName + def getDevice(self): + """ + Public method to get a reference to the current device. + + @return reference to the current device + @rtype BaseDevice + """ + return self.__device + def getDeviceWorkspace(self): """ Public method to get the workspace directory of the device. @@ -1438,8 +1449,7 @@ # prepare the WiFi menu if self.__device and self.__connected and self.__device.getDeviceData("wifi"): - wifiMenu = QMenu(self.tr("WiFi Functions"), self.__superMenu) - wifiMenu.addAction(self.tr("Show WiFi Status"), self.__showWifiStatus) + wifiMenu = self.__wifiController.createMenu(self.__superMenu) else: wifiMenu = None @@ -1998,22 +2008,3 @@ dlg.show() except Exception as exc: self.__showError("getModules()", str(exc)) - - ############################################################################ - ## WiFi related methods below - ############################################################################ - - def __showWifiStatus(self): - """ - Private method to show a dialog with the WiFi status of the current device. - """ - from .WifiStatusDialog import WifiStatusDialog - - try: - clientStatus, apStatus = self.__device.getWifiData() - - dlg = WifiStatusDialog(clientStatus, apStatus) - dlg.exec() - except Exception as exc: - self.__showError("getWifiData()", str(exc)) -