11 |
11 |
12 from .ConfigurationPageBase import ConfigurationPageBase |
12 from .ConfigurationPageBase import ConfigurationPageBase |
13 from .Ui_MicroPythonPage import Ui_MicroPythonPage |
13 from .Ui_MicroPythonPage import Ui_MicroPythonPage |
14 |
14 |
15 import Preferences |
15 import Preferences |
|
16 import Utilities |
16 |
17 |
17 from MicroPython.MicroPythonWidget import AnsiColorSchemes |
18 from MicroPython.MicroPythonWidget import AnsiColorSchemes |
18 |
19 |
19 |
20 |
20 class MicroPythonPage(ConfigurationPageBase, Ui_MicroPythonPage): |
21 class MicroPythonPage(ConfigurationPageBase, Ui_MicroPythonPage): |
29 @type QWidget |
30 @type QWidget |
30 """ |
31 """ |
31 super(MicroPythonPage, self).__init__() |
32 super(MicroPythonPage, self).__init__() |
32 self.setupUi(self) |
33 self.setupUi(self) |
33 self.setObjectName("MicroPythonPage") |
34 self.setObjectName("MicroPythonPage") |
|
35 |
|
36 self.workspacePicker.setMode(E5PathPickerModes.DirectoryMode) |
34 |
37 |
35 self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys())) |
38 self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys())) |
36 |
39 |
37 # populate the chart theme combobox |
40 # populate the chart theme combobox |
38 try: |
41 try: |
64 |
67 |
65 self.dfuUtilPathPicker.setMode(E5PathPickerModes.OpenFileMode) |
68 self.dfuUtilPathPicker.setMode(E5PathPickerModes.OpenFileMode) |
66 self.dfuUtilPathPicker.setFilters(self.tr("All Files (*)")) |
69 self.dfuUtilPathPicker.setFilters(self.tr("All Files (*)")) |
67 |
70 |
68 # set initial values |
71 # set initial values |
|
72 # workspace |
|
73 self.workspacePicker.setText( |
|
74 Utilities.toNativeSeparators( |
|
75 Preferences.getMicroPython("MpyWorkspace") or |
|
76 Utilities.getHomeDir())) |
|
77 |
69 # serial link parameters |
78 # serial link parameters |
70 self.timeoutSpinBox.setValue( |
79 self.timeoutSpinBox.setValue( |
71 Preferences.getMicroPython("SerialTimeout") / 1000) |
80 Preferences.getMicroPython("SerialTimeout") / 1000) |
72 # converted to seconds |
81 # converted to seconds |
73 self.syncTimeCheckBox.setChecked( |
82 self.syncTimeCheckBox.setChecked( |
128 |
137 |
129 def save(self): |
138 def save(self): |
130 """ |
139 """ |
131 Public slot to save the MicroPython configuration. |
140 Public slot to save the MicroPython configuration. |
132 """ |
141 """ |
|
142 # workspace |
|
143 Preferences.setMicroPython( |
|
144 "MpyWorkspace", |
|
145 self.workspacePicker.text()) |
|
146 |
133 # serial link parameters |
147 # serial link parameters |
134 Preferences.setMicroPython( |
148 Preferences.setMicroPython( |
135 "SerialTimeout", |
149 "SerialTimeout", |
136 self.timeoutSpinBox.value() * 1000) |
150 self.timeoutSpinBox.value() * 1000) |
137 # converted to milliseconds |
151 # converted to milliseconds |