mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-15 13:27:17 +00:00
27 lines
679 B
Python
27 lines
679 B
Python
|
from tfw import LinearFSM
|
||
|
from tfw.networking import MessageSender
|
||
|
|
||
|
|
||
|
class TestFSM(LinearFSM):
|
||
|
def __init__(self, number_of_steps):
|
||
|
super().__init__(number_of_steps)
|
||
|
self.message_sender = MessageSender()
|
||
|
|
||
|
def on_enter_1(self, event_data):
|
||
|
self.state_notify(1)
|
||
|
|
||
|
def on_enter_2(self, event_data):
|
||
|
self.state_notify(2)
|
||
|
|
||
|
def on_enter_3(self, event_data):
|
||
|
self.state_notify(3)
|
||
|
|
||
|
def on_enter_4(self, event_data):
|
||
|
self.state_notify(4)
|
||
|
|
||
|
def on_enter_5(self, event_data):
|
||
|
self.state_notify(5)
|
||
|
|
||
|
def state_notify(self, state):
|
||
|
self.message_sender.send('TestFSM', 'Entered state {}!'.format(state))
|