commit-gnue
[Top][All Lists]
Advanced

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

gnue common/doc/TriggerSpecifications.txt commo...


From: James Thompson
Subject: gnue common/doc/TriggerSpecifications.txt commo...
Date: Fri, 01 Feb 2002 00:07:15 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     James Thompson <address@hidden> 02/02/01 00:07:14

Modified files:
        common/doc     : TriggerSpecifications.txt 
        common/src     : GTrigger.py GTriggerCore.py 
        forms/samples/trigger: trigger.gfd 
        forms/src      : GFForm.py 
        forms/src/GFObjects: GFEntry.py 

Log message:
        Added support for global functions in triggers
        bug fixes
        more trigger.gfd samples
        trigger namespace additions
        global setFocus(not working yet)
        entry __properties__.readonly

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/doc/TriggerSpecifications.txt.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GTrigger.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GTriggerCore.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/samples/trigger/trigger.gfd.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFForm.py.diff?tr1=1.143&tr2=1.144&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFEntry.py.diff?tr1=1.36&tr2=1.37&r1=text&r2=text

Patches:
Index: gnue/common/doc/TriggerSpecifications.txt
diff -c gnue/common/doc/TriggerSpecifications.txt:1.13 
gnue/common/doc/TriggerSpecifications.txt:1.14
*** gnue/common/doc/TriggerSpecifications.txt:1.13      Wed Jan 30 13:54:44 2002
--- gnue/common/doc/TriggerSpecifications.txt   Fri Feb  1 00:07:14 2002
***************
*** 275,286 ****
  
  * Any object from the top level object is referenced by it's name
  
! * a dictionary exists ()_triggerNamespace and will be populated by the GObj 
based 
!   object's author.  It will contain references to functions and attributes. 
  
-   _triggerNamespace = {
-                         'exposedName', internal var or function
-                       }
    This will be used to construct the object tree described below
  
  * Any object can tag itself as a global object which will make it available
--- 275,289 ----
  
  * Any object from the top level object is referenced by it's name
  
! * a dictionary exists ()_triggerFunctions and will be populated by the GObj 
based 
!   object's author.  It will contain references to functions
! 
!   _triggerFunctions = {
!                          'exposedFunctionName', { 'function', functionlink,
!                                                   'glcbal', function will be 
put in global namespace
!                                                 } 
!                        }
  
    This will be used to construct the object tree described below
  
  * Any object can tag itself as a global object which will make it available
***************
*** 288,306 ****
  
  * Any object can reference itself via a self. reference or it's own name
  
! * A hook will be made available for internal properties manipulation
    _triggerProperties = {
                           'exposedPropertyName', { 'set', function that will 
set the value
                                                    'get', function that will 
get the value
                                                  } 
                         }
  
- * transparent objects can opt out of the trigger namespace yet allow their 
-   children to be in
  
  
! At init time the GObj tree is parsed.  The following objects are created and 
placed
! into a global trigger namespace.  Any objects found in the tree that request 
global
  namespace assignment also get put into the global namespace.  
  
  GTriggerObject
--- 291,313 ----
  
  * Any object can reference itself via a self. reference or it's own name
  
! * A hook will be made available for internal properties manipulation these
!   properties are available via __properties__ 
! 
    _triggerProperties = {
                           'exposedPropertyName', { 'set', function that will 
set the value
                                                    'get', function that will 
get the value
                                                  } 
                         }
  
  
+   example :   form.block.__properties__.exposedPropertyName
+ 
+ 
+ * named triggers should be callable in a trigger
  
! At init time the GObj tree is parsed.  The following objects are created to 
provide the 
! trigger namespace.  Any objects found in the tree that request global
  namespace assignment also get put into the global namespace.  
  
  GTriggerObject
***************
*** 309,315 ****
    * Contains attributes that link to GTriggerFunction and GTriggerAttribute 
objects
    * Contains the following extra attributes: 
    *   self
!   *   properties
  
  GTriggerFunction 
    * Created for each function that needs linked into a GTriggerObject
--- 316,322 ----
    * Contains attributes that link to GTriggerFunction and GTriggerAttribute 
objects
    * Contains the following extra attributes: 
    *   self
!   *   __properties__
  
  GTriggerFunction 
    * Created for each function that needs linked into a GTriggerObject
***************
*** 335,341 ****
                          it's children up to look as if they are assigned to 
