|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the MicroPython configuration page. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from .ConfigurationPageBase import ConfigurationPageBase |
|
13 from .Ui_MicroPythonPage import Ui_MicroPythonPage |
|
14 |
|
15 import Preferences |
|
16 |
|
17 from MicroPython.MicroPythonReplWidget import AnsiColorSchemes |
|
18 |
|
19 |
|
20 class MicroPythonPage(ConfigurationPageBase, Ui_MicroPythonPage): |
|
21 """ |
|
22 Class implementing the MicroPython configuration page. |
|
23 """ |
|
24 def __init__(self, parent=None): |
|
25 """ |
|
26 Constructor |
|
27 |
|
28 @param parent reference to the parent widget |
|
29 @type QWidget |
|
30 """ |
|
31 super(MicroPythonPage, self).__init__() |
|
32 self.setupUi(self) |
|
33 self.setObjectName("MicroPythonPage") |
|
34 |
|
35 self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys())) |
|
36 |
|
37 # set initial values |
|
38 self.colorSchemeComboBox.setCurrentIndex( |
|
39 self.colorSchemeComboBox.findText( |
|
40 Preferences.getMicroPython("ColorScheme"))) |
|
41 |
|
42 def save(self): |
|
43 """ |
|
44 Public slot to save the MicroPython configuration. |
|
45 """ |
|
46 Preferences.setMicroPython( |
|
47 "ColorScheme", self.colorSchemeComboBox.currentText()) |
|
48 |
|
49 |
|
50 def create(dlg): |
|
51 """ |
|
52 Module function to create the configuration page. |
|
53 |
|
54 @param dlg reference to the configuration dialog |
|
55 @return reference to the instantiated page (ConfigurationPageBase) |
|
56 """ |
|
57 page = MicroPythonPage() |
|
58 return page |