maestral.notify
This module handles desktop notifications It uses the desktop-notifier package as a backend for cross-platform desktop notifications.
- maestral.notify.NONE = 100
No desktop notifications
- maestral.notify.ERROR = 40
Notify only on fatal errors
- maestral.notify.SYNCISSUE = 30
Notify for sync issues and higher
- maestral.notify.FILECHANGE = 15
Notify for all remote file changes
- maestral.notify.level_name_to_number(name)[source]
Converts a Maestral notification level name to number.
- maestral.notify.level_number_to_name(number)[source]
Converts a Maestral notification level number to name.
- class maestral.notify.MaestralDesktopNotifier(config_name)[source]
Bases:
object
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.
- Return type
None
- property notify_level: int
Custom notification level. Notifications with a lower level will be discarded.
- notify(title, message, level=15, 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 (Optional[Callable]) – A callback to execute when the notification is clicked. The provided callable must not take any arguments.
actions (Optional[Dict[str, Callable]]) – A dictionary with button names and callbacks for the notification.
- Return type
None