this object's
                          parent in the trigger namespace.
  
!   _triggerNamespace : the local trigger namespace
  
    _triggerProperties : internal hooks into the GObj
  
--- 342,348 ----
                          it's children up to look as if they are assigned to 
this object's
                          parent in the trigger namespace.
  
!   _triggerFunctions : the local trigger functions
  
    _triggerProperties : internal hooks into the GObj
  
Index: gnue/common/src/GTrigger.py
diff -c gnue/common/src/GTrigger.py:1.7 gnue/common/src/GTrigger.py:1.8
*** gnue/common/src/GTrigger.py:1.7     Thu Jan 31 21:25:51 2002
--- gnue/common/src/GTrigger.py Fri Feb  1 00:07:14 2002
***************
*** 80,85 ****
--- 80,86 ----
      
      if isinstance(gobjObject,GObj) and hasattr(gobjObject,'name'): 
        triggerObject = GTriggerNSObject(triggerParent)
+       triggerObject._object = gobjObject
  
        # Add this triggerObject to global namespace if the GObj requests it
        if gobjObject._triggerGlobal:
***************
*** 90,103 ****
        triggerObject._triggerGet = gobjObject._triggerGet
        
        # Add any trigger methods defined by GObj 
!       if len(gobjObject._triggerNamespace):
!         for item in gobjObject._triggerNamespace.keys():
            
!           if type(gobjObject._triggerNamespace[item]) == types.MethodType:
!             object = 
GTriggerNSFunction(item,gobjObject._triggerNamespace[item])                     
   
              triggerObject.__dict__[item] = object
            else:
