tribler.core.notifier ===================== .. py:module:: tribler.core.notifier Classes ------- .. autoapisummary:: tribler.core.notifier.Desc tribler.core.notifier.Notification tribler.core.notifier.Notifier Module Contents --------------- .. py:class:: Desc Bases: :py:obj:`NamedTuple` A Notification callback descriptor. .. py:attribute:: name :type: str .. py:attribute:: fields :type: list[str] .. py:attribute:: types :type: list[tuple[type, Ellipsis] | type] .. py:class:: Notification(*args, **kwds) Bases: :py:obj:`enum.Enum` All possible global events that happen in Tribler. .. py:attribute:: torrent_finished .. py:attribute:: torrent_status_changed .. py:attribute:: tribler_shutdown_state .. py:attribute:: tribler_new_version .. py:attribute:: remote_query_results .. py:attribute:: local_query_results .. py:attribute:: circuit_removed .. py:attribute:: tunnel_removed .. py:attribute:: torrent_health_updated .. py:attribute:: low_space .. py:attribute:: events_start .. py:attribute:: tribler_exception .. py:attribute:: content_discovery_community_unknown_torrent_added .. py:attribute:: report_config_error .. py:attribute:: peer_disconnected .. py:attribute:: tribler_torrent_peer_update .. py:attribute:: torrent_metadata_added .. py:attribute:: new_torrent_metadata_created .. py:attribute:: ask_add_download .. py:class:: Notifier The class responsible for managing and calling observers of global Tribler events. .. py:attribute:: observers :type: dict[Notification, list[collections.abc.Callable[Ellipsis, None]]] .. py:attribute:: delegates :type: set[collections.abc.Callable[Ellipsis, None]] .. py:method:: add(topic: Notification, observer: collections.abc.Callable[Ellipsis, None]) -> None Add an observer for the given Notification type. .. py:method:: notify(topic: Notification | str, /, **kwargs) -> None Notify all observers that have subscribed to the given topic.