Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/tutorius/linear_creator.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/sugar/tutorius/linear_creator.py')
-rw-r--r--src/sugar/tutorius/linear_creator.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/sugar/tutorius/linear_creator.py b/src/sugar/tutorius/linear_creator.py
index 02bb497..91b11f4 100644
--- a/src/sugar/tutorius/linear_creator.py
+++ b/src/sugar/tutorius/linear_creator.py
@@ -31,6 +31,7 @@ class LinearCreator(object):
self.fsm = FiniteStateMachine("Sample Tutorial")
self.current_actions = []
self.nb_state = 0
+ self.state_name = "INIT"
def set_name(self, name):
"""
@@ -54,17 +55,14 @@ class LinearCreator(object):
be replaced to point to the next event in the line.
"""
if len(self.current_actions) != 0:
- state_name = ""
- if self.nb_state == 0:
- state_name = "INIT"
- else:
- state_name = "State" + str(self.nb_state)
# Set the next state name - there is no way the caller should have
# to deal with that.
- next_state_name = "State" + str(self.nb_state+1)
+ next_state_name = "State %d" % (self.nb_state+1)
event_filter.set_next_state(next_state_name)
-
- state = State(state_name, action_list=self.current_actions, event_filter_list=[event_filter])
+ state = State(self.state_name, action_list=self.current_actions,
+ event_filter_list=[event_filter])
+ self.state_name = next_state_name
+
self.nb_state += 1
self.fsm.add_state(state)
@@ -94,4 +92,4 @@ class LinearCreator(object):
new_fsm.add_state(state)
return new_fsm
- \ No newline at end of file
+