eric6/Preferences/ConfigurationPages/MicroPythonPage.py

Sun, 31 Jan 2021 17:47:55 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 31 Jan 2021 17:47:55 +0100
changeset 8038
73ec029d4107
parent 8032
76375aa6bc04
child 8051
b78279548993
permissions
-rw-r--r--

MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".

7079
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2019 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
7079
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the MicroPython configuration page.
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
7140
22f5fd76c10f MicroPythonWidget: added menu entries to cross compile a selectable Python file or the current editor to a .mpy file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7135
diff changeset
10 from E5Gui.E5PathPicker import E5PathPickerModes
22f5fd76c10f MicroPythonWidget: added menu entries to cross compile a selectable Python file or the current editor to a .mpy file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7135
diff changeset
11
7079
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from .ConfigurationPageBase import ConfigurationPageBase
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .Ui_MicroPythonPage import Ui_MicroPythonPage
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import Preferences
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7099
diff changeset
17 from MicroPython.MicroPythonWidget import AnsiColorSchemes
7079
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 class MicroPythonPage(ConfigurationPageBase, Ui_MicroPythonPage):
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 Class implementing the MicroPython configuration page.
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 def __init__(self, parent=None):
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Constructor
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @param parent reference to the parent widget
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @type QWidget
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 super(MicroPythonPage, self).__init__()
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 self.setupUi(self)
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.setObjectName("MicroPythonPage")
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys()))
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
37 # populate the chart theme combobox
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
38 try:
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
39 from PyQt5.QtChart import QChart
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
40
7541
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
41 self.chartThemeComboBox.addItem(
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
42 self.tr("Automatic"), -1)
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
43 self.chartThemeComboBox.addItem(
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
44 self.tr("Light"), QChart.ChartThemeLight)
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
45 self.chartThemeComboBox.addItem(
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
46 self.tr("Dark"), QChart.ChartThemeDark)
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
47 self.chartThemeComboBox.addItem(
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
48 self.tr("Blue Cerulean"), QChart.ChartThemeBlueCerulean)
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
49 self.chartThemeComboBox.addItem(
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
50 self.tr("Brown Sand"), QChart.ChartThemeBrownSand)
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
51 self.chartThemeComboBox.addItem(
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
52 self.tr("Blue NCS"), QChart.ChartThemeBlueNcs)
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
53 self.chartThemeComboBox.addItem(
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
54 self.tr("High Contrast"), QChart.ChartThemeHighContrast)
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
55 self.chartThemeComboBox.addItem(
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
56 self.tr("Blue Icy"), QChart.ChartThemeBlueIcy)
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
57 self.chartThemeComboBox.addItem(
b265a2d0a797 MicroPythonPage: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7535
diff changeset
58 self.tr("Qt"), QChart.ChartThemeQt)
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
59 except ImportError:
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
60 self.chartThemeComboBox.setEnabled(False)
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
61
7140
22f5fd76c10f MicroPythonWidget: added menu entries to cross compile a selectable Python file or the current editor to a .mpy file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7135
diff changeset
62 self.mpyCrossPicker.setMode(E5PathPickerModes.OpenFileMode)
22f5fd76c10f MicroPythonWidget: added menu entries to cross compile a selectable Python file or the current editor to a .mpy file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7135
diff changeset
63 self.mpyCrossPicker.setFilters(self.tr("All Files (*)"))
22f5fd76c10f MicroPythonWidget: added menu entries to cross compile a selectable Python file or the current editor to a .mpy file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7135
diff changeset
64
7327
71883ddcb762 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
65 self.dfuUtilPathPicker.setMode(E5PathPickerModes.OpenFileMode)
71883ddcb762 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
66 self.dfuUtilPathPicker.setFilters(self.tr("All Files (*)"))
71883ddcb762 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
67
7079
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 # set initial values
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
69 # serial link parameters
7099
89f11ae6bec3 Preferences: added an option to configure the REPL pane line wrap mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7086
diff changeset
70 self.timeoutSpinBox.setValue(
89f11ae6bec3 Preferences: added an option to configure the REPL pane line wrap mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7086
diff changeset
71 Preferences.getMicroPython("SerialTimeout") / 1000)
89f11ae6bec3 Preferences: added an option to configure the REPL pane line wrap mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7086
diff changeset
72 # converted to seconds
7135
44fcfc99b864 MicroPython: added an option to synchronize the device time to the host time after connecting the serial port.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
73 self.syncTimeCheckBox.setChecked(
44fcfc99b864 MicroPython: added an option to synchronize the device time to the host time after connecting the serial port.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
74 Preferences.getMicroPython("SyncTimeAfterConnect"))
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
75
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
76 # REPL Pane
7079
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 self.colorSchemeComboBox.setCurrentIndex(
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.colorSchemeComboBox.findText(
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 Preferences.getMicroPython("ColorScheme")))
7099
89f11ae6bec3 Preferences: added an option to configure the REPL pane line wrap mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7086
diff changeset
80 self.replWrapCheckBox.setChecked(
89f11ae6bec3 Preferences: added an option to configure the REPL pane line wrap mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7086
diff changeset
81 Preferences.getMicroPython("ReplLineWrap"))
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
82
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
83 # Chart Pane
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
84 index = self.chartThemeComboBox.findData(
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
85 Preferences.getMicroPython("ChartColorTheme"))
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
86 if index < 0:
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
87 index = 0
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
88 self.chartThemeComboBox.setCurrentIndex(index)
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
89
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
90 # MPY Cross Compiler
7140
22f5fd76c10f MicroPythonWidget: added menu entries to cross compile a selectable Python file or the current editor to a .mpy file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7135
diff changeset
91 self.mpyCrossPicker.setText(
22f5fd76c10f MicroPythonWidget: added menu entries to cross compile a selectable Python file or the current editor to a .mpy file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7135
diff changeset
92 Preferences.getMicroPython("MpyCrossCompiler"))
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
93
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
94 # PyBoard specifics
7327
71883ddcb762 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
95 self.dfuUtilPathPicker.setText(
71883ddcb762 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
96 Preferences.getMicroPython("DfuUtilPath"))
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
97
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
98 # MicroPython URLs
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
99 self.micropythonFirmwareUrlLineEdit.setText(
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
100 Preferences.getMicroPython("MicroPythonFirmwareUrl"))
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
101 self.micropythonDocuUrlLineEdit.setText(
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
102 Preferences.getMicroPython("MicroPythonDocuUrl"))
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
103
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
104 # CircuitPython URLs
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
105 self.circuitpythonFirmwareUrlLineEdit.setText(
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
106 Preferences.getMicroPython("CircuitPythonFirmwareUrl"))
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
107 self.circuitpythonDocuUrlLineEdit.setText(
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
108 Preferences.getMicroPython("CircuitPythonDocuUrl"))
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
109
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
110 # TODO: add entry for micro:bit v2 URLs
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
111 # BBC micro:bit URLs
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
112 self.microbitFirmwareUrlLineEdit.setText(
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
113 Preferences.getMicroPython("MicrobitFirmwareUrl"))
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
114 self.microbitMicroPythonUrlLineEdit.setText(
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
115 Preferences.getMicroPython("MicrobitMicroPythonUrl"))
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
116 self.microbitDocuUrlLineEdit.setText(
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
117 Preferences.getMicroPython("MicrobitDocuUrl"))
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
118
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
119 # Calliope mini URLs
7548
e1c6a2e32a38 MicroPython: started implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7541
diff changeset
120 self.calliopeFirmwareUrlLineEdit.setText(
e1c6a2e32a38 MicroPython: started implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7541
diff changeset
121 Preferences.getMicroPython("CalliopeFirmwareUrl"))
e1c6a2e32a38 MicroPython: started implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7541
diff changeset
122 self.calliopeDocuUrlLineEdit.setText(
e1c6a2e32a38 MicroPython: started implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7541
diff changeset
123 Preferences.getMicroPython("CalliopeDocuUrl"))
7079
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 def save(self):
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 """
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 Public slot to save the MicroPython configuration.
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 """
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
129 # serial link parameters
7079
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 Preferences.setMicroPython(
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
131 "SerialTimeout",
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
132 self.timeoutSpinBox.value() * 1000)
7099
89f11ae6bec3 Preferences: added an option to configure the REPL pane line wrap mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7086
diff changeset
133 # converted to milliseconds
89f11ae6bec3 Preferences: added an option to configure the REPL pane line wrap mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7086
diff changeset
134 Preferences.setMicroPython(
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
135 "SyncTimeAfterConnect",
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
136 self.syncTimeCheckBox.isChecked())
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
137
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
138 # REPL Pane
7135
44fcfc99b864 MicroPython: added an option to synchronize the device time to the host time after connecting the serial port.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
139 Preferences.setMicroPython(
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
140 "ColorScheme",
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
141 self.colorSchemeComboBox.currentText())
7086
b757db426076 Preferences: added config option for the MicroPython serial communication timeout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7079
diff changeset
142 Preferences.setMicroPython(
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
143 "ReplLineWrap",
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
144 self.replWrapCheckBox.isChecked())
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
145
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
146 # Chart Pane
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
147 Preferences.setMicroPython(
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
148 "ChartColorTheme",
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
149 self.chartThemeComboBox.currentData())
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
150
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
151 # MPY Cross Compiler
7140
22f5fd76c10f MicroPythonWidget: added menu entries to cross compile a selectable Python file or the current editor to a .mpy file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7135
diff changeset
152 Preferences.setMicroPython(
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
153 "MpyCrossCompiler",
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
154 self.mpyCrossPicker.text())
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
155
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
156 # PyBoard specifics
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
157 Preferences.setMicroPython(
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
158 "DfuUtilPath",
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
159 self.dfuUtilPathPicker.text())
7535
dac9bc72a0f3 MicroPython: made the chart widget color scheme aware and added a config option to configure a specific chart color theme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
160
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
161 # MicroPython URLs
7161
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7140
diff changeset
162 Preferences.setMicroPython(
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
163 "MicroPythonFirmwareUrl",
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
164 self.micropythonFirmwareUrlLineEdit.text())
7327
71883ddcb762 MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
165 Preferences.setMicroPython(
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
166 "MicroPythonDocuUrl",
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
167 self.micropythonDocuUrlLineEdit.text())
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
168
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
169 # CircuitPython URLs
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
170 Preferences.setMicroPython(
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
171 "CircuitPythonFirmwareUrl",
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
172 self.circuitpythonFirmwareUrlLineEdit.text())
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
173 Preferences.setMicroPython(
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
174 "CircuitPythonDocuUrl",
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
175 self.circuitpythonDocuUrlLineEdit.text())
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
176
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
177 # TODO: add entry for micro:bit v2 URLs
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
178 # BBC micro:bit URLs
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
179 Preferences.setMicroPython(
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
180 "MicrobitFirmwareUrl",
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
181 self.microbitFirmwareUrlLineEdit.text())
7548
e1c6a2e32a38 MicroPython: started implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7541
diff changeset
182 Preferences.setMicroPython(
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
183 "MicrobitMicroPythonUrl",
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
184 self.microbitMicroPythonUrlLineEdit.text())
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
185 Preferences.setMicroPython(
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
186 "MicrobitDocuUrl",
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7327
diff changeset
187 self.microbitDocuUrlLineEdit.text())
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
188
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
189 # Calliope mini URLs
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
190 Preferences.setMicroPython(
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
191 "CalliopeFirmwareUrl",
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8032
diff changeset
192 self.calliopeFirmwareUrlLineEdit.text())
7548
e1c6a2e32a38 MicroPython: started implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7541
diff changeset
193 Preferences.setMicroPython(
e1c6a2e32a38 MicroPython: started implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7541
diff changeset
194 "CalliopeDocuUrl",
e1c6a2e32a38 MicroPython: started implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7541
diff changeset
195 self.calliopeDocuUrlLineEdit.text())
7161
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7140
diff changeset
196
7079
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 def create(dlg):
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 """
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 Module function to create the configuration page.
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 @param dlg reference to the configuration dialog
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 @return reference to the instantiated page (ConfigurationPageBase)
d1564b590677 Preferences: added a configuration pyge for the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 """
7140
22f5fd76c10f MicroPythonWidget: added menu entries to cross compile a selectable Python file or the current editor to a .mpy file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7135
diff changeset
205 return MicroPythonPage()

eric ide

mercurial