2026-01-11 17:48:35 -06:00
|
|
|
# Python imports
|
|
|
|
|
|
|
|
|
|
# Lib imports
|
|
|
|
|
|
|
|
|
|
# Application imports
|
2026-01-18 00:52:54 -06:00
|
|
|
from ..dto.base_event import BaseEvent
|
2026-01-11 17:48:35 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class EmitDispatcher:
|
2026-02-28 01:10:28 -06:00
|
|
|
"""
|
|
|
|
|
EmitDispatcher is used for allowing controllers to pass/hook in
|
|
|
|
|
their message system to children that need to signal events.
|
|
|
|
|
Note how we are not handling return info from the 'message' methods
|
|
|
|
|
whereas a controller would or could do so.
|
|
|
|
|
"""
|
|
|
|
|
|
2026-01-11 17:48:35 -06:00
|
|
|
def __init__(self):
|
|
|
|
|
super(EmitDispatcher, self).__init__()
|
|
|
|
|
|
|
|
|
|
|
2026-01-18 00:52:54 -06:00
|
|
|
def emit(self, event: BaseEvent):
|
2026-01-18 13:53:29 -06:00
|
|
|
self.message(event)
|
2026-01-11 17:48:35 -06:00
|
|
|
|
2026-01-18 00:52:54 -06:00
|
|
|
def emit_to(self, controller: str, event: BaseEvent):
|
2026-01-11 17:48:35 -06:00
|
|
|
self.message_to(controller, event)
|