API Reference¶
Note
For an example see the Introduction.
- kitsiso.send_notification(summary, body=None, *, app_name=None, icon=None, urgency=Urgency.NORMAL, timeout=- 1)[source]¶
Send a simple notification.
This function does not instantiate
Notifier
. It connects to the D-Bus on each call and disconnects after the notification was sent.- Parameters
summary (str) – a single line overview
body (str) – multi-line body of text
app_name (str) – the application name
icon (str) – path to notification icon
urgency (Urgency) – urgency level
timeout (int) – notification timeout in seconds,
NO_TIMEOUT
orDEFAULT_TIMEOUT
- class kitsiso.Notifier(app_name=None, app_icon=None, bus=None)[source]¶
Class for sending notifications and handling actions and close events.
If
bus=None
a bus object will be created and connected. It can be closed withquit()
.- Parameters
- quit()[source]¶
Close D-Bus connection.
If a
dcar.Bus
object was passed in on instantiation as thebus
parameter, this method does nothing.
- notify(noti)[source]¶
Send notification.
- Parameters
noti (Notification) – the notification
- close(noti)[source]¶
Close notification.
- Parameters
noti (Notification) – the notification
- kitsiso.DEFAULT_TIMEOUT¶
Expiration timeout depends on the settings of the notification server. It may vary for the type of notification.
- kitsiso.NO_TIMEOUT¶
Never expire.
- class kitsiso.Notification(summary, body=None, *, icon=None, urgency=Urgency.NORMAL, timeout=- 1)[source]¶
Class for a notification.
An instance of this class has the following r/w attributes:
summary
body
icon
urgency
timeout
- Parameters
summary (str) – a single line overview
body (str) – multi-line body of text
icon (str) – path to notification icon
urgency (Urgency) – urgency level
timeout (int) – notification timeout in seconds,
NO_TIMEOUT
orDEFAULT_TIMEOUT
- add_action(key, name, func, args=(), kwargs={})[source]¶
Add an action.
An action is mostly shown as a button in the notification.
- Parameters
- add_hint(name, signature, value)[source]¶
Add a hint.
Hints are defined in the specification.
The urgency hint will be ignored (use the parameter or the attribute urgency).
The signature must be given as defined in the D-Bus specification:
Type
Code
boolean
b
byte
y
int
i
string
s
- closed(func, args=(), kwargs={})[source]¶
Set a function that is envoked when the notification is closed.
The the first argument to the function
func
is of typeint
and indicates the reason the notification was closed:1
the notification expired
2
the notification was dismissed by the user
3
the notification was closed with
Notifier.close()
4
undefined/reserved reasons