eric6/Preferences/__init__.py

changeset 7705
90a9aefd4253
parent 7690
a59680062837
child 7711
5e6792b85a8a
--- a/eric6/Preferences/__init__.py	Sat Sep 19 19:04:21 2020 +0200
+++ b/eric6/Preferences/__init__.py	Sun Sep 20 18:32:28 2020 +0200
@@ -1468,6 +1468,15 @@
         microPythonDefaults["ColorScheme"] = "xterm"
     else:
         microPythonDefaults["ColorScheme"] = "Ubuntu"
+    
+    # defaults for Python specific settings
+    pythonDefaults = {
+        "ASTViewerErrorColor": QColor(Qt.red),
+        
+        "DisViewerErrorColor": QColor(Qt.red),
+        "DisViewerCurrentColor": QColor(Qt.magenta),
+        "DisViewerLabeledColor": QColor(Qt.green),
+    }
 
 
 def readToolGroups(prefClass=Prefs):
@@ -1793,8 +1802,15 @@
             else:
                 exts.append(".{0}".format(ext))
         return exts
-    
-    return None
+    elif key in (
+        "ASTViewerErrorColor", "DisViewerErrorColor",
+        "DisViewerCurrentColor", "DisViewerLabeledColor",
+    ):
+        return QColor(prefClass.settings.value(
+            "Python/" + key, prefClass.pythonDefaults[key]))
+    else:
+        return prefClass.settings.value(
+            "Python/" + key, prefClass.pythonDefaults[key])
 
 
 def setPython(key, value, prefClass=Prefs):
@@ -1807,6 +1823,17 @@
     """
     if key == "Python3Extensions":
         setDebugger(key, value, prefClass)
+    elif key in (
+        "ASTViewerErrorColor", "DisViewerErrorColor",
+        "DisViewerCurrentColor", "DisViewerLabeledColor",
+    ):
+        if value.alpha() < 255:
+            val = "#{0:8x}".format(value.rgba())
+        else:
+            val = value.name()
+        prefClass.settings.setValue("Python/" + key, val)
+    else:
+        prefClass.settings.setValue("Python/" + key, value)
 
 
 def getUILanguage(prefClass=Prefs):
@@ -3347,7 +3374,7 @@
     @param prefClass preferences class used as the storage area
     """
     prefClass.settings.setValue("IRC/" + key, value)
-    
+
 
 def getHexEditor(key, prefClass=Prefs):
     """

eric ide

mercurial