Notify.Notification¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w |
The application icon to use for this notification as filename or icon theme-compliant name |
||
r/w |
The application name to use for this notification |
||
r/w/c |
The message body text |
||
r |
The reason code for why the notification was closed |
||
r/w/c |
The icon filename or icon theme-compliant name |
||
r/w/c |
The notification ID |
||
r/w/c |
The summary text |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
Emitted when the notification is closed. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent_instance |
r |
Class Details¶
- class Notify.Notification(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A passive pop-up notification.
Notify.Notificationrepresents a passive pop-up notification. It can contain summary text, body text, and an icon, as well as hints specifying how the notification should be presented. The notification is rendered by a notification daemon, and may present the notification in any number of ways. As such, there is a clear separation of content and presentation, and this API enforces that.- classmethod new(summary, body, icon)¶
- Parameters:
- Returns:
The new
Notify.Notification.- Return type:
Creates a new
Notify.Notification.The summary text is required, but all other parameters are optional.
- add_action(action, label, callback, *user_data)¶
- Parameters:
action (
str) – The action ID.label (
str) – The human-readable action label.callback (
Notify.ActionCallback) – The action’s callback function.user_data (
objectorNone) – Optional custom data to pass to callback.
Adds an action to a notification.
When the action is invoked, the specified callback function will be called, along with the value passed to user_data.
- clear_actions()¶
Clears all actions from the notification.
- clear_hints()¶
Clears all hints from the notification.
- close()¶
- Raises:
- Returns:
- Return type:
Synchronously tells the notification server to hide the notification on the screen.
- get_activation_app_launch_context()¶
- Returns:
The [class`Gio`.AppLaunchContext] for the current activation token, or
Noneif unset- Return type:
Gets an application launch context for the notification action activation.
If an an action is currently being activated, gets a a [class`Gio`.AppLaunchContext] that can be used to launch applications using the current activation token (see [method`Notification`.get_activation_token]).
This function is intended to be used in a [callback`ActionCallback`] to get the launch context for the activated action, if the notification daemon supports it.
New in version 0.8.7.
- get_activation_token()¶
-
Gets the activation token of the notification.
If an an action is currently being activated, return the activation token. This function is intended to be used in a [callback`ActionCallback`] to get the activation token for the activated action, if the notification daemon supports it.
New in version 0.7.10.
- get_closed_reason()¶
- Returns:
An integer representing the closed reason code (Since 0.8.0 it’s also a [enum`ClosedReason`]).
- Return type:
Returns the closed reason code for the notification.
This is valid only after the [signal`Notification`:py:func:::closed<Notify.Notification.signals.closed>] signal is emitted.
Since version 0.8.0 the returned value is of type [enum`ClosedReason`].
- set_app_icon(app_icon)¶
-
Sets the application icon for the notification.
If this function is not called or if app_icon is
None, the application icon will be set from the value set via [func`set_app_icon`].New in version 0.8.4.
- set_app_name(app_name)¶
-
Sets the application name for the notification.
If this function is not called or if app_name is
None, the application name will be set from the value used in [func`init`] or overridden with [func`set_app_name`].New in version 0.7.3.
- set_category(category)¶
- Parameters:
category (
str) – The category.
Sets the category of this notification.
This can be used by the notification server to filter or display the data in a certain way.
- set_hint(key, value)¶
- Parameters:
key (
str) – the hint keyvalue (
GLib.VariantorNone) – the hint value
Sets a hint for key with value value.
If value is
None, a previously set hint for key is unset.If value is floating, it is consumed.
New in version 0.6.
- set_hint_byte(key, value)¶
-
Sets a hint with a byte value.
Deprecated since version 0.6.: Use [method`Notification`.set_hint] instead
- set_hint_byte_array(key, value)¶
-
Sets a hint with a byte array value.
The length of value must be passed as len.
Deprecated since version 0.6.: Use [method`Notification`.set_hint] instead
- set_hint_double(key, value)¶
-
Sets a hint with a double value.
Deprecated since version 0.6.: Use [method`Notification`.set_hint] instead
- set_hint_int32(key, value)¶
-
Sets a hint with a 32-bit integer value.
Deprecated since version 0.6.: Use [method`Notification`.set_hint] instead
- set_hint_string(key, value)¶
-
Sets a hint with a string value.
Deprecated since version 0.6.: Use [method`Notification`.set_hint] instead
- set_hint_uint32(key, value)¶
-
Sets a hint with an unsigned 32-bit integer value.
Deprecated since version 0.6.: Use [method`Notification`.set_hint] instead
- set_icon_from_pixbuf(icon)¶
- Parameters:
icon (
GdkPixbuf.Pixbuf) – The icon.
Sets the icon in the notification from a
GdkPixbuf.Pixbuf.Deprecated since version 0.5.: Use [method`Notification`.set_image_from_pixbuf] instead.
- set_image_from_pixbuf(pixbuf)¶
- Parameters:
pixbuf (
GdkPixbuf.Pixbuf) – The image.
Sets the image in the notification from a [class`GdkPixbuf`.Pixbuf].
New in version 0.5.
- set_timeout(timeout)¶
- Parameters:
timeout (
int) – The timeout in milliseconds.
Sets the timeout of the notification.
To set the default time, pass
Notify.EXPIRES_DEFAULTas timeout. To set the notification to never expire, passNotify.EXPIRES_NEVER.Note that the timeout may be ignored by the server.
- set_urgency(urgency)¶
- Parameters:
urgency (
Notify.Urgency) – The urgency level.
Sets the urgency level of this notification.
- show()¶
-
Tells the notification server to display the notification on the screen.
- update(summary, body, icon)¶
- Parameters:
- Returns:
True, unless an invalid parameter was passed.- Return type:
Updates the notification text and icon.
This won’t send the update out and display it on the screen. For that, you will need to call [method`Notification`.show].
- do_closed() virtual¶
Signal Details¶
- Notify.Notification.signals.closed(notification)¶
- Signal Name:
closed- Flags:
- Parameters:
notification (
Notify.Notification) – The object which received the signal
Emitted when the notification is closed.
Note that when a [class`Notify`.Notification] is used in a sandboxed environment where XDG Desktop Notification Portal is implicitly used, the signal [signal`Notify`.Notification::closed] is only emitted when the notification is closed in response to an user action response.
NO signal will be emitted if the user or the daemon dismissed the notification for any other reason.
Property Details¶
- Notify.Notification.props.app_icon¶
-
The icon of the application for the notification.
New in version 0.8.4.
- Notify.Notification.props.app_name¶
-
The name of the application for the notification.
New in version 0.7.3.
- Notify.Notification.props.body¶
-
The body of the notification.
- Notify.Notification.props.closed_reason¶
-
The closed reason of the notification.
See [signal`Notification`:py:func:::closed<Notify.Notification.signals.closed>].
- Notify.Notification.props.icon_name¶
-
The icon-name of the icon to be displayed on the notification.
- Notify.Notification.props.id¶
-
The Id of the notification.