mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 21:41: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:
|
class FSMManager:
|
||||||
def __init__(self, fsm_type):
|
def __init__(self, fsm_type):
|
||||||
self.fsm = fsm_type()
|
self._fsm = fsm_type()
|
||||||
self.trigger_handlers = defaultdict(list)
|
self.trigger_handlers = defaultdict(list)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def fsm(self):
|
||||||
|
return self._fsm
|
||||||
|
|
||||||
def trigger(self, trigger, message):
|
def trigger(self, trigger, message):
|
||||||
if all((handler() for handler in self.trigger_handlers[trigger])):
|
if all((handler() for handler in self.trigger_handlers[trigger])):
|
||||||
try: self.fsm.trigger(trigger, message=message)
|
try: self.fsm.trigger(trigger, message=message)
|
||||||
|
Loading…
Reference in New Issue
Block a user