--- a/src/eric7/MicroPython/WifiDialogs/WifiConnectionDialog.py Wed Aug 02 17:22:20 2023 +0200 +++ b/src/eric7/MicroPython/WifiDialogs/WifiConnectionDialog.py Thu Aug 03 17:33:07 2023 +0200 @@ -23,10 +23,12 @@ network. """ - def __init__(self, parent=None): + def __init__(self, withCountry=False, parent=None): """ Constructor + @param withCountry flag indicating to show the country entry (defaults to False) + @type bool @param parent reference to the parent widget (defaults to None) @type QWidget (optional) """ @@ -35,11 +37,17 @@ self.showPasswordButton.setIcon(EricPixmapCache.getIcon("showPassword")) + self.countryLabel.setVisible(withCountry) + self.countryEdit.setVisible(withCountry) + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) # populate the field with data saved to the preferences self.ssidEdit.setText(Preferences.getMicroPython("WifiName")) self.passwordEdit.setText(Preferences.getMicroPython("WifiPassword")) + self.hostnameEdit.setText(Preferences.getMicroPython("WifiHostname")) + if withCountry: + self.countryEdit.setText(Preferences.getMicroPython("WifiCountry").upper()) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @@ -79,6 +87,11 @@ if self.rememberCheckBox.isChecked(): Preferences.setMicroPython("WifiName", self.ssidEdit.text()) Preferences.setMicroPython("WifiPassword", self.passwordEdit.text()) + Preferences.setMicroPython("WifiHostname", self.hostnameEdit.text()) + if self.countryEdit.isVisible(): + Preferences.setMicroPython( + "WifiCountry", self.countryEdit.text().upper() + ) super().accept() @@ -86,10 +99,20 @@ """ Public method to get the entered connection parameters. - @return tuple containing the SSID and the password - @rtype tuple of (str, str) + @return tuple containing the SSID, the password and the host name + @rtype tuple of (str, str, str) """ return ( self.ssidEdit.text(), self.passwordEdit.text(), + self.hostnameEdit.text(), ) + + def getCountryCode(self): + """ + Public method to get the entered country code. + + @return DESCRIPTION + @rtype TYPE + """ + return self.countryEdit.text().upper()