added function to retrieve the current state
This commit is contained in:
@@ -112,6 +112,13 @@ class StateMachine(object):
|
||||
self.transition(self.__current_state, self._default_state)
|
||||
|
||||
|
||||
def current_state(self):
|
||||
'''
|
||||
Return the current state name.
|
||||
'''
|
||||
return self.__current_state
|
||||
|
||||
|
||||
def __getitem__(self, state):
|
||||
'''
|
||||
Non-blocking, non-synchronized test to determine if we are in the given state.
|
||||
|
||||
Reference in New Issue
Block a user