euporie.core.widgets.decor

Decorative widgets.

Functions

add_setting(name, default, help_, description)

Register a new config item.

get_app()

Get the current active (running) Application.

has_focus(value)

Enable when this buffer has the focus.

to_container(container)

Make sure that the given object is a Container.

to_filter(bool_or_filter)

Accept both booleans and Filters as input and turn it into a Filter.

Classes

Border(body, border, style, str] =, show_borders)

Draw a border around any container.

Char([char, style])

Represent a single character in a Screen.

ColorPaletteColor(base[, _base_override])

A representation of a color with adjustment methods.

ConditionalContainer(content, filter)

Wrapper around any other container that can change the visibility.

Container()

Base class for user interface layout.

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

A tuple of four bools with directions.

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

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

DropShadow([amount])

A transparent container which makes the background darker.

DynamicContainer(get_container)

Container class that dynamically returns any Container.

FastDictCache(get_value[, size])

Fast, lightweight cache which keeps at most size items.

Float(content[, top, right, bottom, left, ...])

Float for use in a FloatContainer.

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

Container which can contain another container for the background, as well as a list of floating containers on top of it.

FocusedStyle(body[, style_focus, style_hover])

Apply a style to child containers when focused or hovered.

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

Several layouts, one stacked above/under the other. ::.

Line([char, width, height, collapse, style])

Draw a horizontal or vertical line.

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

MouseHandlers()

Two dimensional raster of callbacks for mouse events.

Pattern(char[, pattern])

Fill an area with a repeating background pattern.

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

Two dimensional buffer of Char instances.

Shadow(body)

Draw a shadow underneath/behind this container.

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

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

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

Container that holds a control.

WritePosition(xpos, ypos, width, height)

class euporie.core.widgets.decor.Border(body: AnyContainer, border: GridStyle | None = ┌─┬┐ ││ ├─┼┤ └─┴┘, style: str | Callable[[], str] = 'class:border', show_borders: DiBool | None = None)

Bases: object

Draw a border around any container.

add_style(extra: str) Callable[[], str]

Return a function which adds a style string to the border style.

class euporie.core.widgets.decor.DropShadow(amount: float = 0.5)

Bases: prompt_toolkit.layout.containers.Container

A transparent container which makes the background darker.

property cp: ColorPalette

Get the current app’s current color palette.

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

Return an empty 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) prompt_toolkit.layout.dimension.Dimension

Return the wrapped container’s preferred height.

preferred_width(max_available_width: int) prompt_toolkit.layout.dimension.Dimension

Return the wrapped container’s preferred width.

reset() None

Reet the wrapped container - here, do nothing.

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

Draw the wrapped container with the additional style.

class euporie.core.widgets.decor.FocusedStyle(body: AnyContainer, style_focus: str | Callable[[], str] = 'class:focused', style_hover: str | Callable[[], str] = '')

Bases: prompt_toolkit.layout.containers.Container

Apply a style to child containers when focused or hovered.

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.

get_style() str

Determine the style to apply depending on the focus status.

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) prompt_toolkit.layout.dimension.Dimension

Return the wrapped container’s preferred height.

preferred_width(max_available_width: int) prompt_toolkit.layout.dimension.Dimension

Return the wrapped container’s preferred width.

reset() None

Reet the wrapped container.

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

Draw the wrapped container with the additional style.

class euporie.core.widgets.decor.Line(char: str | None = None, width: int | None = None, height: int | None = None, collapse: bool = False, style: str = 'class:grid-line')

Bases: prompt_toolkit.layout.containers.Container

Draw a horizontal or vertical line.

get_children() list

Return an empty list of the container’s children.

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) prompt_toolkit.layout.dimension.Dimension

Return the preferred height of the line.

preferred_width(max_available_width: int) prompt_toolkit.layout.dimension.Dimension

Return the preferred width of the line.

reset() None

Reet the state of the line. Does nothing.

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

Draw a continuous line in the write_position area.

Parameters
class euporie.core.widgets.decor.Pattern(char: str | Callable[[], str], pattern: int | Callable[[], int] = 1)

Bases: prompt_toolkit.layout.containers.Container

Fill an area with a repeating background pattern.

get_children() list

Return an empty list of the container’s children.

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) prompt_toolkit.layout.dimension.Dimension

Return an empty dimension (expand to available height).

preferred_width(max_available_width: int) prompt_toolkit.layout.dimension.Dimension

Return an empty dimension (expand to available width).

reset() None

Reet the pattern. Does nothing.

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

Fill the whole area of write_position with a pattern.

Parameters
class euporie.core.widgets.decor.Shadow(body: AnyContainer)

Bases: object

Draw a shadow underneath/behind this container.

This is a globally configurable version of the prompt_toolkit.widows.base.Shadow class.