src/eric7/MicroPython/WifiDialogs/WifiController.py

branch
eric7
changeset 10153
ffe7432f716b
parent 10022
a95800b414b7
child 10230
1311cd5d117e
equal deleted inserted replaced
10152:33e7b9d3f91c 10153:ffe7432f716b
105 """ 105 """
106 from .WifiConnectionDialog import WifiConnectionDialog 106 from .WifiConnectionDialog import WifiConnectionDialog
107 107
108 dlg = WifiConnectionDialog() 108 dlg = WifiConnectionDialog()
109 if dlg.exec() == QDialog.DialogCode.Accepted: 109 if dlg.exec() == QDialog.DialogCode.Accepted:
110 ssid, password = dlg.getConnectionParameters() 110 ssid, password, hostname = dlg.getConnectionParameters()
111 success, error = self.__mpy.getDevice().connectWifi(ssid, password) 111 success, error = self.__mpy.getDevice().connectWifi(
112 ssid, password, hostname
113 )
112 if success: 114 if success:
113 EricMessageBox.information( 115 EricMessageBox.information(
114 None, 116 None,
115 self.tr("Connect WiFi"), 117 self.tr("Connect WiFi"),
116 self.tr( 118 self.tr(
192 194
193 This will also modify the boot script to perform an automatic WiFi connection. 195 This will also modify the boot script to perform an automatic WiFi connection.
194 """ 196 """
195 from .WifiConnectionDialog import WifiConnectionDialog 197 from .WifiConnectionDialog import WifiConnectionDialog
196 198
197 dlg = WifiConnectionDialog() 199 dlg = WifiConnectionDialog(withCountry=self.__mpy.getDevice().hasWifiCountry())
198 if dlg.exec() == QDialog.DialogCode.Accepted: 200 if dlg.exec() == QDialog.DialogCode.Accepted:
199 ssid, password = dlg.getConnectionParameters() 201 ssid, password, hostname = dlg.getConnectionParameters()
200 success, error = self.__mpy.getDevice().writeCredentials(ssid, password) 202 country = dlg.getCountryCode()
203 success, error = self.__mpy.getDevice().writeCredentials(
204 ssid, password, hostname, country
205 )
201 if success: 206 if success:
202 if self.__mpy.getDevice().hasCircuitPython(): 207 if self.__mpy.getDevice().hasCircuitPython():
203 # CircuitPython will reset for the REPL, so no auto-connect 208 # CircuitPython will reset for the REPL, so no auto-connect
204 # available. 209 # available.
205 if Globals.versionToTuple( 210 if Globals.versionToTuple(
291 """ 296 """
292 from .WifiApConfigDialog import WifiApConfigDialog 297 from .WifiApConfigDialog import WifiApConfigDialog
293 298
294 dlg = WifiApConfigDialog(withIP=withIP) 299 dlg = WifiApConfigDialog(withIP=withIP)
295 if dlg.exec() == QDialog.DialogCode.Accepted: 300 if dlg.exec() == QDialog.DialogCode.Accepted:
296 ssid, password, security, ifconfig = dlg.getApConfig() 301 ssid, password, security, hostname, ifconfig = dlg.getApConfig()
297 302
298 ok, err = self.__mpy.getDevice().startAccessPoint( 303 ok, err = self.__mpy.getDevice().startAccessPoint(
299 ssid, 304 ssid,
300 security=security, 305 security=security,
301 password=password, 306 password=password,
307 hostname=hostname,
302 ifconfig=ifconfig if withIP else None, 308 ifconfig=ifconfig if withIP else None,
303 ) 309 )
304 if ok: 310 if ok:
305 EricMessageBox.information( 311 EricMessageBox.information(
306 None, 312 None,

eric ide

mercurial