commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r9003 - in trunk/gnue-forms/src: . GFObjects


From: reinhard
Subject: [gnue] r9003 - in trunk/gnue-forms/src: . GFObjects
Date: Wed, 8 Nov 2006 12:24:29 -0600 (CST)

Author: reinhard
Date: 2006-11-08 12:24:28 -0600 (Wed, 08 Nov 2006)
New Revision: 9003

Modified:
   trunk/gnue-forms/src/GFObjects/GFEntry.py
   trunk/gnue-forms/src/GFParser.py
Log:
Added new style "auto" for entries.


Modified: trunk/gnue-forms/src/GFObjects/GFEntry.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFEntry.py   2006-11-08 16:59:46 UTC (rev 
9002)
+++ trunk/gnue-forms/src/GFObjects/GFEntry.py   2006-11-08 18:24:28 UTC (rev 
9003)
@@ -87,13 +87,21 @@
         if not hasattr(self, 'Char__width'):
             self.Char__width  = int(gConfigForms('widgetWidth'))
 
+        # Select "auto" style
+        if self.style == 'auto':
+            if hasattr(self._field, 'fk_source'):
+                self.style = 'dropdown'
+            elif self._field.datatype == 'boolean':
+                self.style = 'checkbox'
+            else:
+                self.style = 'default'
+
         # Have a look wether the entry will be navigable or not
-        style = self.style.lower()
-        if style == 'label':
+        if self.style == 'label':
             self.navigable = False
 
         if not self._form._layout.managed:
-            if style == 'default' and self.Char__height > 1:
+            if self.style == 'default' and self.Char__height > 1:
                 self.style = 'multiline'
 
 

Modified: trunk/gnue-forms/src/GFParser.py
===================================================================
--- trunk/gnue-forms/src/GFParser.py    2006-11-08 16:59:46 UTC (rev 9002)
+++ trunk/gnue-forms/src/GFParser.py    2006-11-08 18:24:28 UTC (rev 9003)
@@ -753,6 +753,7 @@
             'style': {
                'Typecast': GTypecast.name,
                'ValueSet': {
+                  'auto': {'Label': _('Automatic')},
                   'default': {'Label': _('Default')},
                   'password': {'Label': _('Password/Hidden')},
                   'dropdown': {'Label': _('Dropdown/Combo box')},
@@ -760,7 +761,7 @@
                   'checkbox': {'Label': _('Checkbox')},
                   'multiline': {'Label': _('Multiline-Edit')},
                   'label': {'Label': _('Label (non-editable)')} },
-               'Default': 'default',
+               'Default': 'auto',
                'Description': 'The style of entry widget requested. '
                               'Currently either {text}, {label}, {checkbox}, '
                               '{listbox}, or {dropdown}. To use {listbox} or '





reply via email to

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