eric6/Preferences/ConfigurationPages/MicroPythonPage.py

branch
micropython
changeset 7079
d1564b590677
child 7086
b757db426076
diff -r bca506f8c756 -r d1564b590677 eric6/Preferences/ConfigurationPages/MicroPythonPage.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eric6/Preferences/ConfigurationPages/MicroPythonPage.py	Mon Jul 22 19:19:06 2019 +0200
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing the MicroPython configuration page.
+"""
+
+from __future__ import unicode_literals
+
+from .ConfigurationPageBase import ConfigurationPageBase
+from .Ui_MicroPythonPage import Ui_MicroPythonPage
+
+import Preferences
+
+from MicroPython.MicroPythonReplWidget import AnsiColorSchemes
+
+
+class MicroPythonPage(ConfigurationPageBase, Ui_MicroPythonPage):
+    """
+    Class implementing the MicroPython configuration page.
+    """
+    def __init__(self, parent=None):
+        """
+        Constructor
+        
+        @param parent reference to the parent widget
+        @type QWidget
+        """
+        super(MicroPythonPage, self).__init__()
+        self.setupUi(self)
+        self.setObjectName("MicroPythonPage")
+        
+        self.colorSchemeComboBox.addItems(sorted(AnsiColorSchemes.keys()))
+        
+        # set initial values
+        self.colorSchemeComboBox.setCurrentIndex(
+            self.colorSchemeComboBox.findText(
+                Preferences.getMicroPython("ColorScheme")))
+    
+    def save(self):
+        """
+        Public slot to save the MicroPython configuration.
+        """
+        Preferences.setMicroPython(
+            "ColorScheme", self.colorSchemeComboBox.currentText())
+    
+
+def create(dlg):
+    """
+    Module function to create the configuration page.
+    
+    @param dlg reference to the configuration dialog
+    @return reference to the instantiated page (ConfigurationPageBase)
+    """
+    page = MicroPythonPage()
+    return page

eric ide

mercurial