Skip to main content
The events module provides a centralized event system for communication between components.

Events Class

Manages event subscriptions, emissions, and scheduling.

Methods

enable()

Enables the event system and starts the scheduler thread.

connect()

Subscribes a callback function to an event.
str
Name of the event to subscribe to
callable
Callback function to execute when event is emitted

disconnect()

Unsubscribes a callback function from an event.
str
Name of the event
callable
The callback function to remove

emit()

Emits an event synchronously to all subscribers.
str
Name of the event to emit
tuple
Positional arguments passed to callbacks
dict
Keyword arguments passed to callbacks

emit_main_thread()

Queues an event for emission in the main thread.
Use this method when emitting events from background threads to ensure thread safety.

schedule()

Schedules a callback to run after a delay.
float
Delay in seconds before executing callback
callable
Function to execute
tuple
Arguments to pass to callback
bool
default:false
Whether to repeat the callback periodically
int
Unique identifier for the scheduled event

cancel_scheduled()

Cancels a scheduled callback.
int
The event ID returned by schedule()

process_thread_events()

Processes queued thread events in the main thread. Called by the main loop.
bool
Whether the main loop should continue processing

Available Events

General Events

event
Application startup
event
Application shutdown
event
Initial setup/configuration screen

Server Events

event
Server login success or failure
event
Disconnected from server
event
Reconnecting to server

User Events

event
User status changed (online/away/offline)
event
User statistics updated
event
User country code determined

Chat Events

event
Message in chat room
event
Private message sent/received
event
Joined a chat room
event
Left a chat room

Search Events

New search started
event
Search results received

Transfer Events

event
Download updated
event
Upload updated
event
Download progress update
event
Upload progress update

Global Instance

A global events instance is available for import.