src/eric7/Preferences/ConfigurationPages/MicroPythonPage.py

branch
mpy_network
changeset 9776
210bf87ae5c7
parent 9653
e67609152c5e
child 9779
8d3c7c991085
--- a/src/eric7/Preferences/ConfigurationPages/MicroPythonPage.py	Sat Feb 18 10:11:44 2023 +0100
+++ b/src/eric7/Preferences/ConfigurationPages/MicroPythonPage.py	Sat Feb 18 18:12:32 2023 +0100
@@ -7,8 +7,11 @@
 Module implementing the MicroPython configuration page.
 """
 
+from PyQt6.QtCore import pyqtSlot
+from PyQt6.QtWidgets import QLineEdit
 
 from eric7 import Preferences
+from eric7.EricGui import EricPixmapCache
 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes
 from eric7.MicroPython.MicroPythonWidget import AnsiColorSchemes
 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities
@@ -38,6 +41,8 @@
         self.setupUi(self)
         self.setObjectName("MicroPythonPage")
 
+        self.showPasswordButton.setIcon(EricPixmapCache.getIcon("showPassword"))
+
         self.workspacePicker.setMode(EricPathPickerModes.DIRECTORY_MODE)
 
         self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys()))
@@ -117,6 +122,10 @@
         # MPY Cross Compiler
         self.mpyCrossPicker.setText(Preferences.getMicroPython("MpyCrossCompiler"))
 
+        # WiFi
+        self.ssidEdit.setText(Preferences.getMicroPython("WifiName"))
+        self.passwordEdit.setText(Preferences.getMicroPython("WifiPassword"))
+
         # PyBoard specifics
         self.dfuUtilPathPicker.setText(Preferences.getMicroPython("DfuUtilPath"))
 
@@ -197,6 +206,10 @@
         # MPY Cross Compiler
         Preferences.setMicroPython("MpyCrossCompiler", self.mpyCrossPicker.text())
 
+        # WiFi
+        Preferences.setMicroPython("WifiName", self.ssidEdit.text())
+        Preferences.setMicroPython("WifiPassword", self.passwordEdit.text())
+
         # PyBoard specifics
         Preferences.setMicroPython("DfuUtilPath", self.dfuUtilPathPicker.text())
 
@@ -244,6 +257,23 @@
             "CalliopeDocuUrl", self.calliopeDocuUrlLineEdit.text()
         )
 
+    @pyqtSlot(bool)
+    def on_showPasswordButton_clicked(self, checked):
+        """
+        Private slot to show or hide the password.
+
+        @param checked state of the button
+        @type bool
+        """
+        if checked:
+            self.passwordEdit.setEchoMode(QLineEdit.EchoMode.Normal)
+            self.showPasswordButton.setIcon(EricPixmapCache.getIcon("hidePassword"))
+            self.showPasswordButton.setToolTip(self.tr("Press to hide the password"))
+        else:
+            self.passwordEdit.setEchoMode(QLineEdit.EchoMode.Password)
+            self.showPasswordButton.setIcon(EricPixmapCache.getIcon("showPassword"))
+            self.showPasswordButton.setToolTip(self.tr("Press to show the password"))
+
 
 def create(dlg):
     """

eric ide

mercurial