mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 16:31:32 +00:00
Make FSMManager.fsm a property
This commit is contained in:
parent
25fd71a2b8
commit
5776400990
@ -39,9 +39,13 @@ class TFWServer:
|
||||
|
||||
class FSMManager:
|
||||
def __init__(self, fsm_type):
|
||||
self.fsm = fsm_type()
|
||||
self._fsm = fsm_type()
|
||||
self.trigger_handlers = defaultdict(list)
|
||||
|
||||
@property
|
||||
def fsm(self):
|
||||
return self._fsm
|
||||
|
||||
def trigger(self, trigger, message):
|
||||
if all((handler() for handler in self.trigger_handlers[trigger])):
|
||||
try: self.fsm.trigger(trigger, message=message)
|
||||
|
Loading…
Reference in New Issue
Block a user