Browse Source

minor API refinements

David Rose 20 years ago
parent
commit
e3e37d3bba
1 changed files with 13 additions and 13 deletions
  1. 13 13
      direct/src/fsm/FSM.py

+ 13 - 13
direct/src/fsm/FSM.py

@@ -125,6 +125,18 @@ class FSM(DirectObject.DirectObject):
 
 
     SerialNum = 0
     SerialNum = 0
 
 
+    # This member lists the default transitions that are accepted
+    # without question by the defaultFilter.  It's a map of state
+    # names to a list of legal target state names from that state.
+    # Define it only if you want to use the classic FSM model of
+    # defining all (or most) of your transitions up front.  If
+    # this is set to None (the default), all named-state
+    # transitions (that is, those requests whose name begins with
+    # a capital letter) are allowed.  If it is set to an empty
+    # map, no transitions are implicitly allowed--all transitions
+    # must be approved by some filter function.
+    defaultTransitions = None
+
     def __init__(self, name):
     def __init__(self, name):
         self.name = name
         self.name = name
         self._serialNum = FSM.SerialNum
         self._serialNum = FSM.SerialNum
@@ -133,18 +145,6 @@ class FSM(DirectObject.DirectObject):
         # Initially, we are in the Off state by convention.
         # Initially, we are in the Off state by convention.
         self.state = 'Off'
         self.state = 'Off'
 
 
-        # This member lists the default transitions that are accepted
-        # without question by the defaultFilter.  It's a map of state
-        # names to a list of legal target state names from that state.
-        # Define it only if you want to use the classic FSM model of
-        # defining all (or most) of your transitions up front.  If
-        # this is set to None (the default), all named-state
-        # transitions (that is, those requests whose name begins with
-        # a capital letter) are allowed.  If it is set to an empty
-        # map, no transitions are implicitly allowed--all transitions
-        # must be approved by some filter function.
-        self.defaultTransitions = None
-
         # This member records transition requests made by demand() or
         # This member records transition requests made by demand() or
         # forceTransition() while the FSM is in transition between
         # forceTransition() while the FSM is in transition between
         # states.
         # states.
@@ -259,7 +259,7 @@ class FSM(DirectObject.DirectObject):
             if isinstance(result, types.StringTypes):
             if isinstance(result, types.StringTypes):
                 # If the return value is a string, it's just the name
                 # If the return value is a string, it's just the name
                 # of the state.  Wrap it in a tuple for consistency.
                 # of the state.  Wrap it in a tuple for consistency.
-                result = (result,)
+                result = (result,) + args
 
 
             # Otherwise, assume it's a (name, *args) tuple
             # Otherwise, assume it's a (name, *args) tuple
             self.__setState(*result)
             self.__setState(*result)