notifications.py¶
Notification widgets.
-
class
clay.notifications.
_Notification
(area, notification_id, message)[source]¶ Single notification widget. Can be updated or closed.
-
__init__
(area, notification_id, message)[source]¶ Parameters: - widget_list – iterable of flow or box widgets
- dividechars – number of blank characters between columns
- focus_column – index into widget_list of column in focus,
if
None
the first selectable widget will be chosen. - min_width – minimum width for each column which is not calling widget.pack() in widget_list.
- box_columns – a list of column indexes containing box widgets whose height is set to the maximum of the rows required by columns not listed in box_columns.
widget_list may also contain tuples such as:
- (given_width, widget)
- make this column given_width screen columns wide, where given_width is an int
- (
'pack'
, widget) - call
pack()
to calculate the width of this column - (
'weight'
, weight, widget) - give this column a relative weight (number) to calculate its width from the screen columns remaining
Widgets not in a tuple are the same as (
'weight'
,1
, widget)If the Columns widget is treated as a box widget then all children are treated as box widgets, and box_columns is ignored.
If the Columns widget is treated as a flow widget then the rows are calculated as the largest rows() returned from all columns except the ones listed in box_columns. The box widgets in box_columns will be displayed with this calculated number of rows, filling the full height.
-
id
¶ Notification ID.
-
is_alive
¶ Return True if notification is currently visible.
-
-
class
clay.notifications.
_NotificationArea
[source]¶ Notification area widget.
-
__init__
()[source]¶ Parameters: - widget_list (iterable) – child widgets
- focus_item (Widget or int) – child widget that gets the focus initially. Chooses the first selectable widget if unset.
widget_list may also contain tuples such as:
- (given_height, widget)
- always treat widget as a box widget and give it given_height rows, where given_height is an int
- (
'pack'
, widget) - allow widget to calculate its own height by calling its
rows()
method, ie. treat it as a flow widget. - (
'weight'
, weight, widget) - if the pile is treated as a box widget then treat widget as a box
widget with a height based on its relative weight value, otherwise
treat the same as (
'pack'
, widget).
Widgets not in a tuple are the same as (
'weight'
,1
, widget)`Note
If the Pile is treated as a box widget there must be at least one
'weight'
tuple inwidget_list
.
-