commit-gnue
[Top][All Lists]
Advanced

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

r5035 - in trunk/gnue-common/src: definitions logic


From: jamest
Subject: r5035 - in trunk/gnue-common/src: definitions logic
Date: Thu, 15 Jan 2004 22:23:28 -0600 (CST)

Author: jamest
Date: 2004-01-15 22:23:27 -0600 (Thu, 15 Jan 2004)
New Revision: 5035

Modified:
   trunk/gnue-common/src/definitions/GObjects.py
   trunk/gnue-common/src/logic/GTrigger.py
Log:
removed printTree() from base GObj showTree() works 
better and supports things like triggers which break
printTree()
more epydocs for trigger related things


Modified: trunk/gnue-common/src/definitions/GObjects.py
===================================================================
--- trunk/gnue-common/src/definitions/GObjects.py       2004-01-15 01:09:42 UTC 
(rev 5034)
+++ trunk/gnue-common/src/definitions/GObjects.py       2004-01-16 04:23:27 UTC 
(rev 5035)
@@ -81,21 +81,6 @@
     """
     return self._parent
 
-  def printTree(self, indent=0):
-    """
-    A recusive function to print an indented text representation of
-    the GObj tree from this object down.
-
-    This is usefull for debugging purposes.
-
-    @param indent: Sets the level of indention.  Used during recursion
-                   to properly indent the tree.
-    @type indent: int
-    """
-    print " " * indent * 2, self
-    for child in self._children:
-      child.printTree(indent+1)
-
   #
   # phaseInit
   #
@@ -198,10 +183,20 @@
     return content
 
   def showTree(self, indent=0):
+    """
+    A recusive function to print an indented text representation of
+    the GObj tree from this object down.
+    
+    This is usefull for debugging purposes.
+    
+    @param indent: Sets the level of indention.  Used during recursion
+    to properly indent the tree.
+    @type indent: int
+    """
     print ' ' * indent + `self._type`,self
-
+    
     for child in self._children:
-       child.showTree(indent + 2)
+      child.showTree(indent + 2)
 
   #
   # addChild

Modified: trunk/gnue-common/src/logic/GTrigger.py
===================================================================
--- trunk/gnue-common/src/logic/GTrigger.py     2004-01-15 01:09:42 UTC (rev 
5034)
+++ trunk/gnue-common/src/logic/GTrigger.py     2004-01-16 04:23:27 UTC (rev 
5035)
@@ -158,13 +158,11 @@
   def dummyFunction(self, myself):
     GDebug.printMesg(0, "Trigger not implemented")
 
-  #
-  # getDescription
-  #
-  # Return a useful description of this object
-  # for use by designer
-  #
   def getDescription(self):
+    """
+    Return a useful description of this object
+    for use by designer
+    """
     if self.type == 'NAMED':
       return self.name
     else:
@@ -173,10 +171,12 @@
   #
   # dumpXML
   #
-  # Dumps an XML representation of the object
-  # used in saving
   #
   def dumpXML(self, lookupDict, treeDump=None, gap=None,xmlnamespaces={}):
+    """
+    Dumps an XML representation of a trigger.
+    used in saving.     
+    """
     try:
       escape = not int(gConfig('StoreTriggersAsCDATA'))
     except:
@@ -248,23 +248,22 @@
 #
 # Trigger processor classes
 #
-# GTriggerExtension
-#
-# Objects that inherit this class will be
-# capable of processing triggers
-#
 class GTriggerExtension:
+  """
+  Objects that inherit this class will be
+  capable of processing triggers.
+  """
   def __init__(self):
     self._trigger = {}
     
     #self._validTriggers = validTriggers 
 
-  # associateTrigger
-  #
-  # Associates a trigger with the object.  More than one trigger of a specific 
type
-  # can be associated with an object
-  #
   def associateTrigger(self, key, function):
+    """
+    Associates a trigger with the object.  More than one trigger of a specific 
type
+    can be associated with an object.  This function is typically automatically
+    called during tree construction from xml source (A GObj tree)
+    """
     key = string.upper(key)
     if key in self._validTriggers.keys():
       if not self._trigger.has_key(key):
@@ -273,10 +272,18 @@
     else:
       GDebug.printMesg(0, "%s %s" % (_("Invalid trigger "),key))
 
-  # processTrigger
-  #
-  # "fires" the trigger
   def processTrigger(self, key):
+    """
+    Fires the requested trigger if a trigger of that type
+    has been associated with this object.
+    
+    B{Note:} You cannot fire a trigger before phase 3 of a gnue object
+    tree phased init.
+    
+    @param key: The name of the trigger
+    @type key: string
+    
+    """
     key = string.upper(key)
     if key in self._validTriggers.keys():
       if self._trigger.has_key(key):
@@ -294,16 +301,14 @@
       GDebug.printMesg(0, "%s: %s %s" % (self._type,_("Invalid trigger "),key))
       #print self._type,": ",_("Invalid trigger "),key
 
-
-#
-# Return any XML elements associated with
-# GTriggers.  Bases is a dictionary of tags
-# whose values are update dictionaries.
-# For example: bases={'datasource': {'BaseClass':myDataSource}}
-# sets xmlElements['datasource']['BaseClass'] = myDataSource
-#
 def getXMLelements(updates={}):
-
+  """
+  Return any XML elements associated with
+  GTriggers.  Bases is a dictionary of tags
+  whose values are update dictionaries.
+  For example: bases={'datasource': {'BaseClass':myDataSource}}
+  sets xmlElements['datasource']['BaseClass'] = myDataSource
+  """
   xmlElements = {
       'trigger': {
          'BaseClass': GTrigger,





reply via email to

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