euporie.core.widgets.layout
Define widget for defining layouts.
Functions
|
Typed version of namedtuple. |
|
A decorator indicating abstract methods. |
|
Cast a value to a type. |
|
Return the character width of this text fragment list. |
|
Get the current active (running) Application. |
|
Monkey-patch to_container to collect container status functions. |
|
Turn the given object into a Dimension object. |
|
Accept both booleans and Filters as input and turn it into a Filter. |
|
Convert the given value (which can be formatted text) into a list of text fragments. |
|
Truncate all lines at a given length. |
Classes
|
Metaclass for defining Abstract Base Classes (ABCs). |
|
A container which switches between children using expandable sections. |
|
Draw a border around any container. |
|
Add padding around a container. |
|
Turn any callable into a Filter. |
|
Wrapper around any other container that can change the visibility. |
|
A split container where the orientation depends on a filter. |
alias of |
|
|
A tuple of four bools with directions. |
|
Container class that dynamically returns any Container. |
|
Simple event to which event handlers can be attached. For instance::. |
|
Control that displays formatted text. |
|
Several layouts, one stacked above/under the other. |
|
|
|
|
|
A split container which maintains a reference to it's children. |
|
Very simple cache that discards the oldest item when the cache size is exceeded. |
|
Base class for containers with selectable children. |
|
A control which shows a tab bar. |
|
A named tuple represting a tab and it's callbacks. |
|
A container which switches between children using tabs. |
|
Content generated by a user control. |
Base class for all user interface controls. |
|
|
Several layouts, one stacked left/right of the other. |
|
Container that holds a control. |
|
Create a new function with partial application of the given arguments and keywords. |
- class euporie.core.widgets.layout.AccordionSplit(children: Sequence[AnyContainer], titles: Sequence[AnyFormattedText], active: int = 0, style: str | Callable[[], str] = 'class:tab-split', on_change: Callable[[StackedSplit], None] | None = None, width: AnyDimension = None, height: AnyDimension = None)
Bases:
StackedSplit
A container which switches between children using expandable sections.
- active_child() AnyContainer
Return the currently active child container.
- load_container() AnyContainer
Create the accordiion widget’s container.
- mouse_handler(index: int, mouse_event: MouseEvent) NotImplementedOrNone
Handle mouse events.
- class euporie.core.widgets.layout.Box(body: AnyContainer, padding: AnyDimension = None, padding_left: AnyDimension = None, padding_right: AnyDimension = None, padding_top: AnyDimension = None, padding_bottom: AnyDimension = None, width: AnyDimension = None, height: AnyDimension = None, style: str = '', char: None | str | Callable[[], str] = None, modal: bool = False, key_bindings: KeyBindingsBase | None = None)
Bases:
object
Add padding around a container.
This also makes sure that the parent can provide more space than required by the child. This is very useful when wrapping a small element with a fixed size into a
VSplit
orHSplit
object. TheHSplit
andVSplit
try to make sure to adapt respectively the width and height, possibly shrinking other elements. Wrapping something in aBox
makes it flexible.- Parameters:
body – Another container object.
padding – The margin to be used around the body. This can be
padding_left (overridden by) – padding_bottom.
padding_right` – padding_bottom.
and (padding_top) – padding_bottom.
style – A style string.
char – Character to be used for filling the space around the body. (This is supposed to be a character with a terminal width of 1.)
- class euporie.core.widgets.layout.ConditionalSplit(vertical: FilterOrBool, *args: Any, **kwargs: Any)
Bases:
object
A split container where the orientation depends on a filter.
- container() _Split
Return the container for the current orientation.
- class euporie.core.widgets.layout.ReferencedSplit(split: type[_Split], children: Sequence[AnyContainer], *args: Any, **kwargs: Any)
Bases:
object
A split container which maintains a reference to it’s children.
- class euporie.core.widgets.layout.StackedSplit(children: Sequence[AnyContainer], titles: Sequence[AnyFormattedText], active: int = 0, style: str | Callable[[], str] = 'class:tab-split', on_change: Callable[[StackedSplit], None] | None = None, width: AnyDimension = None, height: AnyDimension = None)
Bases:
object
Base class for containers with selectable children.
- active_child() AnyContainer
Return the currently active child container.
- abstract load_container() AnyContainer
Abstract method for loading the widget’s container.
- class euporie.core.widgets.layout.TabBarControl(tabs: Sequence[TabBarTab] | Callable[[], Sequence[TabBarTab]], active: int | Callable[[], int], spacing: int = 1, closeable: bool = False, max_title_width: int = 30)
Bases:
UIControl
A control which shows a tab bar.
- char_bottom = '▁'
- char_close = '✖'
- char_left = '▏'
- char_right = '▕'
- char_top = '▁'
- create_content(width: int, height: int) UIContent
Generate the formatted text fragments which make the controls output.
- get_invalidate_events() Iterable[Event[object]]
Return a list of Event objects. This can be a generator. (The application collects all these events, in order to bind redraw handlers to these events.)
- get_key_bindings() KeyBindingsBase | None
The key bindings that are specific for this user control.
Return a
KeyBindings
object if some key bindings are specified, or None otherwise.
- mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone
Handle mouse events.
- move_cursor_down() None
Request to move the cursor down. This happens when scrolling down and the cursor is completely at the top.
- preferred_height(width: int, max_available_height: int, wrap_lines: bool, get_line_prefix: GetLinePrefixCallable | None) int | None
Return the preferred height of the tab-bar control (2 rows).
- class euporie.core.widgets.layout.TabBarTab(title: AnyFormattedText, on_activate: Callable, on_deactivate: Callable | None = None, on_close: Callable | None = None)
Bases:
NamedTuple
A named tuple represting a tab and it’s callbacks.
- count(value, /)
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
- on_activate: Callable
Alias for field number 1
- title: AnyFormattedText
Alias for field number 0
- class euporie.core.widgets.layout.TabbedSplit(children: Sequence[AnyContainer], titles: Sequence[AnyFormattedText], active: int = 0, style: str | Callable[[], str] = 'class:tab-split', on_change: Callable[[StackedSplit], None] | None = None, width: AnyDimension = None, height: AnyDimension = None, border: GridStyle = ▁▁▁▁ ▏ │▕ ▏─┼▕ ▔▔▔▔, show_borders: DiBool | None = None)
Bases:
StackedSplit
A container which switches between children using tabs.
- active_child() AnyContainer
Return the currently active child container.
- load_container() AnyContainer
Create the tabbed widget’s container.
Consists of a tab-bar control above a dynamic container which shows the active child container.
- Returns:
The widget’s container