5 |
5 |
6 """ |
6 """ |
7 Module implementing the MicroPython configuration page. |
7 Module implementing the MicroPython configuration page. |
8 """ |
8 """ |
9 |
9 |
|
10 import os |
|
11 |
10 from PyQt6.QtCore import pyqtSlot |
12 from PyQt6.QtCore import pyqtSlot |
11 from PyQt6.QtWidgets import QLineEdit |
13 from PyQt6.QtWidgets import QLineEdit |
12 |
14 |
13 from eric7 import Preferences |
15 from eric7 import Preferences |
14 from eric7.EricGui import EricPixmapCache |
16 from eric7.EricGui import EricPixmapCache |
|
17 from eric7.EricWidgets.EricApplication import ericApp |
15 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
18 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
16 from eric7.MicroPython.MicroPythonWidget import AnsiColorSchemes |
19 from eric7.MicroPython.MicroPythonWidget import AnsiColorSchemes |
17 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities |
20 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities, PythonUtilities |
18 |
21 |
19 from .ConfigurationPageBase import ConfigurationPageBase |
22 from .ConfigurationPageBase import ConfigurationPageBase |
20 from .Ui_MicroPythonPage import Ui_MicroPythonPage |
23 from .Ui_MicroPythonPage import Ui_MicroPythonPage |
21 |
24 |
22 try: |
25 try: |
348 else: |
351 else: |
349 self.apPasswordEdit.setEchoMode(QLineEdit.EchoMode.Password) |
352 self.apPasswordEdit.setEchoMode(QLineEdit.EchoMode.Password) |
350 self.apShowPasswordButton.setIcon(EricPixmapCache.getIcon("showPassword")) |
353 self.apShowPasswordButton.setIcon(EricPixmapCache.getIcon("showPassword")) |
351 self.apShowPasswordButton.setToolTip(self.tr("Press to show the password")) |
354 self.apShowPasswordButton.setToolTip(self.tr("Press to show the password")) |
352 |
355 |
|
356 @pyqtSlot() |
|
357 def on_mpyCrossInstallButton_clicked(self): |
|
358 """ |
|
359 Private slot to install the 'mpy-cross' compiler. |
|
360 """ |
|
361 pip = ericApp().getObject("Pip") |
|
362 pip.installPackages( |
|
363 ["mpy-cross"], interpreter=PythonUtilities.getPythonExecutable() |
|
364 ) |
|
365 |
|
366 mpycrossPath = os.path.join( |
|
367 PythonUtilities.getPythonScriptsDirectory(), "mpy-cross" |
|
368 ) |
|
369 if OSUtilities.isWindowsPlatform(): |
|
370 mpycrossPath += ".exe" |
|
371 self.mpyCrossPicker.setText(mpycrossPath) |
|
372 |
|
373 @pyqtSlot(str) |
|
374 def on_mpyCrossPicker_textChanged(self, mpycrossPath): |
|
375 """ |
|
376 Private slot to handle a change of the selected 'mpy-cross' compiler. |
|
377 |
|
378 @param mpycrossPath entered path of the 'mpy-cross' compiler |
|
379 @type str |
|
380 """ |
|
381 self.mpyCrossInstallButton.setEnabled(not bool(mpycrossPath)) |
|
382 |
353 |
383 |
354 def create(dlg): |
384 def create(dlg): |
355 """ |
385 """ |
356 Module function to create the configuration page. |
386 Module function to create the configuration page. |
357 |
387 |