maestral.notify
#
This module handles desktop notifications It uses the desktop-notifier package as a backend for cross-platform desktop notifications.
Module Contents#
- maestral.notify.level_number_to_name(number)[source]#
Converts a Maestral notification level number to name.
- maestral.notify.level_name_to_number(name)[source]#
Converts a Maestral notification level name to number.
- class maestral.notify.MaestralDesktopNotifier(config_name, event_loop)[source]#
Desktop notification emitter for Maestral
Desktop notifier with snooze functionality and variable notification levels. Must be instantiated in the main thread.
- Parameters:
config_name (str) – Config name. This is used to access notification settings for the daemon.
event_loop (asyncio.AbstractEventLoop) – Event loop to use to send notifications and receive callbacks.
- property notify_level: int[source]#
Custom notification level. Notifications with a lower level will be discarded.
- Return type:
- property snoozed: float[source]#
Time in minutes to snooze notifications. Applied to FILECHANGE level only.
- Return type:
- notify(title, message, level=FILECHANGE, on_click=None, actions=None)[source]#
Sends a desktop notification. This will schedule a notification task in the asyncio loop of the thread where
DesktopNotifier
was instantiated.- Parameters:
title (str) – Notification title.
message (str) – Notification message.
level (int) – Notification level of the message.
on_click (Callable[[], Any] | None) – A callback to execute when the notification is clicked. The provided callable must not take any arguments.
actions (dict[str, Callable[[], Any]] | None) – A dictionary with button names and callbacks for the notification.
- Return type:
None