Preferences/ConfigurationPages/ConfigurationPageBase.py

changeset 2228
5c59b9393306
parent 1509
c0b5e693b0eb
child 2229
78539385a8df
diff -r b7aceb255831 -r 5c59b9393306 Preferences/ConfigurationPages/ConfigurationPageBase.py
--- a/Preferences/ConfigurationPages/ConfigurationPageBase.py	Sun Nov 25 18:40:15 2012 +0100
+++ b/Preferences/ConfigurationPages/ConfigurationPageBase.py	Sun Nov 25 20:11:13 2012 +0100
@@ -40,13 +40,14 @@
         """
         return
         
-    def initColour(self, colourstr, button, prefMethod):
+    def initColour(self, colourstr, button, prefMethod, selectSlot=None):
         """
         Public method to initialize a colour selection button.
         
         @param colourstr colour to be set (string)
         @param button reference to a button to show the colour on (QPushButton)
         @param prefMethod preferences method to get the colour
+        @param selectSlot method to select the color
         @return reference to the created colour (QColor)
         """
         colour = QColor(prefMethod(colourstr))
@@ -55,6 +56,9 @@
         pm.fill(colour)
         button.setIconSize(pm.size())
         button.setIcon(QIcon(pm))
+        button.setProperty("colorName", colourstr)
+        if selectSlot is not None:
+            button.clicked[()].connect(selectSlot)
         return colour
         
     def selectColour(self, button, colourVar, showAlpha=False):

eric ide

mercurial