commit-gnue
[Top][All Lists]
Advanced

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

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


From: jamest
Subject: [gnue] r8984 - in trunk/gnue-forms/src: . GFObjects
Date: Tue, 7 Nov 2006 10:50:05 -0600 (CST)

Author: jamest
Date: 2006-11-07 10:50:05 -0600 (Tue, 07 Nov 2006)
New Revision: 8984

Modified:
   trunk/gnue-forms/src/GFForm.py
   trunk/gnue-forms/src/GFObjects/GFField.py
   trunk/gnue-forms/src/GFParser.py
Log:
start of auto_query support


Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py      2006-11-07 16:05:55 UTC (rev 8983)
+++ trunk/gnue-forms/src/GFForm.py      2006-11-07 16:50:05 UTC (rev 8984)
@@ -1089,8 +1089,7 @@
         blockChange = (new_block != self._currentBlock) or row_offset != 0
         pageChange = (new_page != self._currentPage)
 
-        if self._currentEntry:
-
+        if self._currentEntry:            
             # Validation triggers
             self._currentEntry.validate()
             if pageChange:

Modified: trunk/gnue-forms/src/GFObjects/GFField.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFField.py   2006-11-07 16:05:55 UTC (rev 
8983)
+++ trunk/gnue-forms/src/GFObjects/GFField.py   2006-11-07 16:50:05 UTC (rev 
8984)
@@ -98,6 +98,8 @@
         self._rows = 1
         self._gap = 0
 
+        self.__in_auto_query = False
+        
         # This will be populated by GFEntry's initialize
         self._entryList = []
 
@@ -296,17 +298,30 @@
         """
         Set the current value of the field, depending on the state of the form
         and the block.
-        """
-
+        """        
         if isinstance(value, basestring):
             if self.rtrim:
                 value = value.rstrip()
             if self.ltrim:
                 value = value.lstrip()
+        
+        # Auto-query support     
+        # Add an auto-query flag?
+        if ( (not self.__in_auto_query) and 
+             ( 
+               (self.auto_query == 'Y') or                         # Always    
           
+               (self.auto_query == 'NEW' and self._form.isSaved()) # Only on 
new
+             )
+            ):            
+                self.__in_auto_query = True
+                self._form.init_query()
+                self.setValue(value)
+                self._form.execute_query()
+                self.__in_auto_query = False
+        else:
+          self._block.set_value(self, value)
 
-        self._block.set_value(self, value)
 
-
     # -------------------------------------------------------------------------
     # Notification of value change
     # -------------------------------------------------------------------------
@@ -380,11 +395,10 @@
         The focus change is already decided at this moment, there is no way to
         stop the focus from changing now.
         """
-
+                
         if self._block.mode == 'normal':
             self.processTrigger('POST-FOCUSOUT')
 
-
     # -------------------------------------------------------------------------
     # Event handling functions for datasource events
     # -------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/GFParser.py
===================================================================
--- trunk/gnue-forms/src/GFParser.py    2006-11-07 16:05:55 UTC (rev 8983)
+++ trunk/gnue-forms/src/GFParser.py    2006-11-07 16:50:05 UTC (rev 8984)
@@ -643,6 +643,20 @@
                'Label': _('Allow Query'),
                'Typecast': GTypecast.boolean,
                'Default': True },
+            'auto_query': {
+               'Description': 'If {Y} then any changes in this field will '
+                              'cause the form to automatically query and '
+                              'populate itself with matching records.  If '
+                              '{New} it will only automatically query if '
+                              'the form is currenly completely empty.  If '
+                              '{N} then no automatic query will be performed.',
+               'Label': _('Automatic Query'),
+               'ValueSet': {
+                  'Y': {'Label': _('Yes')},
+                  'N': {'Label': _('No')},
+                  'new': {'Label': _('Empty forms only')} },
+               'Typecast': GTypecast.text,
+               'Default': 'N' },
             'ltrim': {
                'Label': _('Trim left spaces'),
                'Description': 'Trim extraneous space at '





reply via email to

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