awsc.termui.list_control.ListControl
- class awsc.termui.list_control.ListControl(*args, color=Color(Palette8Bit, 220, None), selection_color=Color(Palette8Bit, 0, 220), title_color=Color(Palette8Bit, 0, 208), update_color=Color(Palette8Bit, 220, None), update_selection_color=Color(Palette8Bit, 0, 220), **kwargs)
A ListControl is a large control which allows displaying any amount of entries as a list of rows, where each row is a set of columns. ListControls allow navigation and selection of items which in turn allows the use of hotkeys for operating on entries.
- Attributes:
- entrieslist(awsc.termui.list_control.ListEntry)
A list of entries.
- colorawsc.termui.color.Color
The color of unselected list entries.
- selection_colorawsc.termui.color.Color
The color of selected list entries.
- title_colorawsc.termui.color.Color
The color of the title in the border bar.
- selectedint
The index of the selected row.
- column_titlesdict
A mapping of column titles to the size of the column. By default, this contains the initial size of the column. Space will be given to and taken away from columns roughly equally based on window size.
- column_orderlist
The order in which columns should be displayed. A column must be present in both column_order and column_titles to function properly.
- calculatedint
Cached value for the block width for which column sizes have been calculated.
- _filterstr
The currently set filter for filtering list entries.
- _cachelist
Cache for the list of filtered entries.
- topint
How many entries should be skipped before displaying (how far we’re scrolled down).
- update_colorawsc.termui.color.Color
The color of rows that have been recently (in the past 5 seconds) updated.
- update_selection_colorawsc.termui.color.Color
The color of rows that have been recently (in the past 5 seconds) updated and are selected.
Methods
Autohotkey
(key[, tooltip, is_validated, ...])Decorator that automatically assigns a hotkey to a function upon instantiation.
add_block
(block)Adds a new child block to this block.
add_column
(column[, min_size, index])Adds a new column to the ListControl.
add_entry
(entry)Adds a new entry to the ListControl.
add_hotkey
(hotkey, action[, tooltip, ...])Adds a new hotkey to the control.
autohotkey_condition
(hotkey)Autohotkey condition callback.
before_paint
()Hook function for acting on the block before any blocks are painted for the current frame.
before_paint_critical
()Critical section for the pre-paint hook.
bottomright
()Returns the coordinates of the bottom right corner of the block.
clear_blocks
([tag])Removes all blocks with the matching tag from the child blocks of this block.
end
(*args)Hotkey callback for KEY_END.
handle_finalization_critical
()Critical section for the finalization of new entries.
handle_new_entries_critical
(entries)Critical section for the new entry hook.
home
(*args)Hotkey callback for KEY_HOME.
input
(key)Input handler hook function.
list_down
(*args)Hotkey callback for KEY_DOWN.
list_up
(*args)Hotkey callback for KEY_UP.
pagedown
(*args)Hotkey callback for KEY_PAGEDOWN.
pageup
(*args)Hotkey callback for KEY_PAGEUP.
paint
()Hook function for painting the block.
remove_block
(block)Removes a specific block from this block.
reparent
()Shorthand function for removing a Block from its parent and re-adding it.
sort
()Sorts the list of entries.
topleft
()Returns the coordinates of the top left corner of the block.
validate_hotkey
(key)Validates whether a hotkey can be used based on the state of the control.
on_become_frame
- __init__(*args, color=Color(Palette8Bit, 220, None), selection_color=Color(Palette8Bit, 0, 220), title_color=Color(Palette8Bit, 0, 208), update_color=Color(Palette8Bit, 220, None), update_selection_color=Color(Palette8Bit, 0, 220), **kwargs)
Initializes a ListControl object.
Methods
__init__
(*args[, color, selection_color, ...])Initializes a ListControl object.
add_block
(block)Adds a new child block to this block.
add_column
(column[, min_size, index])Adds a new column to the ListControl.
add_entry
(entry)Adds a new entry to the ListControl.
add_hotkey
(hotkey, action[, tooltip, ...])Adds a new hotkey to the control.
autohotkey_condition
(hotkey)Autohotkey condition callback.
before_paint
()Hook function for acting on the block before any blocks are painted for the current frame.
before_paint_critical
()Critical section for the pre-paint hook.
bottomright
()Returns the coordinates of the bottom right corner of the block.
clear_blocks
([tag])Removes all blocks with the matching tag from the child blocks of this block.
end
(*args)Hotkey callback for KEY_END.
handle_finalization_critical
()Critical section for the finalization of new entries.
handle_new_entries_critical
(entries)Critical section for the new entry hook.
home
(*args)Hotkey callback for KEY_HOME.
input
(key)Input handler hook function.
list_down
(*args)Hotkey callback for KEY_DOWN.
list_up
(*args)Hotkey callback for KEY_UP.
on_become_frame
()pagedown
(*args)Hotkey callback for KEY_PAGEDOWN.
pageup
(*args)Hotkey callback for KEY_PAGEUP.
paint
()Hook function for painting the block.
remove_block
(block)Removes a specific block from this block.
reparent
()Shorthand function for removing a Block from its parent and re-adding it.
sort
()Sorts the list of entries.
topleft
()Returns the coordinates of the top left corner of the block.
validate_hotkey
(key)Validates whether a hotkey can be used based on the state of the control.
Attributes
border
Returns the border of the control.
corners
Read-only property for calculating the four corners of the block.
filter
Allows for filtering the list entries without removing them.
filtered
Read-only property that returns the list of filtered entris.
height
Read-only property for the height of the block.
inner
Read-only property for calculating the four inner corners of the block.
rows
Read-only property which contains the number of visible rows in the control.
selection
Read-only property which contains the currently selected list entry.
w_in
Read-only property for the inner width of the block.
width
Read-only property for the width of the block.