src/eric7/Preferences/ConfigurationPages/MicroPythonPage.py

branch
mpy_network
changeset 9776
210bf87ae5c7
parent 9653
e67609152c5e
child 9779
8d3c7c991085
equal deleted inserted replaced
9775:c6806d24468b 9776:210bf87ae5c7
5 5
6 """ 6 """
7 Module implementing the MicroPython configuration page. 7 Module implementing the MicroPython configuration page.
8 """ 8 """
9 9
10 from PyQt6.QtCore import pyqtSlot
11 from PyQt6.QtWidgets import QLineEdit
10 12
11 from eric7 import Preferences 13 from eric7 import Preferences
14 from eric7.EricGui import EricPixmapCache
12 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes 15 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes
13 from eric7.MicroPython.MicroPythonWidget import AnsiColorSchemes 16 from eric7.MicroPython.MicroPythonWidget import AnsiColorSchemes
14 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities 17 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities
15 18
16 from .ConfigurationPageBase import ConfigurationPageBase 19 from .ConfigurationPageBase import ConfigurationPageBase
35 @type QWidget 38 @type QWidget
36 """ 39 """
37 super().__init__() 40 super().__init__()
38 self.setupUi(self) 41 self.setupUi(self)
39 self.setObjectName("MicroPythonPage") 42 self.setObjectName("MicroPythonPage")
43
44 self.showPasswordButton.setIcon(EricPixmapCache.getIcon("showPassword"))
40 45
41 self.workspacePicker.setMode(EricPathPickerModes.DIRECTORY_MODE) 46 self.workspacePicker.setMode(EricPathPickerModes.DIRECTORY_MODE)
42 47
43 self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys())) 48 self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys()))
44 49
115 self.chartThemeComboBox.setCurrentIndex(index) 120 self.chartThemeComboBox.setCurrentIndex(index)
116 121
117 # MPY Cross Compiler 122 # MPY Cross Compiler
118 self.mpyCrossPicker.setText(Preferences.getMicroPython("MpyCrossCompiler")) 123 self.mpyCrossPicker.setText(Preferences.getMicroPython("MpyCrossCompiler"))
119 124
125 # WiFi
126 self.ssidEdit.setText(Preferences.getMicroPython("WifiName"))
127 self.passwordEdit.setText(Preferences.getMicroPython("WifiPassword"))
128
120 # PyBoard specifics 129 # PyBoard specifics
121 self.dfuUtilPathPicker.setText(Preferences.getMicroPython("DfuUtilPath")) 130 self.dfuUtilPathPicker.setText(Preferences.getMicroPython("DfuUtilPath"))
122 131
123 # MicroPython URLs 132 # MicroPython URLs
124 self.micropythonFirmwareUrlLineEdit.setText( 133 self.micropythonFirmwareUrlLineEdit.setText(
195 ) 204 )
196 205
197 # MPY Cross Compiler 206 # MPY Cross Compiler
198 Preferences.setMicroPython("MpyCrossCompiler", self.mpyCrossPicker.text()) 207 Preferences.setMicroPython("MpyCrossCompiler", self.mpyCrossPicker.text())
199 208
209 # WiFi
210 Preferences.setMicroPython("WifiName", self.ssidEdit.text())
211 Preferences.setMicroPython("WifiPassword", self.passwordEdit.text())
212
200 # PyBoard specifics 213 # PyBoard specifics
201 Preferences.setMicroPython("DfuUtilPath", self.dfuUtilPathPicker.text()) 214 Preferences.setMicroPython("DfuUtilPath", self.dfuUtilPathPicker.text())
202 215
203 # MicroPython URLs 216 # MicroPython URLs
204 Preferences.setMicroPython( 217 Preferences.setMicroPython(
242 ) 255 )
243 Preferences.setMicroPython( 256 Preferences.setMicroPython(
244 "CalliopeDocuUrl", self.calliopeDocuUrlLineEdit.text() 257 "CalliopeDocuUrl", self.calliopeDocuUrlLineEdit.text()
245 ) 258 )
246 259
260 @pyqtSlot(bool)
261 def on_showPasswordButton_clicked(self, checked):
262 """
263 Private slot to show or hide the password.
264
265 @param checked state of the button
266 @type bool
267 """
268 if checked:
269 self.passwordEdit.setEchoMode(QLineEdit.EchoMode.Normal)
270 self.showPasswordButton.setIcon(EricPixmapCache.getIcon("hidePassword"))
271 self.showPasswordButton.setToolTip(self.tr("Press to hide the password"))
272 else:
273 self.passwordEdit.setEchoMode(QLineEdit.EchoMode.Password)
274 self.showPasswordButton.setIcon(EricPixmapCache.getIcon("showPassword"))
275 self.showPasswordButton.setToolTip(self.tr("Press to show the password"))
276
247 277
248 def create(dlg): 278 def create(dlg):
249 """ 279 """
250 Module function to create the configuration page. 280 Module function to create the configuration page.
251 281

eric ide

mercurial