tribler.core.notifier

Classes

Desc

A Notification callback descriptor.

Notification

All possible global events that happen in Tribler.

Notifier

The class responsible for managing and calling observers of global Tribler events.

Module Contents

class tribler.core.notifier.Desc

Bases: NamedTuple

A Notification callback descriptor.

name: str
fields: list[str]
types: list[tuple[type, Ellipsis] | type]
class tribler.core.notifier.Notification(*args, **kwds)

Bases: enum.Enum

All possible global events that happen in Tribler.

torrent_finished
torrent_status_changed
tribler_shutdown_state
tribler_new_version
remote_query_results
local_query_results
circuit_removed
tunnel_removed
torrent_health_updated
low_space
events_start
tribler_exception
content_discovery_community_unknown_torrent_added
report_config_error
peer_disconnected
tribler_torrent_peer_update
torrent_metadata_added
new_torrent_metadata_created
ask_add_download
class tribler.core.notifier.Notifier

The class responsible for managing and calling observers of global Tribler events.

observers: dict[Notification, list[collections.abc.Callable[Ellipsis, None]]]
delegates: set[collections.abc.Callable[Ellipsis, None]]
add(topic: Notification, observer: collections.abc.Callable[Ellipsis, None]) None

Add an observer for the given Notification type.

notify(topic: Notification | str, /, **kwargs) None

Notify all observers that have subscribed to the given topic.