euporie.core.layout.containers

Overrides for PTK containers which only render visible lines.

Functions

explode_text_fragments(fragments)

Turn a list of (style_str, text) tuples into another list where each string is exactly one character.

fragment_list_width(fragments)

Return the character width of this text fragment list.

get_app()

Get the current active (running) Application.

get_cwidth(string)

Return width of a string.

to_formatted_text(value[, style, auto_convert])

Convert the given value (which can be formatted text) into a list of text fragments.

to_str(value)

Turn callable or string into string.

Classes

BoundedWritePosition(xpos, ypos, width, height)

A write position which also hold bounding box information.

Container()

Base class for user interface layout.

DiInt([top, right, bottom, left])

A tuple of four integers with directions.

Dimension([min, max, weight, preferred])

Specified dimension (width/height) of a user control or window.

DummyControl()

A dummy control object that doesn't paint any content.

FastDictCache(get_value[, size])

Fast, lightweight cache which keeps at most size items.

FloatContainer(content, floats[, modal, ...])

A FloatContainer which uses :py`BoundedWritePosition`s.

FormattedTextControl([text, style, ...])

Control that displays formatted text.

HSplit(children[, window_too_small, align, ...])

Several layouts, one stacked above/under the other.

HorizontalAlign(value[, names, module, ...])

Alignment for VSplit.

MouseEvent(position, event_type, button, ...)

Mouse event, sent to UIControl.mouse_handler.

MouseEventType(value[, names, module, ...])

Point(x, y)

PtkDummyControl

alias of DummyControl

UIContent(get_line, StyleAndTextTuples] = >, ...)

Content generated by a user control.

VSplit(children[, window_too_small, align, ...])

Several layouts, one stacked left/right of the other.

VerticalAlign(value[, names, module, ...])

Alignment for HSplit.

Window(*args, **kwargs)

Container that holds a control.

WindowAlign(value[, names, module, ...])

Alignment of the Window content.

WindowRenderInfo(window, ui_content, ...)

Render information for the last render time of this control.

partial

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

class euporie.core.layout.containers.FloatContainer(content: AnyContainer, floats: list[Float], modal: bool = False, key_bindings: KeyBindingsBase | None = None, style: str | Callable[[], str] = '', z_index: int | None = None)

Bases: FloatContainer

A FloatContainer which uses :py`BoundedWritePosition`s.

get_children() list[prompt_toolkit.layout.containers.Container]

Return the list of child Container objects.

get_key_bindings() prompt_toolkit.key_binding.key_bindings.KeyBindingsBase | None

Returns a KeyBindings object. These bindings become active when any user control in this container has the focus, except if any containers between this container and the focused user control is modal.

is_modal() bool

When this container is modal, key bindings from parent containers are not taken into account if a user control in this container is focused.

preferred_height(width: int, max_available_height: int) Dimension

Return the preferred height of the float container. (We don’t care about the height of the floats, they should always fit into the dimensions provided by the container.)

preferred_width(max_available_width: int) Dimension

Return a Dimension that represents the desired width for this container.

reset() None

Reset the state of this container and all the children. (E.g. reset scroll offsets, etc…)

write_to_screen(screen: Screen, mouse_handlers: MouseHandlers, write_position: WritePosition, parent_style: str, erase_bg: bool, z_index: int | None) None

Write the actual content to the screen.

Parameters:
  • screenScreen

  • mouse_handlersMouseHandlers.

  • parent_style – Style string to pass to the Window object. This will be applied to all content of the windows. VSplit and HSplit can use it to pass their style down to the windows that they contain.

  • z_index – Used for propagating z_index from parent to child.

class euporie.core.layout.containers.HSplit(children: Sequence[AnyContainer], window_too_small: Container | None = None, align: VerticalAlign = VerticalAlign.JUSTIFY, padding: AnyDimension = 0, padding_char: str | None = None, padding_style: str = '', width: AnyDimension = None, height: AnyDimension = None, z_index: int | None = None, modal: bool = False, key_bindings: KeyBindingsBase | None = None, style: str | Callable[[], str] = '')

