awsc.termui.text_browser.TextBrowser
- class awsc.termui.text_browser.TextBrowser(*args, color=Color(Palette8Bit, 220, None), filtered_color=Color(Palette8Bit, 0, 220), scheme=None, syntax_highlighting=False, **kwargs)
Text browsers allow the display of large blobs of text which can be optionally syntax highlighted.
- Attributes:
- schemeawsc.config.scheme.Scheme
Reference to the scheme being used by the browser. Since this module has no access to the configuration, this needs to be explicitly passed.
- colorawsc.termui.color.Color
Default color used for text within the browser.
- filtered_colorawsc.termui.color.Color
Color used for highlighting text when using search.
- lineslist
A raw list of lines to display, without syntax highlighting applied.
- display_lineslist
A list of lines to display with syntax highlighting applied. Acts as a cache that is cleared when new raw lines are added.
- topint
The amount of rows by which the control is scrolled down.
- leftint
The amount of characters by which the control is scrolled right.
- wrapbool
If set, wraps lines that would go off the right edge. Disables scrolling horizontally.
- _filterstr
Search string.
- filter_positionsdict
A cache of all positions within the control where matches for the search are found.
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_hotkey
(hotkey, action[, tooltip, ...])Adds a new hotkey to the control.
add_text
(text)Adds raw text to the text browser.
autohotkey_condition
(hotkey)Autohotkey condition callback.
before_paint
()Hook function for acting on the block before any blocks are painted for the current frame.
bottomright
()Returns the coordinates of the bottom right corner of the block.
clear
()Empties out the text browser.
clear_blocks
([tag])Removes all blocks with the matching tag from the child blocks of this block.
copy_contents
(*args)Hotkey callback for copying the contents of the text browser to the system clipboard.
end
(*args)Hotkey callback for scrolling to bring the final line in view within the browser.
home
(*args)Hotkey callback for jumping to the top of the text browser.
input
(key)Input handler hook function.
paint
()Hook function for painting the block.
pgdown
(*args)Hotkey callback for scrolling down within the browser by a single page.
pgup
(*args)Hotkey callback for scrolling up within the browser by a single page.
raw
([line])Generates the raw output of the text browser.
rawlines
()Generates a list of raw lines.
remove_block
(block)Removes a specific block from this block.
reparent
()Shorthand function for removing a Block from its parent and re-adding it.
scroll_down
(*args)Hotkey callback for scrolling down within the browser by a single line.
scroll_left
(*args)Hotkey callback for scrolling left within the browser by a single character column.
scroll_right
(*args)Hotkey callback for scrolling right within the browser by a single character column.
scroll_up
(*args)Hotkey callback for scrolling up within the browser by a single line.
toggle_wrap
(*args)Hotkey callback for toggling the wrap flag.
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), filtered_color=Color(Palette8Bit, 0, 220), scheme=None, syntax_highlighting=False, **kwargs)
Initializes a HotkeyControl object.
Methods
__init__
(*args[, color, filtered_color, ...])Initializes a HotkeyControl object.
add_block
(block)Adds a new child block to this block.
add_hotkey
(hotkey, action[, tooltip, ...])Adds a new hotkey to the control.
add_text
(text)Adds raw text to the text browser.
autohotkey_condition
(hotkey)Autohotkey condition callback.
before_paint
()Hook function for acting on the block before any blocks are painted for the current frame.
bottomright
()Returns the coordinates of the bottom right corner of the block.
clear
()Empties out the text browser.
clear_blocks
([tag])Removes all blocks with the matching tag from the child blocks of this block.
copy_contents
(*args)Hotkey callback for copying the contents of the text browser to the system clipboard.
end
(*args)Hotkey callback for scrolling to bring the final line in view within the browser.
home
(*args)Hotkey callback for jumping to the top of the text browser.
input
(key)Input handler hook function.
on_become_frame
()paint
()Hook function for painting the block.
pgdown
(*args)Hotkey callback for scrolling down within the browser by a single page.
pgup
(*args)Hotkey callback for scrolling up within the browser by a single page.
raw
([line])Generates the raw output of the text browser.
rawlines
()Generates a list of raw lines.
remove_block
(block)Removes a specific block from this block.
reparent
()Shorthand function for removing a Block from its parent and re-adding it.
scroll_down
(*args)Hotkey callback for scrolling down within the browser by a single line.
scroll_left
(*args)Hotkey callback for scrolling left within the browser by a single character column.
scroll_right
(*args)Hotkey callback for scrolling right within the browser by a single character column.
scroll_up
(*args)Hotkey callback for scrolling up within the browser by a single line.
toggle_wrap
(*args)Hotkey callback for toggling the wrap flag.
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
Property.
height
Read-only property for the height of the block.
inner
Read-only property for calculating the four inner corners of the block.
w_in
Read-only property for the inner width of the block.
width
Read-only property for the width of the block.