mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-12 19:47:17 +00:00
26 lines
772 B
Python
26 lines
772 B
Python
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
|
# All Rights Reserved. See LICENSE file for details.
|
|
|
|
from abc import ABC
|
|
|
|
from tfw.components import FSMAware
|
|
from tfw.networking import Scope
|
|
|
|
from .event_handler import EventHandler
|
|
|
|
|
|
class FSMAwareEventHandler(EventHandler, FSMAware, ABC):
|
|
# pylint: disable=abstract-method
|
|
"""
|
|
Abstract base class for EventHandlers which automatically
|
|
keep track of the state of the TFW FSM.
|
|
"""
|
|
def __init__(self, key, scope=Scope.ZMQ):
|
|
EventHandler.__init__(self, key, scope=scope)
|
|
FSMAware.__init__(self)
|
|
self.subscribe('fsm_update')
|
|
|
|
def dispatch_handling(self, message):
|
|
if not self.refresh_on_fsm_update(message):
|
|
super().dispatch_handling(message)
|