[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r6638 - in trunk: gnue-common/etc gnue-forms/src gnue-forms/src/uidriver
From: |
kilo |
Subject: |
r6638 - in trunk: gnue-common/etc gnue-forms/src gnue-forms/src/uidrivers/gtk2/widgets |
Date: |
Fri, 5 Nov 2004 17:27:24 -0600 (CST) |
Author: kilo
Date: 2004-11-05 17:27:24 -0600 (Fri, 05 Nov 2004)
New Revision: 6638
Modified:
trunk/gnue-common/etc/sample.gnue.conf
trunk/gnue-forms/src/GFConfig.py
trunk/gnue-forms/src/uidrivers/gtk2/widgets/_base.py
Log:
Highlight currently focused entry
Focus color can be set or switched off in gnue.conf.
Modified: trunk/gnue-common/etc/sample.gnue.conf
===================================================================
--- trunk/gnue-common/etc/sample.gnue.conf 2004-11-05 23:00:09 UTC (rev
6637)
+++ trunk/gnue-common/etc/sample.gnue.conf 2004-11-05 23:27:24 UTC (rev
6638)
@@ -143,6 +143,11 @@
# Font size if fixedWidthFont = 1 (ignored otherwise)
#pointSize = 14
+# The color of a highlighted widget. If commented out, no highlights are placed
+# on focused widgets. Defines an RGB triplet, format is RRGGBB, each digit is
+# hexadecimal.
+focusColor = FFFFEC
+
#_msgNOTSAVED = Data not saved. Save changes or clear the form to proceed.
#_msgDETAILNOTSAVED = This record's detail information is not saved.
Modified: trunk/gnue-forms/src/GFConfig.py
===================================================================
--- trunk/gnue-forms/src/GFConfig.py 2004-11-05 23:00:09 UTC (rev 6637)
+++ trunk/gnue-forms/src/GFConfig.py 2004-11-05 23:27:24 UTC (rev 6638)
@@ -382,6 +382,13 @@
'Typecast' : GTypecast.text,
'Default' : 'auto' },
+ { 'Name' : 'focusColor',
+ 'Type' : 'Setting',
+ 'Comment' : 'The color of a highlighted (ie focused) widget. Leave
empty if you don\'t want highlight. Format is: "RRGGBB", each digit being
hexadecimal.',
+ 'Description': 'The color of a highlighted (ie focused) widget. Leave
empty if you don\'t want highlight. Format is: "RRGGBB", each digit being
hexadecimal.',
+ 'Typecast' : GTypecast.text,
+ 'Default' : '' },
+
#
# Do not alter below here unless you really, really want to (and you know
what you are doing)
#
Modified: trunk/gnue-forms/src/uidrivers/gtk2/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/widgets/_base.py 2004-11-05
23:00:09 UTC (rev 6637)
+++ trunk/gnue-forms/src/uidrivers/gtk2/widgets/_base.py 2004-11-05
23:27:24 UTC (rev 6638)
@@ -190,7 +190,8 @@
"""
This function set's the focus to the gtk-widget specified by index. If the
widget has a focusHandler it will be blocked and unblocked to prevent a
- recursion.
+ recursion. The focused widget will have a highlight color if it is set
+ in gnue.conf.
"""
widget = self.widgets [index]
gDebug (1, "indexedFocus: %s [%s]" % (widget, index))
@@ -204,22 +205,27 @@
#Make the focused widget's color different
+ #if focus color is set in gnue.conf.
#We store the widget's original color so we can set it back to normal
#when it loses focus.
- #TODO: move focus color spec to config, or if not in config, skip all this
#TODO: CheckButtons don't get colored...
- if isinstance(item, gtk.Button):
- try:
- item.__color
- except:
- item.__color = item.get_style().bg[gtk.STATE_NORMAL]
- item.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#FFFFEC'))
- else:
- try:
- item.__color
- except:
- item.__color = item.get_style().base[gtk.STATE_NORMAL]
- item.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse('#FFFFEC'))
+ try:
+ if gConfigForms('focusColor'):
+ focusColor = gtk.gdk.color_parse('#' + gConfigForms('focusColor'))
+ if isinstance(item, gtk.Button):
+ try:
+ item.__color
+ except:
+ item.__color = item.get_style().bg[gtk.STATE_NORMAL]
+ item.modify_bg(gtk.STATE_NORMAL, focusColor)
+ else:
+ try:
+ item.__color
+ except:
+ item.__color = item.get_style().base[gtk.STATE_NORMAL]
+ item.modify_base(gtk.STATE_NORMAL, focusColor)
+ except:
+ pass
# To avoid the automatic select-all in a combo box, we explicitly set the
# selection to the current position only
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r6638 - in trunk: gnue-common/etc gnue-forms/src gnue-forms/src/uidrivers/gtk2/widgets,
kilo <=