euporie.core.layout.cache

Defines a container which saves rendered output and re-displays it.

Functions

get_app()

Get the current active (running) Application.

lru_cache([maxsize, typed])

Least-recently-used cache decorator.

to_container(container)

Make sure that the given object is a Container.

walk(container[, skip_hidden])

Walk through layout, starting at this container.

Classes

BoundedWritePosition(xpos, ypos, width, height)

A write position which also hold bounding box information.

CachedContainer(content[, mouse_handler_wrapper])

A container which renders its content once and caches the output.

Container()

Base class for user interface layout.

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

A tuple of four integers with directions.

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

Mouse event, sent to UIControl.mouse_handler.

MouseHandlers()

Two dimensional raster of callbacks for mouse events.

Point(x, y)

Screen([default_char, initial_width, ...])

Screen class which uses :py:`BoundedWritePosition`s.

Window([content, width, height, z_index, ...])

Container that holds a control.

WindowRenderInfo(window, ui_content, ...)

Render information for the last render time of this control.

class euporie.core.layout.cache.CachedContainer(content: AnyContainer, mouse_handler_wrapper: Callable[[MouseHandler, CachedContainer], MouseHandler] | None = None)

Bases: Container

A container which renders its content once and caches the output.

blit(screen: PtkScreen, mouse_handlers: MouseHandlers, left: int, top: int, cols: slice, rows: slice) None

Copy the rendered child from the local screen to the main screen.

All locations are adjusted, allowing the pre-rendered child to be placed at any location on the main screen.

Parameters:
  • screen – The main screen to copy the pre-rendered screen data to

  • mouse_handlers – The mouse handler collection to copy the pre-rendered handelers to

  • left – The left-most column in which to start placing the data

  • top – The upper row in which to start placing the data

  • cols – The columns to copy

  • rows – The rows to copy .

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

Return a list of all child containers.

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.

invalidate() None

Flag the child’s rendering as out-of-date.

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 layout_hash: int

Return a hash of the child’s current layout.

preferred_height(width: int, max_available_height: int) Dimension

Return the desired height for this container.

preferred_width(max_available_width: int) Dimension

Return the desired width for this container.

render(available_width: int, available_height: int, style: str = '', start: int | None = None, end: int | None = None) None

Render the child container at a given size.

Parameters:
  • available_width – The height available for rendering

  • available_height – The width available for rendering

  • style – The parent style to apply when rendering

  • bbox – The bounding box for the content to render

  • start – Rows between top of output and top of scrollable pane

  • end – Rows between top of output and bottom of scrollable pane

reset() None

Reset the state of this container.

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

Render the container to a Screen instance.

Parameters: