euporie.core.widgets.palette

Contain the command palette container.

Functions

NamedTuple(typename[, fields])

Typed version of namedtuple.

add_cmd(**kwargs)

Add a command to the centralized command system.

focus_next(event)

Focus the next visible Window.

focus_previous(event)

Focus the previous visible Window.

get_app()

Get the current active (running) Application.

register_bindings(bindings)

Update the key-binding registry.

Classes

Command(handler, *, filter, hidden, name, ...)

Wrap a function so it can be used as a key-binding or a menu item.

CommandMenuControl(command_palette[, width])

A filterable and navigable list of commands.

CommandPalette(app)

A command palette which allows searching the available commands.

Condition(func)

Turn any callable into a Filter.

Dialog(app)

A modal dialog which is displayed above the application.

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.

MarginContainer(margin, target)

A container which renders a stand-alone margin.

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

Mouse event, sent to UIControl.mouse_handler.

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

Point(x, y)

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

Scroll offsets for the Window class.

ScrollbarMargin([display_arrows, ...])

Margin displaying a scrollbar.

StatusContainer(body, status)

A container which allows attaching a status function.

Text([text, style, height, min_height, ...])

A text input widget.

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

Content generated by a user control.

UIControl()

Base class for all user interface controls.

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

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

Window(*args, **kwargs)

Container that holds a control.

partial

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

class euporie.core.widgets.palette.CommandMenuControl(command_palette: CommandPalette, width: int = 60)

Bases: UIControl

A filterable and navigable list of commands.

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

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 clicking and scrolling 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.

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

Return the preferred height of the command list.

preferred_width(max_available_width: int) int | None

Return the preferred width of the command list.

reset() None
class euporie.core.widgets.palette.CommandPalette(app: BaseApp)

Bases: Dialog

A command palette which allows searching the available commands.

accept(buffer: Buffer | None = None) bool

Call on enter: runs the selected command.

body: AnyContainer
body_padding_bottom = 0
body_padding_top = 0
property button_widgets: list[AnyContainer]

A list of button widgets to show in the dialog’s row of buttons.

buttons: dict[str, Callable | None]
get_height() int | None
get_width() int | None
hide(event: KeyPressEvent | None = None) None

Hide the dialog.

index: int
last_focused: UIControl | None
load() None

Reset the dialog ready for display.

matches: list[_CommandMatch]
select(n: int, event: KeyPressEvent | None = None) None

Change the index of the selected command.

Parameters:
  • n – The relative amount by which to change the selected index

  • event – Ignored

show(**params: Any) None

Display and focuses the dialog.

text_changed(buffer: Buffer) None

Call when the input text changes: filters the command list.

title: AnyFormattedText | None = 'Search for a command'
to_focus: FocusableElement | None
toggle() None

Show or hides the dialog.