Skip to content

chessmaker.events.event

[view_source]

Event

@dataclass(frozen=True)
class Event()

[view_source]

CancellableEvent

@dataclass(frozen=True)
class CancellableEvent(Event)

[view_source]

cancelled: bool

[view_source]

set_cancelled

def set_cancelled(cancelled: bool)

[view_source]

chessmaker.events.event_priority

[view_source]

EventPriority

class EventPriority(int,  Enum)

[view_source]

VERY_LOW

[view_source]

LOW

[view_source]

NORMAL

[view_source]

HIGH

[view_source]

VERY_HIGH

[view_source]

chessmaker.events.event_publisher

[view_source]

EventPublisher

class EventPublisher()

[view_source]

__init__

def __init__(event_types: tuple[Type[Event], ...] = None)

[view_source]

subscribe

def subscribe(event_type: Type[TEvent], callback: Callable[[TEvent], None], priority: int = EventPriority.NORMAL)

[view_source]

unsubscribe

def unsubscribe(event_type: Type[TEvent], callback: Callable[[TEvent], None])

[view_source]

subscribe_to_all

def subscribe_to_all(callback: Callable[[Event], None], priority: int = EventPriority.NORMAL)

[view_source]

unsubscribe_from_all

def unsubscribe_from_all(callback: Callable[[Event], None])

[view_source]

publish

def publish(event: Event)

[view_source]

propagate

def propagate(publisher: 'EventPublisher', event_type: Type[Event])

[view_source]

For all events publisher publishes of type event_type, publish them to self

propagate_all

def propagate_all(publisher: 'EventPublisher')

[view_source]

For all events publisher publishes, publish them to self

event_publisher

def event_publisher(*event_types: Type[Event]) -> Callable[[Type[T]], Type[T] | Type[EventPublisher]]

[view_source]