!             GDebug.printMesg(0,'Only functions are supported in an objects 
_triggerNamespace %s %s' % (gobjObject,item))
              
              sys.exit()
  
--- 91,109 ----
        triggerObject._triggerGet = gobjObject._triggerGet
        
        # Add any trigger methods defined by GObj 
!       if len(gobjObject._triggerFunctions):
!         for item in gobjObject._triggerFunctions.keys():
            
!           if type(gobjObject._triggerFunctions[item]['function']) == 
types.MethodType:
!             object = 
GTriggerNSFunction(item,gobjObject._triggerFunctions[item]['function'])         
               
              triggerObject.__dict__[item] = object
+             # Add this function to global namespace if the GObj requests it
+             if gobjObject._triggerFunctions[item].has_key('global') and \
+                gobjObject._triggerFunctions[item]['global'] != 0:
+               self._globalNamespace[item] = object
+                             
            else:
!             GDebug.printMesg(0,'Only functions are supported in an objects 
_triggerFunctions %s %s' % (gobjObject,item))
              
              sys.exit()
  
***************
*** 105,112 ****
        # GTriggerNSObjectProperties instance
        if len(gobjObject._triggerProperties):
          for item in gobjObject._triggerProperties.keys():
!           
triggerObject._triggerProperties.addProperty(item,gobjObject._triggerProperties[item]['get'],\
!                                                             
gobjObject._triggerProperties[item]['set'])
  
        # Process the children of this Gobj 
        if len(gobjObject._children):
--- 111,121 ----
        # GTriggerNSObjectProperties instance
        if len(gobjObject._triggerProperties):
          for item in gobjObject._triggerProperties.keys():
!           if gobjObject._triggerProperties[item].has_key('set'):
!             setFunc = gobjObject._triggerProperties[item]['set']
!           else:
!             setFunc = None
!           
triggerObject._triggerProperties.addProperty(item,gobjObject._triggerProperties[item]['get'],
 setFunc)
  
        # Process the children of this Gobj 
        if len(gobjObject._children):
***************
*** 136,141 ****
--- 145,151 ----
      self._triggerProperties = GTriggerNSObjectProperties()
      self._triggerSet = None
      self._triggerGet = None
+     self._object = None
      
    #
    # showTree
***************
*** 221,226 ****
--- 231,241 ----
        return -1
      else:
        return 1
+ 
+ 
+   def __nonzero__(self):
+     return 1
+ 
  #
  # Needed but causing issues (local namespace setup bad?)
  #
Index: gnue/common/src/GTriggerCore.py
diff -c gnue/common/src/GTriggerCore.py:1.3 gnue/common/src/GTriggerCore.py:1.4
*** gnue/common/src/GTriggerCore.py:1.3 Thu Jan 31 21:25:51 2002
--- gnue/common/src/GTriggerCore.py     Fri Feb  1 00:07:14 2002
***************
*** 38,44 ****
  class GTriggerCore:
    def __init__(self):
      self._triggerGlobal = 0
!     self._triggerNamespace = {}
      self._triggerProperties = {}
  
      #
--- 38,44 ----
  class GTriggerCore:
    def __init__(self):
      self._triggerGlobal = 0
!     self._triggerFunctions = {}
      self._triggerProperties = {}
  
      #
Index: gnue/forms/samples/trigger/trigger.gfd
diff -c gnue/forms/samples/trigger/trigger.gfd:1.13 
gnue/forms/samples/trigger/trigger.gfd:1.14
*** gnue/forms/samples/trigger/trigger.gfd:1.13 Thu Jan 31 21:25:51 2002
--- gnue/forms/samples/trigger/trigger.gfd      Fri Feb  1 00:07:14 2002
***************
*** 12,26 ****
      <block name="block1">
        <label x="1" y="1" name="Label_1" alignment="center" width="48"
               text="Field One"/>
!       <entry x="1" y="2" name="one" width="48"/>
        <label x="1" y="3" name="Label_2" text="Field Two"/>
!       <entry x="1" y="4" name="two" width="48"/>
        <label x="1" y="5" name="Label_1a" text="Field Three"/>
        <entry x="1" y="6" name="three" width="48"/>
        <label x="1" y="7" name="Label_2a" text="Field Four"/>
        <entry x="1" y="8" name="four" width="48"/>
        <label x="1" y="9" name="Label_3a" text="Field Five"/>
!       <entry x="1" y="10" name="five" width="48"/>
  
      </block>
      <block name="block2">
--- 12,41 ----
      <block name="block1">
        <label x="1" y="1" name="Label_1" alignment="center" width="48"
               text="Field One"/>
!       <entry x="1" y="2" name="one" width="48">
!         <trigger name="Trigger_A" type="PRE-FOCUSOUT">
!            block1.three.__properties__.readonly = True
!            block1.three = "You can't change me till you exit field 5!"
!         </trigger>
!       </entry>
! 
        <label x="1" y="3" name="Label_2" text="Field Two"/>
!       <entry x="1" y="4" name="two" width="48">
!         <trigger name="Trigger_A" type="PRE-FOCUSOUT">
!            setFocus(block2.alter)
!         </trigger>
!       </entry>
        <label x="1" y="5" name="Label_1a" text="Field Three"/>
        <entry x="1" y="6" name="three" width="48"/>
        <label x="1" y="7" name="Label_2a" text="Field Four"/>
        <entry x="1" y="8" name="four" width="48"/>
        <label x="1" y="9" name="Label_3a" text="Field Five"/>
!       <entry x="1" y="10" name="five" width="48">
!         <trigger name="Trigger_B" type="PRE-FOCUSOUT">
!            block1.three.__properties__.readonly = False
!            block1.three = 'You can change me!'
!         </trigger>
!       </entry>
  
      </block>
      <block name="block2">
***************
*** 37,43 ****
           print block2.alter
           # Function test
           print "Function test - global form var test"
!          print form.Page_1.block2.alter.testFunc()
  
  
           # Test to make sure assignment doesn't copy the objects only
--- 52,62 ----
           print block2.alter
           # Function test
           print "Function test - global form var test"
!          print form.Page_1.block2.alter.allowedValues()
! 
!          #
!          # Test global
!          #print testFunc()
  
  
           # Test to make sure assignment doesn't copy the objects only
***************
*** 50,58 ****
  
           # Properties
           print "Showing property"
!          print block2.alter.__properties__.rows
           print "Attempt to set a readonly property"
!          block2.alter.__properties__.rows = 23
  
           # Comparison
           if block1.one == block1.two:
--- 69,77 ----
  
           # Properties
           print "Showing property"
!          print block2.alter.__properties__.readonly
           print "Attempt to set a readonly property"
!          block2.alter.__properties__.readonly = 23
  
           # Comparison
           if block1.one == block1.two:
***************
*** 82,89 ****
           print "Value"
           print self
  
!          print "rows"
!          print self.__properties__.rows
  
           # Things that don't work but probably should and how to fix it
           #
--- 101,108 ----
           print "Value"
           print self
  
!          print "readonly"
!          print self.__properties__.readonly
  
           # Things that don't work but probably should and how to fix it
           #
***************
*** 95,118 ****
           #  not a string so it fails when the lower function attempts
           #  to call a lower() function that GTriggerNSObject doesn't implement
           #  No good solution known at this time)
- 
- 
-          #
-          # Completely untested
-          #
-          #  #print block1.fields.two
-          #  #block1.fields.one = 
-          #  import sys
-          #  print "Value is ",self.getValue()
-          #  if (block1.fields.one == "") or (block1.fields.two == ""):
-          #    messageValue = "Both Fields One and Two Must Have Data!"
-          #  else:
-          #    messageValue = "Contragulations.  You get your own error.\n" + 
block2.fields.alter
-          #
-          #  print messageValue
-          #  block1.fields.one = block2.fields.alter
-          #  #message = GFMsgBox(self, messageValue)
-          #  #message.show()
           </trigger>
        </entry>
      </block>
--- 114,119 ----
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.143 gnue/forms/src/GFForm.py:1.144
*** gnue/forms/src/GFForm.py:1.143      Thu Jan 31 21:25:51 2002
--- gnue/forms/src/GFForm.py    Fri Feb  1 00:07:14 2002
***************
*** 87,92 ****
--- 87,96 ----
      # New trigger support
      # 
      self._triggerGlobal = 1
+     self._triggerFunctions = {'setFocus':{'function':self.triggerSetFocus,
+                                           'global': 1,
+                                           },
+                               }
      
    def _buildObject(self):
  
***************
*** 341,346 ****
--- 345,351 ----
  
      try:
        if not self.readonly:
+         # Form level pre-commit
          try:
            self.processTrigger('Pre-Commit')
          except TriggerError:
***************
*** 422,430 ****
      try:
        self._currentEntry.processTrigger('Pre-FocusOut')
        self._currentEntry.processTrigger('Post-FocusOut')
-       widget.processTrigger('Pre-FocusIn')
  
        oldEntry = self._currentEntry
        self._currentEntry = widget
        self._currentBlock = self._currentEntry._block
  
--- 427,436 ----
      try:
        self._currentEntry.processTrigger('Pre-FocusOut')
        self._currentEntry.processTrigger('Post-FocusOut')
  
+       widget.processTrigger('Pre-FocusIn')
        oldEntry = self._currentEntry
+       
        self._currentEntry = widget
        self._currentBlock = self._currentEntry._block
  
***************
*** 857,859 ****
--- 863,869 ----
    def dumpXML(self, treeDump=1, gap="  "):
      return GObj.dumpXML(self, GFParser.getXMLelements(), treeDump, gap)
  
+ 
+   def triggerSetFocus(self,object):
+     print "If i was working then %s would now have focus" % object._object
+     # self.changeFocus(object._object)
Index: gnue/forms/src/GFObjects/GFEntry.py
diff -c gnue/forms/src/GFObjects/GFEntry.py:1.36 
gnue/forms/src/GFObjects/GFEntry.py:1.37
*** gnue/forms/src/GFObjects/GFEntry.py:1.36    Thu Jan 31 21:25:51 2002
--- gnue/forms/src/GFObjects/GFEntry.py Fri Feb  1 00:07:14 2002
***************
*** 72,82 ****
      #
      # Trigger exposure
      #
!     self._triggerNamespace={'testFunc':self.testFunc,
                              }
!     self._triggerProperties={'rows':{'set':None,
!                                      'get':self.getRows
!                                      },
                               }
      self._triggerSet = self.setValue
      self._triggerGet = self.getValue
--- 72,84 ----
      #
      # Trigger exposure
      #
!     self._triggerFunctions={'allowedValues':{'function':self.allowedValues,
!                                              },
                              }
!     
!     self._triggerProperties={'readonly':{'set':self.setReadonly,
!                                          'get':self.getReadonly
!                                          },
                               }
      self._triggerSet = self.setValue
      self._triggerGet = self.getValue
***************
*** 85,94 ****
      #return "I have to do something"
      return "Fooooooooooooo!"
  
!   def getRows(self):
!     return self._rows
! 
! 
      
    def _buildObject(self):
      # Convert deprecated attributes
--- 87,96 ----
      #return "I have to do something"
      return "Fooooooooooooo!"
  
!   def getReadonly(self):
!     return self.readonly
!   def setReadonly(self,value):
!     self.readonly = value
      
    def _buildObject(self):
      # Convert deprecated attributes



reply via email to

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