DecentraSanta/classes/UserInterface.py
2025-04-18 03:08:54 +02:00

28 lines
822 B
Python

from collections.abc import Callable
class UserInterface:
def __init__(self):
self.user_info_listeners: list[Callable[[str, str], None]] = []
self.start_listeners: list[Callable[[list[str]], None]] = []
def receive_user(self, name: str):
pass
def announce_recipient(self, name: str, other_info: str):
pass
def set_user_info(self, name: str, info_for_santa: str):
for listener in self.user_info_listeners:
listener(name, info_for_santa)
def start_exchange(self, list_of_participants: list[str]):
for listener in self.start_listeners:
listener(list_of_participants)
def add_user_info_listener(self, callback: Callable[[str, str], None]):
self.user_info_listeners.append(callback)
def add_start_listener(self, callback: Callable[[list[str]], None]):
self.start_listeners.append(callback)