commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8526 - in trunk/gnue-forms/src: . uidrivers/wx26 uidrivers/wx26/


From: johannes
Subject: [gnue] r8526 - in trunk/gnue-forms/src: . uidrivers/wx26 uidrivers/wx26/widgets
Date: Wed, 5 Jul 2006 09:41:33 -0500 (CDT)

Author: johannes
Date: 2006-07-05 09:41:32 -0500 (Wed, 05 Jul 2006)
New Revision: 8526

Modified:
   trunk/gnue-forms/src/GFConfig.py
   trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/gridline.py
Log:
Make the colors of the grid-rows configurable via gnue.conf
issue87 in-progress


Modified: trunk/gnue-forms/src/GFConfig.py
===================================================================
--- trunk/gnue-forms/src/GFConfig.py    2006-07-05 14:13:58 UTC (rev 8525)
+++ trunk/gnue-forms/src/GFConfig.py    2006-07-05 14:41:32 UTC (rev 8526)
@@ -365,6 +365,24 @@
     'Typecast'   : GTypecast.text,
     'Default'    : '' },
 
+  { 'Name'       : 'grid_color_even',
+    'Type'       : 'Setting',
+    'Comment'    : 'The color of even rows in a grid widget.',
+    'Description': 'The color of even rows in a grid widget. '
+                 + 'Format is either "RRGGBB", each digit being hexadecimal '
+                 + 'or a color name as specified in wx.lib.colourdb.',
+    'Typecast'   : GTypecast.text,
+    'Default'    : 'PALE TURQUOISE' },
+
+  { 'Name'       : 'grid_color_odd',
+    'Type'       : 'Setting',
+    'Comment'    : 'The color of odd rows in a grid widget.',
+    'Description': 'The color of odd rows in a grid widget. '
+                 + 'Format is either "RRGGBB", each digit being hexadecimal '
+                 + 'or a color name as specified in wx.lib.colourdb.',
+    'Typecast'   : GTypecast.text,
+    'Default'    : 'LIGHT STEEL BLUE' },
+
   { 'Name'       : 'DropdownSeparator',
     'Type'       : 'Setting',
     'Comment'    : 'Text used to concatenation dropdown descriptions',

Modified: trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py     2006-07-05 14:13:58 UTC 
(rev 8525)
+++ trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py     2006-07-05 14:41:32 UTC 
(rev 8526)
@@ -37,6 +37,8 @@
   raise Exceptions.DriverNotSupported, \
       _("This GNUe-Forms UI Driver requires at least wx 2.6.")
 
+import wx.lib.colourdb
+
 from gnue.forms.uidrivers._commonGuiToolkit import UIdriver as commonToolkit
 from gnue.forms.uidrivers.wx26 import dialogs, UISplashScreen
 from gnue.common.apps import GConfig
@@ -95,6 +97,8 @@
 
     self.name = "wx 2.6"
     self.app  = wx.GetApp () or wx.App ()
+    wx.lib.colourdb.updateColourDB()
+
     (self.controlHeight, self.cellWidth, self.cellHeight) = self.__getSizes ()
 
     self.textWidth  = self.widgetWidth  = self.cellWidth

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/gridline.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/gridline.py     2006-07-05 
14:13:58 UTC (rev 8525)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/gridline.py     2006-07-05 
14:41:32 UTC (rev 8526)
@@ -74,10 +74,11 @@
             panel.SetSizer(hbx)
 
             if not spacer % 2:
-                color = wx.TheColourDatabase.FindColour('PALETURQUOISE')
+                name = 'grid_color_even'
             else:
-                color = wx.TheColourDatabase.FindColour('LIGHTSTEELBLUE')
+                name = 'grid_color_odd'
 
+            color = self.__load_color_from_string(gConfigForms(name))
             panel.SetBackgroundColour(color)
 
             self._columns.setdefault(spacer, []).append(panel)
@@ -87,7 +88,20 @@
             offset += child.span
 
 
+    # -------------------------------------------------------------------------
+    # Load the given colorname form the database or parse it as hex-rgb-string
+    # -------------------------------------------------------------------------
 
+    def __load_color_from_string(self, value):
+
+        result = wx.TheColourDatabase.FindColour(value)
+        if not result.Ok():
+            (red, green, blue) = value[:2], value[2:4], value[4:6]
+            result = wx.Colour(int(red, 16), int(green, 16), int(blue, 16))
+
+        return result
+
+
     # -------------------------------------------------------------------------
     # Add an UI widget to the Grid container
     # -------------------------------------------------------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]