Browse Source

*** empty log message ***

Jesse Schell 25 years ago
parent
commit
90f9a57b34
1 changed files with 17 additions and 1 deletions
  1. 17 1
      direct/src/fsm/FSM.py

+ 17 - 1
direct/src/fsm/FSM.py

@@ -36,11 +36,27 @@ class FSM(DirectObject):
         # It is assumed that the initial state takes no arguments.
         # It is assumed that the initial state takes no arguments.
         self.__currentState = self.__initialState
         self.__currentState = self.__initialState
         #self.__enter(self.__initialState)
         #self.__enter(self.__initialState)
+        return None
+
+    # I know this isn't how __repr__ is supposed to be used, but it
+    # is nice and convenient.
+    def __repr__(self):
+        return self.__str__()
+
+    def __str__(self):
+        """__str__(self)
+        Print out something useful about the fsm
+        """
+        str = ("FSM " + self.getName() + ' in state "' +
+               self.getCurrentState().getName() + '"')
+        return str
 
 
     def enterInitialState(self):
     def enterInitialState(self):
         self.__enter(self.__initialState)
         self.__enter(self.__initialState)
+        return None
         
         
-    def __str__(self):
+    # Jesse decided that simpler was better with the __str__ function
+    def __str_not__(self):
         """__str__(self)"""
         """__str__(self)"""
         return "FSM: name = %s \n states = %s \n initial = %s \n final = %s \n current = %s" % (self.__name, self.__states, self.__initialState, self.__finalState, self.__currentState)
         return "FSM: name = %s \n states = %s \n initial = %s \n final = %s \n current = %s" % (self.__name, self.__states, self.__initialState, self.__finalState, self.__currentState)