Bases: HSplit

Several layouts, one stacked above/under the other.

get_children() list[prompt_toolkit.layout.containers.Container]

Return the list of child Container objects.

get_key_bindings() prompt_toolkit.key_binding.key_bindings.KeyBindingsBase | None

Returns a KeyBindings object. These bindings become active when any user control in this container has the focus, except if any containers between this container and the focused user control is modal.

is_modal() bool

When this container is modal, key bindings from parent containers are not taken into account if a user control in this container is focused.

property pad_window: Window

Create a single instance of the padding window.

preferred_height(width: int, max_available_height: int) Dimension

Return a Dimension that represents the desired height for this container.

preferred_width(max_available_width: int) Dimension

Return a Dimension that represents the desired width for this container.

reset() None

Reset the state of this container and all the children. (E.g. reset scroll offsets, etc…)

write_to_screen(screen: Screen, mouse_handlers: MouseHandlers, write_position: WritePosition, parent_style: str, erase_bg: bool, z_index: int | None) None

Render the prompt to a Screen instance.

Parameters:

screen – The Screen class to which the output has to be written.

class euporie.core.layout.containers.VSplit(children: Sequence[AnyContainer], window_too_small: Container | None = None, align: HorizontalAlign = HorizontalAlign.JUSTIFY, padding: AnyDimension = 0, padding_char: str | None = None, padding_style: str = '', width: AnyDimension = None, height: AnyDimension = None, z_index: int | None = None, modal: bool = False, key_bindings: KeyBindingsBase | None = None, style: str | Callable[[], str] = '')

Bases: VSplit

Several layouts, one stacked left/right of the other.

get_children() list[prompt_toolkit.layout.containers.Container]

Return the list of child Container objects.

get_key_bindings() prompt_toolkit.key_binding.key_bindings.KeyBindingsBase | None

Returns a KeyBindings object. These bindings become active when any user control in this container has the focus, except if any containers between this container and the focused user control is modal.

is_modal() bool

When this container is modal, key bindings from parent containers are not taken into account if a user control in this container is focused.

property pad_window: Window

Create a single instance of the padding window.

preferred_height(width: int, max_available_height: int) Dimension

Return a Dimension that represents the desired height for this container.

preferred_width(max_available_width: int) Dimension

Return a Dimension that represents the desired width for this container.

reset() None

Reset the state of this container and all the children. (E.g. reset scroll offsets, etc…)

write_to_screen(screen: Screen, mouse_handlers: MouseHandlers, write_position: WritePosition, parent_style: str, erase_bg: bool, z_index: int | None) None

Render the prompt to a Screen instance.

Parameters:

screen – The Screen class to which the output has to be written.

class euporie.core.layout.containers.Window(*args: Any, **kwargs: Any)

Bases: Window

Container that holds a control.

get_children() list[prompt_toolkit.layout.containers.Container]

Return the list of child Container objects.

get_key_bindings() prompt_toolkit.key_binding.key_bindings.KeyBindingsBase | None

Returns a KeyBindings object. These bindings become active when any user control in this container has the focus, except if any containers between this container and the focused user control is modal.

is_modal() bool

When this container is modal, key bindings from parent containers are not taken into account if a user control in this container is focused.

preferred_height(width: int, max_available_height: int) Dimension

Calculate the preferred height for this window.

preferred_width(max_available_width: int) Dimension

Calculate the preferred width for this window.

reset() None

Reset the state of this container and all the children. (E.g. reset scroll offsets, etc…)

write_to_screen(screen: Screen, mouse_handlers: MouseHandlers, write_position: WritePosition, parent_style: str, erase_bg: bool, z_index: int | None) None

Write window to screen.