euporie.core.bars.menu

Contains a completion menu for toolbars.

Functions

apply_style(ft, style)

Apply a style to formatted text.

ceil(x, /)

Return the ceiling of x as an Integral.

get_app()

Get the current active (running) Application.

get_cwidth(string)

Return width of a string.

pad(ft[, width, char, style])

Fill space at the end of lines.

truncate(ft, width[, style, placeholder, ...])

Truncate all lines at a given length.

Classes

Condition(func)

Turn any callable into a Filter.

ConditionalContainer(content, filter)

Wrapper around any other container that can change the visibility.

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

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

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

Several layouts, one stacked above/under the other.

Point(x, y)

SelectedCompletionMetaControl()

Control that shows the meta information of the selected completion.

ToolbarCompletionMenuControl([...])

A completion menu for toolbars.

ToolbarCompletionsMenu()

A completion menu widget for toolbars.

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

Content generated by a user control.

UIControl()

Base class for all user interface controls.

Window(*args, **kwargs)

Container that holds a control.

class euporie.core.bars.menu.SelectedCompletionMetaControl

Bases: UIControl

Control that shows the meta information of the selected completion.

create_content(width: int, height: int) UIContent

Format the current completion meta text.

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.

is_focusable() bool

Tell whether this user control is focusable.

mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

When NotImplemented is returned, it means that the given event is not handled by the UIControl itself. The Window or key bindings can decide to handle this event as scrolling or changing focus.

Parameters:

mouse_eventMouseEvent instance.

move_cursor_down() None

Request to move the cursor down. This happens when scrolling down and the cursor is completely at the top.

move_cursor_up() None

Request to move the cursor up.

preferred_height(width: int, max_available_height: int, wrap_lines: bool, get_line_prefix: GetLinePrefixCallable | None) int | None

Maintain a single line.

preferred_width(max_available_width: int) int | None

Report the width of the active meta text.

reset() None
class euporie.core.bars.menu.ToolbarCompletionMenuControl(min_item_width: int = 5, max_item_width: int = 30)

Bases: UIControl

A completion menu for toolbars.

create_content(width: int, height: int) UIContent

Create a UIContent object for this control.

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

Key bindings that are specific for this user control.

Return a KeyBindings object if some key bindings are specified, or None otherwise.

is_focusable() bool

Tell whether this user control is focusable.

mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

When NotImplemented is returned, it means that the given event is not handled by the UIControl itself. The Window or key bindings can decide to handle this event as scrolling or changing focus.

Parameters:

mouse_eventMouseEvent instance.

move_cursor_down() None

Request to move the cursor down.

This happens when scrolling down and the cursor is completely at the top.

move_cursor_up() None

Request to move the cursor up.

preferred_height(width: int, max_available_height: int, wrap_lines: bool, get_line_prefix: GetLinePrefixCallable | None) int | None

Calculate how many rows to use, filling the width first then overflowing.

preferred_width(max_available_width: int) int | None

Fill available width.

reset() None
class euporie.core.bars.menu.ToolbarCompletionsMenu

Bases: ConditionalContainer

A completion menu widget for toolbars.

get_children() list[Container]

Return the list of child Container objects.

get_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 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

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.