diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-04-26 21:42:20 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-04-26 21:42:20 (GMT) |
commit | 2a1c6d6fbcb60c44d8690add635260faf243dcd6 (patch) | |
tree | 25b10b497c515416370cbc0dd86e05bd6a2f4155 /src/sugar/tutorius/core.py | |
parent | a4114a946cc7a57c1cfce5760737c3f05425bc86 (diff) | |
parent | e784a2f0b92ecaf46a77ddca94b31fcc86e0cbae (diff) |
(LP 352437) Core : Completed basic serializer interactions with core
(actions, event filters) - needs tests
Also, merged branch 'mike' into jc_support
Conflicts:
source/external/source/sugar-toolkit/src/sugar/tutorius/actions.py
source/external/source/sugar-toolkit/src/sugar/tutorius/bundler.py
source/external/source/sugar-toolkit/src/sugar/tutorius/tests/run-tests.py
source/external/source/sugar-toolkit/src/sugar/tutorius/tests/serializertests.py
Diffstat (limited to 'src/sugar/tutorius/core.py')
-rw-r--r-- | src/sugar/tutorius/core.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/sugar/tutorius/core.py b/src/sugar/tutorius/core.py index f290f1e..602947f 100644 --- a/src/sugar/tutorius/core.py +++ b/src/sugar/tutorius/core.py @@ -295,11 +295,8 @@ class FiniteStateMachine(State): self._states = state_dict or {} self.start_state_name = start_state_name - # If we have a filled input dictionary - if len(self._states) > 0: - self.current_state = self._states[self.start_state_name] - else: - self.current_state = None + # Set the current state to None - we are not executing anything yet + self.current_state = None # Register the actions for the FSM - They will be processed at the # FSM level, meaning that when the FSM will start, it will first @@ -375,6 +372,13 @@ class FiniteStateMachine(State): # state by that name - we must ignore this state change request as # it will be done elsewhere in the hierarchy (or it's just bogus). return + + if self.current_state != None: + if new_state_name == self.current_state.name: + # If we already are in this state, we do not need to change + # anything in the current state - By design, a state may not point + # to itself + return new_state = self._states[new_state_name] |