commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8434 - trunk/gnue-common/src/logic


From: reinhard
Subject: [gnue] r8434 - trunk/gnue-common/src/logic
Date: Wed, 19 Apr 2006 07:39:24 -0500 (CDT)

Author: reinhard
Date: 2006-04-19 07:39:24 -0500 (Wed, 19 Apr 2006)
New Revision: 8434

Modified:
   trunk/gnue-common/src/logic/GTrigger.py
Log:
Final pep8ing.


Modified: trunk/gnue-common/src/logic/GTrigger.py
===================================================================
--- trunk/gnue-common/src/logic/GTrigger.py     2006-04-19 12:29:35 UTC (rev 
8433)
+++ trunk/gnue-common/src/logic/GTrigger.py     2006-04-19 12:39:24 UTC (rev 
8434)
@@ -69,94 +69,110 @@
 # =============================================================================
 
 class GTrigger(GObj):
-  def __init__(self, parent=None, type=None, name=None, src=None, text=None,
-               language='python'):
 
-    GObj.__init__(self, parent, 'GCTrigger')
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-    self._xml_content_as_cdata_ = gConfig('StoreTriggersAsCDATA')
+    def __init__(self, parent=None, type=None, name=None, src=None, text=None,
+            language='python'):
 
-    self.__root = self.findParentOfType(None)
+        GObj.__init__(self, parent, 'GCTrigger')
 
-    self._inits   = [None,self.initialize,self.initCall]
+        self._xml_content_as_cdata_ = gConfig('StoreTriggersAsCDATA')
 
-    self.language=language
-    self.src = src
-    self.type = type and string.upper(type) or None
-    self.name = name
-    if text != None:
-      GContent(self, text)
-    if self.type != None:
-      self._buildObject()
+        self.__root = self.findParentOfType(None)
 
+        self._inits = [None,self.initialize,self.initCall]
 
-  def __repr__(self):
+        # FIXME: Is this for manually creating GTrigger instances? Is this used
+        # anywhere?
+        self.language=language
+        self.src = src
+        self.type = type and type.upper() or None
+        self.name = name
+        if text != None:
+            GContent(self, text)
+        if self.type != None:
+            self._buildObject()
 
-    return repr(self.getParent()) + '.' + self.getDescription()
 
+    # -------------------------------------------------------------------------
+    # Nice string representation
+    # -------------------------------------------------------------------------
 
-  #
-  # Must be at least a phase 2 init
-  #
-  def initialize(self):
-    self.__call__ = dummyFunction
+    def __repr__(self):
 
-    if self.type != "NAMED":
-      if self.getParent ():
-        self.getParent ().associateTrigger (self.type, self)
-    else:
-      self.__root._triggerDictionary[self.name] = self
+        return repr(self.getParent()) + '.' + self.getDescription()
 
-    # If the trigger code is given with the trigger, build the call-function
-    # right now. This way any referring trigger will find a propery function
-    if self.src is None:
-      self.__set_function(self.getChildrenAsContent())
 
+    # -------------------------------------------------------------------------
+    # Initialize
+    # -------------------------------------------------------------------------
 
-  # ---------------------------------------------------------------------------
-  # Initialize the trigger's call function
-  # ---------------------------------------------------------------------------
+    def initialize(self):
+        self.__call__ = dummyFunction
 
-  def initCall (self):
-    """
-    This function get's called in the trigger's phase II init and connectes
-    another's trigger's function to the call-method
-    """
+        if self.type != "NAMED":
+            if self.getParent():
+                self.getParent().associateTrigger(self.type, self)
+        else:
+            self.__root._triggerDictionary[self.name] = self
 
-    if self.src is not None:
-      self.__set_function_from(self.__root._triggerDictionary [self.src])
+        # If the trigger code is given with the trigger, build the 
call-function
+        # right now. This way any referring trigger will find a propery 
function
+        if self.src is None:
+            self.__set_function(self.getChildrenAsContent())
 
 
+    # -------------------------------------------------------------------------
+    # Initialize the trigger's call function
+    # -------------------------------------------------------------------------
 
-  def __set_function_from(self, object):
-    self.__call__ = object.__call__
+    def initCall (self):
+        """
+        This function get's called in the trigger's phase II init and connectes
+        another's trigger's function to the call-method
+        """
 
+        if self.src is not None:
+            self.__set_function_from(self.__root._triggerDictionary [self.src])
 
-  def __set_function(self, code):
 
-    execution_context = language.create_execution_context(
-            language = self.language,
-            name = repr(self),
-            local_namespace = {},
-            global_namespace = self.__root._triggerns,
-            builtin_namespace = {})
 
-    self.__call__ = execution_context.build_function(
-            name = self.getDescription(),
-            parameters = ['self'],
-            code = code)
+    def __set_function_from(self, object):
+        self.__call__ = object.__call__
 
-  def getDescription(self):
-    """
-    Return a useful description of this object
-    for use by designer
-    """
-    if self.type == 'NAMED':
-      return self.name
-    else:
-      return string.upper(self.type)
 
+    def __set_function(self, code):
 
+        execution_context = language.create_execution_context(
+                language = self.language,
+                name = repr(self),
+                local_namespace = {},
+                global_namespace = self.__root._triggerns,
+                builtin_namespace = {})
+
+        self.__call__ = execution_context.build_function(
+                name = self.getDescription(),
+                parameters = ['self'],
+                code = code)
+
+    # -------------------------------------------------------------------------
+    # Return a nice description of this object for designer
+    # -------------------------------------------------------------------------
+
+    def getDescription(self):
+        """
+        Return a useful description of this object
+        for use by designer
+        """
+        if self.type == 'NAMED':
+            return self.name
+        else:
+            return string.upper(self.type)
+
+
 # -----------------------------------------------------------------------------
 # Dummy function for non-implemented triggers
 # -----------------------------------------------------------------------------





reply via email to

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