diff -r ce3bcd9df3b3 -r 0e220c26e60e src/eric7/MicroPython/WifiDialogs/WifiController.py --- a/src/eric7/MicroPython/WifiDialogs/WifiController.py Tue May 06 11:09:21 2025 +0200 +++ b/src/eric7/MicroPython/WifiDialogs/WifiController.py Tue May 06 15:32:29 2025 +0200 @@ -32,6 +32,7 @@ super().__init__(parent) self.__mpy = microPython + self.__mpy.disconnected.connect(self.__disconnectedFromDevice) self.__wifiStatusDialog = None @@ -86,6 +87,15 @@ return wifiMenu @pyqtSlot() + def __disconnectedFromDevice(self): + """ + Private slot handling disconnection from a device. + """ + if self.__wifiStatusDialog is not None: + self.__wifiStatusDialog.deleteLater() + self.__wifiStatusDialog = None + + @pyqtSlot() def __showWifiStatus(self): """ Private slot to show a dialog with the WiFi status of the current device. @@ -106,14 +116,17 @@ """ Private slot to connect the current device to a WiFi network. """ - # TODO: add country to WiFi connection from .WifiConnectionDialog import WifiConnectionDialog - dlg = WifiConnectionDialog(parent=self.__mpy) + dlg = WifiConnectionDialog( + withCountry=self.__mpy.getDevice().hasWifiCountry(), + parent=self.__mpy, + ) if dlg.exec() == QDialog.DialogCode.Accepted: ssid, password, hostname = dlg.getConnectionParameters() + country = dlg.getCountryCode() success, error = self.__mpy.getDevice().connectWifi( - ssid, password, hostname + ssid, password, hostname, country ) if success: EricMessageBox.information(