desktop_notifier.common¶
This module defines base classes for desktop notifications.
Attributes¶
Python icon |
|
Default system notification sound |
Exceptions¶
Raised when we are not authorised to send notifications |
Classes¶
A file resource represented by a URI or path |
|
A resource represented by a resource name, URI or path |
|
An icon represented by an icon name, URI or path |
|
An attachment represented by a URI or path |
|
A sound represented by a sound name, URI or path |
|
Enumeration of notification levels |
|
A button for interactive notifications |
|
A text field for interactive notifications |
|
A desktop notification |
|
Notification capabilities that can be supported by a platform |
Module Contents¶
- class desktop_notifier.common.FileResource¶
A file resource represented by a URI or path
Only one of
path
oruri
can be set.- path: pathlib.Path | None = None¶
Path to a local file
- as_path()¶
Returns the represented resource as a Path
Note that any information about the URI scheme is lost on conversion.
- Return type:
- class desktop_notifier.common.Resource¶
Bases:
FileResource
A resource represented by a resource name, URI or path
Only one of
path
,uri
orname
can be set.
- class desktop_notifier.common.Icon¶
Bases:
Resource
An icon represented by an icon name, URI or path
- class desktop_notifier.common.Attachment¶
Bases:
FileResource
An attachment represented by a URI or path
- class desktop_notifier.common.Sound¶
Bases:
Resource
A sound represented by a sound name, URI or path
- exception desktop_notifier.common.AuthorisationError¶
Bases:
Exception
Raised when we are not authorised to send notifications
- class desktop_notifier.common.Urgency¶
Bases:
enum.Enum
Enumeration of notification levels
The interpretation and visuals depend on the platform.
- Critical = 'critical'¶
For critical errors.
- Normal = 'normal'¶
Default platform notification level.
- Low = 'low'¶
Low priority notification.
- class desktop_notifier.common.Button¶
A button for interactive notifications
- class desktop_notifier.common.ReplyField¶
A text field for interactive notifications
- class desktop_notifier.common.Notification¶
A desktop notification
Some properties of a notification may be ignored or interpreted differently depending on the platform.
Callbacks for interactions will be executed on the Python process that scheduled the notification and only as long as the DesktopNotifier instance that scheduled the notification still exists.
Install handlers on the DesktopNotifier instance itself to respond to interactions with notification from your app while it was not running.
- urgency: Urgency¶
Notification urgency. Can determine stickiness, notification appearance and break through silencing.
- reply_field: ReplyField | None = None¶
Text field shown on an interactive notification. This can be used for example for messaging apps to reply directly from the notification.
- on_dispatched: Callable[[], Any] | None = None¶
Method to call when the notification was sent to the notifications server for display
- attachment: Attachment | None = None¶
A file attached to the notification which may be displayed as a preview
- class desktop_notifier.common.Capability¶
Bases:
enum.Enum
Notification capabilities that can be supported by a platform
- APP_NAME¶
Supports setting a custom app name
- TITLE¶
Supports setting a notification title
- MESSAGE¶
Supports setting a notification message
- URGENCY¶
Supports different urgency levels
- ICON¶
Supports custom notification icons
- ICON_FILE¶
Supports setting a custom icon from a user-provided file
- ICON_NAME¶
Supports setting a named system icon as notification icon
- BUTTONS¶
Supports at least two notification buttons
- REPLY_FIELD¶
Supports reply fields
- ATTACHMENT¶
Supports notification attachments. Allowed file types vary by platform.
- ON_DISPATCHED¶
Supports on-dispatched callbacks
- ON_CLICKED¶
Supports on-clicked callbacks
- ON_DISMISSED¶
Supports on-dismissed callbacks
- SOUND¶
Supports custom notification sounds
- SOUND_FILE¶
Supports setting a custom sound from a user-provided file
- SOUND_NAME¶
Supports setting a named system sound as notification sound
- THREAD¶
Supports grouping notifications by topic thread
- TIMEOUT¶
Supports notification timeouts