1
0
mirror of https://github.com/avatao-content/baseimage-tutorial-framework synced 2025-01-11 08:41:55 +00:00

Make FSMManager.fsm a property

This commit is contained in:
Kristóf Tóth 2018-02-26 15:02:06 +01:00
parent 25fd71a2b8
commit 5776400990

View File

@ -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)