euporie.core.widgets.menu
Define an application menu.
Functions
|
Turn a list of (style_str, text) tuples into another list where each string is exactly one character. |
|
Concatenate all the text parts again. |
|
Return the character width of this text fragment list. |
|
Get the current active (running) Application. |
|
Return width of a string. |
|
Enable when this buffer has the focus. |
|
Make sure that the given object is a |
|
Accept both booleans and Filters as input and turn it into a Filter. |
|
Convert the given value (which can be formatted text) into a list of text fragments. |
|
Turn any kind of formatted text back into plain text. |
Classes
|
A custom completions menu. |
A custom completions menu control. |
|
|
Turn any callable into a Filter. |
|
Wrapper around any other container that can change the visibility. |
Base class for user interface layout. |
|
|
Specified dimension (width/height) of a user control or window. |
|
Float for use in a |
|
Control that displays formatted text. |
|
Several layouts, one stacked above/under the other. |
A container for a set of key bindings. |
|
|
A container to hold the menubar and main application body. |
|
A prompt-toolkit compatible menu item with more advanced capabilities. |
|
Mouse event, sent to UIControl.mouse_handler. |
|
|
|
|
alias of |
|
|
Scroll offsets for the |
|
Draw a shadow underneath/behind this container. |
|
A container which allows attaching a status function. |
|
Content generated by a user control. |
|
Several layouts, one stacked left/right of the other. |
|
Container that holds a control. |
|
Create a new function with partial application of the given arguments and keywords. |
- class euporie.core.widgets.menu.CompletionsMenu(max_height: int | None = 16, scroll_offset: int | Callable[[], int] = 1, extra_filter: FilterOrBool = True, z_index: int = 100000000)
Bases:
ConditionalContainerA custom completions menu.
- get_key_bindings() → KeyBindingsBase | None
Returns a
KeyBindingsobject. 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
Dimensionthat represents the desired height for this container.
- preferred_width(max_available_width: int) → Dimension
Return a
Dimensionthat 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:
screen –
Screenmouse_handlers –
MouseHandlers.parent_style – Style string to pass to the
Windowobject. This will be applied to all content of the windows.VSplitandHSplitcan 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.widgets.menu.CompletionsMenuControl
Bases:
CompletionsMenuControlA custom completions menu control.
- MIN_WIDTH = 7
- 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
KeyBindingsobject if some key bindings are specified, or None otherwise.
- mouse_handler(mouse_event: MouseEvent) → NotImplementedOrNone
Handle mouse events: clicking and scrolling.
- move_cursor_down() → None
Request to move the cursor down. This happens when scrolling down and the cursor is completely at the top.
- class euporie.core.widgets.menu.MenuBar(app: BaseApp, menu_items: Sequence[MenuItem], grid: GridStyle = ▛▀▀▜ ▌ │▐ ▌─┼▐ ▙▄▄▟)
Bases:
objectA container to hold the menubar and main application body.
- class euporie.core.widgets.menu.MenuItem(formatted_text: AnyFormattedText = '', description: str = '', separator: bool = False, handler: Callable[[], None] | None = None, children: list[MenuItem] | None = None, shortcut: AnyFormattedText = '', hidden: FilterOrBool = False, disabled: FilterOrBool = False, toggled: Filter | None = None, collapse_prefix: bool = False, collapse_suffix: bool = True)
Bases:
objectA prompt-toolkit compatible menu item with more advanced capabilities.
It can use a function to generate formatted text to display, display a checkmark if a condition is true, and disable the handler if a condition is met.
- property formatted_text: StyleAndTextTuples
Generate the formatted text for this menu item.
- property prefix: StyleAndTextTuples
The item’s prefix.
Formatted text that will be displayed before the item’s main text. All prefixes in a menu are left aligned and padded to take up equal width.
- Returns:
Formatted text
- property suffix: StyleAndTextTuples
The item’s suffix.
Formatted text that will be displayed aligned right after them item’s main text.
- Returns:
Formatted text