commit-gnue
[Top][All Lists]
Advanced

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

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


From: reinhard
Subject: [gnue] r8480 - in trunk/gnue-forms/src: . GFObjects
Date: Mon, 22 May 2006 09:33:03 -0500 (CDT)

Author: reinhard
Date: 2006-05-22 09:33:03 -0500 (Mon, 22 May 2006)
New Revision: 8480

Modified:
   trunk/gnue-forms/src/GFForm.py
   trunk/gnue-forms/src/GFObjects/GFButton.py
   trunk/gnue-forms/src/GFParser.py
Log:
Made it possible to attach buttons to actions.


Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py      2006-05-22 13:41:14 UTC (rev 8479)
+++ trunk/gnue-forms/src/GFForm.py      2006-05-22 14:33:03 UTC (rev 8480)
@@ -76,6 +76,9 @@
         # Dictionary to locate named triggers
         self._triggerDictionary = {}
 
+        # Dictionary to locate actions
+        self._actions = {}
+
         # Insert/Overwrite mode
         self._insertMode = True
 

Modified: trunk/gnue-forms/src/GFObjects/GFButton.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFButton.py  2006-05-22 13:41:14 UTC (rev 
8479)
+++ trunk/gnue-forms/src/GFObjects/GFButton.py  2006-05-22 14:33:03 UTC (rev 
8480)
@@ -43,6 +43,7 @@
         GFTabStop.__init__(self, parent, 'GFButton')
 
         self.label = ""
+        self.action = None
 
         self._validTriggers = {
           'ON-ACTION'        : 'On-Action',
@@ -53,7 +54,10 @@
           'ON-NEXT-ENTRY'    : 'On-Next-Entry',
           'ON-PREVIOUS-ENTRY': 'On-Previous-Entry'}
 
+        #: L{gnue.common.logic.usercode.GAction} object linked to this button.
+        self.__action = None
 
+
     # -------------------------------------------------------------------------
     # Implementation of virtual methods
     # -------------------------------------------------------------------------
@@ -70,7 +74,10 @@
         self._rows = getattr(self, 'rows', self._rows)
         self._gap  = getattr(self, 'rowSpacer', self._gap)
 
+        if self.action is not None:
+            self.__action = self._form._actions[self.action]
 
+
     # -------------------------------------------------------------------------
     # Fire the trigger associated with the button from outside GF
     # -------------------------------------------------------------------------
@@ -85,11 +92,11 @@
         if hasattr(self._form._currentEntry, '_displayHandler'):
           self._form._currentEntry._displayHandler.updateFieldValue()
 
-        self.__fire()
+        # Fire the ON-ACTION trigger
+        self.processTrigger('On-Action', False)
 
-    # -------------------------------------------------------------------------
+        # Fire the action
+        if self.__action is not None:
+            self.__action.run()
 
-    def __fire(self):
-
-        self.processTrigger('On-Action', False)
         self._form.refreshDisplay(self._form)

Modified: trunk/gnue-forms/src/GFParser.py
===================================================================
--- trunk/gnue-forms/src/GFParser.py    2006-05-22 13:41:14 UTC (rev 8479)
+++ trunk/gnue-forms/src/GFParser.py    2006-05-22 14:33:03 UTC (rev 8480)
@@ -773,7 +773,10 @@
                               'entries.'},
             'label': {
                'Typecast': GTypecast.name,
-               'Description': 'The text that should appear on the button' } },
+               'Description': 'The text that should appear on the button' },
+            'action': {
+               'Typecast': GTypecast.name,
+               'Description': 'Action to be executed when the button is 
fired'}},
          'Positionable': True,
          'ParentTags': ('page',),
          'Description': 'A visual element with text placed on it, that '





reply via email to

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