src/eric7/MicroPython/WifiDialogs/WifiController.py

branch
mpy_network
changeset 9886
1a4f05b0dc00
parent 9878
a82014a9e57b
child 10022
a95800b414b7
--- a/src/eric7/MicroPython/WifiDialogs/WifiController.py	Tue Mar 14 13:16:06 2023 +0100
+++ b/src/eric7/MicroPython/WifiDialogs/WifiController.py	Tue Mar 14 13:16:49 2023 +0100
@@ -10,6 +10,7 @@
 from PyQt6.QtCore import QObject, pyqtSlot
 from PyQt6.QtWidgets import QDialog, QMenu
 
+from eric7 import Globals
 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor
 from eric7.EricWidgets import EricMessageBox
 
@@ -195,14 +196,40 @@
             ssid, password = dlg.getConnectionParameters()
             success, error = self.__mpy.getDevice().writeCredentials(ssid, password)
             if success:
-                EricMessageBox.information(
-                    None,
-                    self.tr("Write WiFi Credentials"),
-                    self.tr(
-                        "<p>The WiFi credentials were saved on the device. The device"
-                        " will connect to the WiFi network at boot time.</p>"
-                    ),
-                )
+                if self.__mpy.getDevice().hasCircuitPython():
+                    # CircuitPython will reset for the REPL, so no auto-connect
+                    # available.
+                    if Globals.versionToTuple(
+                        self.__mpy.getDevice().getDeviceData("release")
+                    ) >= (8, 0, 0):
+                        EricMessageBox.information(
+                            None,
+                            self.tr("Write WiFi Credentials"),
+                            self.tr(
+                                "<p>The WiFi credentials were saved on the device. The"
+                                " device will connect to the WiFi network at boot time."
+                                "</p>"
+                            ),
+                        )
+                    else:
+                        EricMessageBox.information(
+                            None,
+                            self.tr("Write WiFi Credentials"),
+                            self.tr(
+                                "<p>The WiFi credentials and a connect script were"
+                                " saved on the device. Use the script by simply"
+                                " importing it.</p>"
+                            ),
+                        )
+                else:
+                    EricMessageBox.information(
+                        None,
+                        self.tr("Write WiFi Credentials"),
+                        self.tr(
+                            "<p>The WiFi credentials were saved on the device. The"
+                            " device will connect to the WiFi network at boot time.</p>"
+                        ),
+                    )
             else:
                 EricMessageBox.critical(
                     None,

eric ide

mercurial