Preferences/__init__.py

changeset 942
1d2a6b8509c6
parent 939
10d3a201cd27
child 945
8cd4d08fa9f6
--- a/Preferences/__init__.py	Thu Mar 10 17:40:11 2011 +0100
+++ b/Preferences/__init__.py	Thu Mar 10 19:07:05 2011 +0100
@@ -1332,7 +1332,11 @@
     """
     col = prefClass.settings.value("Editor/Colour/" + key)
     if col is not None:
-        return QtGui.QColor(col)
+        if len(col) == 9:
+            # color string with alpha
+            return QtGui.QColor.fromRgba(int(col[1:],16))
+        else:
+            return QtGui.QColor(col)
     else:
         return prefClass.editorColourDefaults[key]
     
@@ -1344,7 +1348,11 @@
     @param value the colour to be set
     @param prefClass preferences class used as the storage area
     """
-    prefClass.settings.setValue("Editor/Colour/" + key, value.name())
+    if value.alpha() < 255:
+        val = "#{0:8x}".format(value.rgba())
+    else:
+        val = value.name()
+    prefClass.settings.setValue("Editor/Colour/" + key, val)
     
 def getEditorOtherFonts(key, prefClass = Prefs):
     """

eric ide

mercurial