src/eric7/MicroPython/WifiDialogs/WifiController.py

branch
eric7
changeset 11166
fd914f897dcf
parent 11090
f5f5f5803935
child 11236
75c26fe1d1c7
equal deleted inserted replaced
11165:24e1beb8779a 11166:fd914f897dcf
30 @type QObject (optional) 30 @type QObject (optional)
31 """ 31 """
32 super().__init__(parent) 32 super().__init__(parent)
33 33
34 self.__mpy = microPython 34 self.__mpy = microPython
35
36 self.__wifiStatusDialog = None
35 37
36 def createMenu(self, menu): 38 def createMenu(self, menu):
37 """ 39 """
38 Public method to create the WiFi submenu. 40 Public method to create the WiFi submenu.
39 41
88 """ 90 """
89 Private slot to show a dialog with the WiFi status of the current device. 91 Private slot to show a dialog with the WiFi status of the current device.
90 """ 92 """
91 from .WifiStatusDialog import WifiStatusDialog 93 from .WifiStatusDialog import WifiStatusDialog
92 94
93 try: 95 if self.__wifiStatusDialog is not None:
94 clientStatus, apStatus, overallStatus = self.__mpy.getDevice().getWifiData() 96 self.__wifiStatusDialog.deleteLater()
95 97 self.__wifiStatusDialog = None
96 dlg = WifiStatusDialog( 98
97 clientStatus, apStatus, overallStatus, parent=self.__mpy 99 self.__wifiStatusDialog = WifiStatusDialog(
98 ) 100 microPython=self.__mpy, parent=self.__mpy
99 dlg.exec() 101 )
100 except Exception as exc: 102 self.__wifiStatusDialog.show()
101 self.__mpy.showError("getWifiData()", str(exc))
102 103
103 @pyqtSlot() 104 @pyqtSlot()
104 def __connectWifi(self): 105 def __connectWifi(self):
105 """ 106 """
106 Private slot to connect the current device to a WiFi network. 107 Private slot to connect the current device to a WiFi network.

eric ide

mercurial