euporie.core.widgets.forms

Contain input widgets.

Functions

abstractmethod(funcobj)

A decorator indicating abstract methods.

align(ft[, how, width, style, placeholder, ...])

Align formatted text at a given width.

cast(typ, val)

Cast a value to a type.

ceil(x, /)

Return the ceiling of x as an Integral.

explode_text_fragments(fragments)

Turn a list of (style_str, text) tuples into another list where each string is exactly one character.

floor(x, /)

Return the floor of x as an Integral.

fragment_list_len(fragments)

Return the amount of characters in this text fragment list.

fragment_list_width(fragments)

Return the character width of this text fragment list.

get_app()

Get the current active (running) Application.

has_focus(value)

Enable when this buffer has the focus.

is_true(value)

Test whether value is True.

merge_key_bindings(bindings)

Merge multiple Keybinding objects together.

to_filter(bool_or_filter)

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

to_formatted_text(value[, style, auto_convert])

Convert the given value (which can be formatted text) into a list of text fragments.

Classes

ABCMeta(name, bases, namespace, /, **kwargs)

Metaclass for defining Abstract Base Classes (ABCs).

AfterInput(text[, style])

Insert text after the input.

Always()

Always enable feature.

BaseButton(body, on_click, ...)

A clickable button widget which contains another container.

BeforeInput(text[, style])

Insert text before the input.

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

Draw a border around any container.

Box(body[, padding, padding_left, ...])

Add padding around a container.

Buffer([completer, auto_suggest, history, ...])

The core data structure that holds the text and cursor position of the current input line and implements all text manipulations on top of it.

BufferControl([buffer, input_processors, ...])

Control for visualizing the content of a Buffer.

Button(text, width, align, ...)

A clickable button widget which holds text.

Checkbox([text, on_click, prefix, style, ...])

A toggleable checkbox widget.

Completer()

Base class for completer implementations.

Condition(func)

Turn any callable into a Filter.

ConditionalCompleter(completer, filter)

Wrapper around any other completer that will enable/disable the completions depending on whether the received condition is satisfied.

ConditionalContainer(content, filter[, ...])

Wrapper around any other container that can change the visibility.

ConditionalKeyBindings(key_bindings[, filter])

Wraps around a KeyBindings. Disable/enable all the key bindings according to the given (additional) filter.::.

ConditionalProcessor(processor, filter)

Processor that applies another processor, according to a certain condition. Example::.

ConditionalSplit(vertical, *args, **kwargs)

A split container where the orientation depends on a filter.

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

A tuple of four bools with directions.

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

A tuple of four integers with directions.

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

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

Document([text, cursor_position, selection])

This is a immutable class around the text and cursor position, and contains methods for querying this data, e.g. to give the text before the cursor.

Dropdown(options[, labels, index, indices, ...])

A dropdown widget, allowing selection of an item from a menu of options.

DynamicAutoSuggest(get_auto_suggest)

Validator class that can dynamically returns any Validator.

DynamicContainer(get_container)

Container class that dynamically returns any Container.

DynamicLexer(get_lexer)

Lexer class that can dynamically returns any Lexer.

Event(sender[, handler])

Simple event to which event handlers can be attached. For instance::.

ExpandingBufferControl([buffer, ...])

A sub-class of BufferControl which expands to the available width.

Filter()

Base class for any filter to activate/deactivate a feature, depending on a condition.

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

Float for use in a FloatContainer.

FormattedTextAlign(*values)

Alignment of formatted text.

FormattedTextControl([text, style, ...])

Control that displays formatted text.

KeyBindings()

A container for a set of key bindings.

Label(value[, style, html, ...])

A label widget which displays rich text.

LabelledWidget(body, label[, style, ...])

A widget which applies a label to another widget.

Lexer()

Base class for all lexers.

MarginContainer(margin, target)

A container which renders a stand-alone margin.

MouseButton(*values)

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

Mouse event, sent to UIControl.mouse_handler.

MouseEventType(*values)

MouseHandlerWrapper(content, handler)

A container which wraps mouse events to add a mouse handler.

NavigableFormattedTextControl([text, style, ...])

Formatted text control where the cursor can be moved by scrolling.

PasswordProcessor([char])

Processor that masks the input.

Point(x, y)

Processor()

Manipulate the fragments for a given line in a BufferControl.

Progress([start, stop, step, value, ...])

A progress-bar widget.

ProgressControl([start, stop, step, value, ...])

A control which draws a progress-bar.

ScrollbarMargin([display_arrows, ...])

Margin displaying a scrollbar.

Select(options, labels, index, indices, ...)

A select widget, which allows one or more items to be selected from a list.

SelectableWidget(options[, labels, index, ...])

Base class for widgets where one or more items can be selected.

Shadow(body)

Draw a shadow underneath/behind this container.

SimpleCache([maxsize])

Very simple cache that discards the oldest item when the cache size is exceeded.

SizedMask([size])

Mask with restricted number of True items.

Slider(options, labels, index, indices, ...)

A slider widget with an optional editable readout.

SliderControl(slider[, show_arrows, ...])

A control to display a slider.

Swatch(color, str] =, width, height, style, ...)

An widget which displays a given color.

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

A text input widget.

ToggleButton(text, on_click, ...)

A toggleable button widget.

ToggleButtons(options, labels, index, ...)

A widget where an option is selected using mutually exclusive toggle-buttons.

ToggleableWidget()

Base class for toggleable widgets.

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.

ValidationState(*values)

The validation state of a buffer.

Validator()

Abstract base class for an input validator.

Window(*args, **kwargs)

Container that holds a control.

WindowAlign(*values)

Alignment of the Window content.

WordCompleter(words[, ignore_case, ...])

Simple autocompletion on a list of words.

WritePosition(xpos, ypos, width, height)

deque

A list-like sequence optimized for data accesses near its endpoints.

finalize(obj, func, /, *args, **kwargs)

Class for finalization of weakrefable objects

partial(func, /, *args, **keywords)

Create a new function with partial application of the given arguments and keywords.

class euporie.core.widgets.forms.BaseButton(body: AnyContainer, on_click: Callable[[BaseButton], None] | None = None, on_mouse_down: Callable[[BaseButton], None] | None = None, disabled: FilterOrBool = False, style: str | Callable[[], str] = 'class:input', border: GridStyle | None =  ▁▁  🮇 │▎ 🮇─┼▎  ▔▔ , show_borders: DiBool | None = None, padding: DiInt | None = None, selected: bool = False, key_bindings: KeyBindingsBase | None = None, mouse_handler: Callable[[MouseEvent], NotImplementedOrNone] | None = None)

Bases: object

A clickable button widget which contains another container.

default_mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

get_key_bindings() KeyBindingsBase

Key bindings for the Button.

get_style() str

Return the style for the button given its current state.

class euporie.core.widgets.forms.Button(text: AnyFormattedText, width: AnyDimension | None = None, align: WindowAlign = WindowAlign.CENTER, dont_extend_height: FilterOrBool = True, dont_extend_width: FilterOrBool = True, on_click: Callable[[BaseButton], None] | None = None, on_mouse_down: Callable[[BaseButton], None] | None = None, disabled: FilterOrBool = False, style: str | Callable[[], str] = 'class:input', border: GridStyle | None =  ▁▁  🮇 │▎ 🮇─┼▎  ▔▔ , show_borders: DiBool | None = None, padding: DiInt | None = None, selected: bool = False, key_bindings: KeyBindingsBase | None = None, mouse_handler: Callable[[MouseEvent], NotImplementedOrNone] | None = None)

Bases: BaseButton

A clickable button widget which holds text.

default_mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

get_key_bindings() KeyBindingsBase

Key bindings for the Button.

get_style() str

Return the style for the button given its current state.

class euporie.core.widgets.forms.Checkbox(text: AnyFormattedText = '', on_click: Callable[[ToggleableWidget], None] | None = None, prefix: tuple[str, str] = ('☐', '☑'), style: str = 'class:input', selected: bool = False, disabled: FilterOrBool = False, key_bindings: KeyBindingsBase | None = None)

Bases: ToggleableWidget

A toggleable checkbox widget.

container: AnyContainer
default_mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Focus on mouse down and toggle state on mouse up.

disabled: Filter
key_bindings: KeyBindingsBase | None
on_click: Event
selected: bool
toggle() None

Toggle the selected state and trigger the “clicked” callback.

class euporie.core.widgets.forms.Dropdown(options: list[Any], labels: Sequence[AnyFormattedText] | None = None, index: int | None = None, indices: list[int] | None = None, n_values: int | None = None, multiple: FilterOrBool = False, max_count: int | None = None, on_change: Callable[[SelectableWidget], None] | None = None, style: str | Callable[[], str] = 'class:input', arrow: str = '⯆', disabled: FilterOrBool = False, width: int | None = None, expand: FilterOrBool = True)

Bases: SelectableWidget

A dropdown widget, allowing selection of an item from a menu of options.

button_text() StyleAndTextTuples

Return the text to display on the button.

close_menu() None

Close the menu and untoggle the button.

hover_rel(rel: int) None

Hover an index relative to the current hovered index.

property index: int | None

Return the first selected index.

property indices: list[int]

Return a list of the selected indices.

key_bindings() KeyBindingsBase

Return key-bindings for the drop-down widget.

load_container() AnyContainer

Load the widget’s container.

property mask: list[bool]

Get mask of selected options.

menu_fragments() StyleAndTextTuples

Return formatted text fragment to display in the menu.

mouse_handler(i: int, mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

mouse_handler_button(mouse_event: MouseEvent) NotImplementedOrNone

Focus on mouse down and toggle state on mouse up.

mouse_handler_menu(i: int, mouse_event: MouseEvent) None

Handle mouse events.

select_rel(rel: int) None

Select an index relative to the current index.

show_menu() None

Close the menu and untoggle the button.

property style: str

Return the widget’s style.

toggle_item(index: int) None

Toggle the selection status of the option at a given index.

property value: Any

Return the selected value.

property values: list[Any]

Return a list of the selected values.

class euporie.core.widgets.forms.ExpandingBufferControl(buffer: Buffer | None = None, input_processors: list[Processor] | None = None, include_default_input_processors: bool = True, lexer: Lexer | None = None, preview_search: FilterOrBool = False, focusable: FilterOrBool = True, search_buffer_control: OptionalSearchBuffer = None, menu_position: Callable[[], int | None] | None = None, focus_on_click: FilterOrBool = False, key_bindings: KeyBindingsBase | None = None, expand: FilterOrBool = True, on_focus: Callable[[], None] | None = None)

Bases: BufferControl

A sub-class of BufferControl which expands to the available width.

create_content(width: int, height: int, preview_search: bool = False) UIContent

Create a UIContent.

get_invalidate_events() Iterable[Event[object]]

Return the Window invalidate events.

get_key_bindings() KeyBindingsBase | None

When additional key bindings are given. Return these.

is_focusable() bool

Tell whether this user control is focusable.

mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Optionally call focus handler when focused.

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
preferred_width(max_available_width: int) int | None

Enure text box expands to available width.

Parameters:

max_available_width – The maximum available width

Returns:

The desired width, which is the maximum available

reset() None
property search_buffer: Buffer | None
property search_buffer_control: SearchBufferControl | None
property search_state: SearchState

Return the SearchState for searching this BufferControl. This is always associated with the search control. If one search bar is used for searching multiple BufferControls, then they share the same SearchState.

class euporie.core.widgets.forms.Label(value: AnyFormattedText, style: str | Callable[[], str] = 'class:input', html: FilterOrBool = False, dont_extend_height: FilterOrBool = True, dont_extend_width: FilterOrBool = True, align: WindowAlign | Callable[[], WindowAlign] = WindowAlign.LEFT, wrap_lines: FilterOrBool = True)

Bases: object

A label widget which displays rich text.

get_value() AnyFormattedText

Return the current value of the label, converting to formatted text.

class euporie.core.widgets.forms.LabelledWidget(body: AnyContainer, label: AnyFormattedText, style: str = 'class:input', vertical: FilterOrBool = False, html: FilterOrBool = False)

Bases: object

A widget which applies a label to another widget.

property html: Filter

Get the HTML filter value.

class euporie.core.widgets.forms.NavigableFormattedTextControl(text: AnyFormattedText = '', style: str = '', focusable: FilterOrBool = False, key_bindings: KeyBindingsBase | None = None, show_cursor: bool = True, modal: bool = False, get_cursor_position: Callable[[], Point | None] | None = None, move_cursor_up: Callable[[], None] | None = None, move_cursor_down: Callable[[], None] | None = None)

Bases: FormattedTextControl

Formatted text control where the cursor can be moved by scrolling.

create_content(width: int, height: int | None) UIContent

Generate the content for this user control.

Returns a UIContent instance.

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.

is_modal() bool
mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

(When the fragment list contained mouse handlers and the user clicked on on any of these, the matching handler is called. This handler can still return NotImplemented in case we want the Window to handle this particular event.)

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 for this control.

preferred_width(max_available_width: int) int

Return the preferred width for this control. That is the width of the longest line.

reset() None
class euporie.core.widgets.forms.Progress(start: float | int = 0, stop: float | int = 100, step: float | int = 1, value: float | int = 0, vertical: FilterOrBool = False, style: str | Callable[[], str] = 'class:input')

Bases: object

A progress-bar widget.

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

Add an additional style to the widget’s base style.

property value: float | int

Return the current value of the proegress-bar.

class euporie.core.widgets.forms.ProgressControl(start: float | int = 0, stop: float | int = 100, step: float | int = 1, value: float | int = 0, vertical: Filter | bool = False)

Bases: UIControl

A control which draws a progress-bar.

create_content(width: int, height: int) UIContent

Get or render content for a given output size.

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.

hchars = ('', '▏', '▎', '▍', '▌', '▋', '▊', '▉', '█')
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

Determine the height of the progress-bar depending on its orientation.

preferred_width(max_available_width: int) int | None

Determine the width of the progress-bar depending on its orientation.

render(width: int, height: int) list[StyleAndTextTuples]

Render the progressbar at a given size as lines of formatted text.

reset() None
vchars = ('', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█')
class euporie.core.widgets.forms.Select(options: list[Any], labels: Sequence[AnyFormattedText] | None = None, index: int | None = None, indices: list[int] | None = None, n_values: int | None = None, multiple: FilterOrBool = False, max_count: int | None = None, on_change: Callable[[SelectableWidget], None] | None = None, style: str | Callable[[], str] = 'class:input,select', rows: int | None = 3, prefix: tuple[str, str] = ('', ''), border: GridStyle | None =  ▁▁  🮇 │▎ 🮇─┼▎  ▔▔ , show_borders: DiBool | None = None, disabled: FilterOrBool = False, dont_extend_width: FilterOrBool = True, dont_extend_height: FilterOrBool = True)

Bases: SelectableWidget

A select widget, which allows one or more items to be selected from a list.

hover_rel(rel: int) None

Hover an index relative to the current hovered index.

property index: int | None

Return the first selected index.

property indices: list[int]

Return a list of the selected indices.

key_bindings() KeyBindingsBase

Key bindings for the selectable widget.

load_container() AnyContainer

Load the widget’s container.

property mask: list[bool]

Get mask of selected options.

mouse_handler(i: int, mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

select_rel(rel: int) None

Select an index relative to the current index.

property style: str

Return the widget’s style.

text_fragments() StyleAndTextTuples

Create a list of formatted text fragments to display.

toggle_item(index: int) None

Toggle the selection status of the option at a given index.

property value: Any

Return the selected value.

property values: list[Any]

Return a list of the selected values.

class euporie.core.widgets.forms.SelectableWidget(options: list[Any], labels: Sequence[AnyFormattedText] | None = None, index: int | None = None, indices: list[int] | None = None, n_values: int | None = None, multiple: FilterOrBool = False, max_count: int | None = None, on_change: Callable[[SelectableWidget], None] | None = None, style: str | Callable[[], str] = 'class:input', disabled: FilterOrBool = False)

Bases: object

Base class for widgets where one or more items can be selected.

hover_rel(rel: int) None

Hover an index relative to the current hovered index.

property index: int | None

Return the first selected index.

property indices: list[int]

Return a list of the selected indices.

key_bindings() KeyBindingsBase

Key bindings for the selectable widget.

abstractmethod load_container() AnyContainer

Abstract method for loading the widget’s container.

property mask: list[bool]

Get mask of selected options.

mouse_handler(i: int, mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

select_rel(rel: int) None

Select an index relative to the current index.

property style: str

Return the widget’s style.

toggle_item(index: int) None

Toggle the selection status of the option at a given index.

property value: Any

Return the selected value.

property values: list[Any]

Return a list of the selected values.

class euporie.core.widgets.forms.SizedMask(size: int | None = None)

Bases: dict[int, bool]

Mask with restricted number of True items.

clear() None

Clear the dict’s items.

copy()

Return a shallow copy of the dict.

classmethod fromkeys(iterable, value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items()

Return a set-like object providing a view on the dict’s items.

keys()

Return a set-like object providing a view on the dict’s keys.

pop(k[, d]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Return an object providing a view on the dict’s values.

class euporie.core.widgets.forms.Slider(options: list[Any], labels: Sequence[AnyFormattedText] | None = None, index: int | None = None, indices: list[int] | None = None, n_values: int | None = None, multiple: FilterOrBool = False, max_count: int | None = None, on_change: Callable[[SelectableWidget], None] | None = None, style: str | Callable[[], str] = 'class:input', border: GridStyle =  ▁▁  🮇 │▎ 🮇─┼▎  ▔▔ , show_borders: DiBool | None = None, vertical: FilterOrBool = False, show_arrows: FilterOrBool = True, arrows: tuple[AnyFormattedText, AnyFormattedText] = ('-', '+'), show_readout: FilterOrBool = True, disabled: FilterOrBool = False)

Bases: SelectableWidget

A slider widget with an optional editable readout.

accept_handler(buffer: Buffer) bool

Set the index to the value(s) entered in the readout buffer.

control: SliderControl
hover_rel(rel: int) None

Hover an index relative to the current hovered index.

property index: int | None

Return the first selected index.

property indices: list[int]

Return a list of the selected indices.

key_bindings() KeyBindingsBase

Key bindings for the selectable widget.

load_container() AnyContainer

Build the slider’s container.

property mask: list[bool]

Get mask of selected options.

mouse_handler(i: int, mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

readout: Text
readout_len() int

Return the length of the readout text area.

readout_text(indices: list[int]) str

Return the readout text area value.

select_rel(rel: int) None

Select an index relative to the current index.

property style: str

Return the widget’s style.

toggle_item(index: int) None

Toggle the selection status of the option at a given index.

validate_readout(text: str) list[Any] | None

Confirm the value entered in the readout is value.

property value: Any

Return the selected value.

value_changed(slider: SelectableWidget | None = None) None

Set the readout text when the slider value changes.

property values: list[Any]

Return a list of the selected values.

class euporie.core.widgets.forms.SliderControl(slider: Slider, show_arrows: Filter | bool = True, handle_char: str = '●', track_char: str | None = None, selected_track_char: str | None = None, style: str = 'class:input', disabled: Filter | bool = False)

Bases: UIControl

A control to display a slider.

create_content(width: int, height: int) UIContent

Create an cache the rendered control fragments.

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 for the Slider.

is_focusable() bool

Tell whether this user control is focusable.

mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events given the slider’s orientation.

mouse_handler_(mouse_event: MouseEvent, loc: int) NotImplementedOrNone

Handle mouse events.

mouse_handler_arrow(mouse_event: MouseEvent, n: int = 0) NotImplementedOrNone

Handle mouse events on the slider’s arrows.

mouse_handler_handle(mouse_event: MouseEvent, handle: int = 0) NotImplementedOrNone

Handle mouse events on the slider’s handles.

mouse_handler_scroll(mouse_event: MouseEvent, handle: int | None = None) NotImplementedOrNone

Handle mouse scroll events.

mouse_handler_track(mouse_event: MouseEvent, index: int = 0) NotImplementedOrNone

Handle mouse events on the slider track.

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 slider control given its orientation.

preferred_width(max_available_width: int) int | None

Return the preferred width of the slider control given its orientation.

render_lines(width: int, height: int) list[StyleAndTextTuples]

Generate formatted text fragments to display the slider.

async repeat(mouse_event: MouseEvent, handler: Callable[..., NotImplementedOrNone], timeout: float = 0.25, **kwargs: Any) None

Repeat a mouse event after a timeout.

reset() None
property selected_handle: int

Return the currently selected slider handle.

set_index(handle: int = 0, ab: int | None = None, rel: int | None = None, fire: bool = True) NotImplementedOrNone

Set the selected index of the slider.

class euporie.core.widgets.forms.Swatch(color: str | Callable[[], str] = '#FFFFFF', width: int = 2, height: int = 1, style: str | Callable[[], str] = 'class:input, swatch', border: GridStyle =  ▁▁  🮇 │▎ 🮇─┼▎  ▔▔, show_borders: DiBool | None = None)

Bases: object

An widget which displays a given color.

property color: str

Calculate color.

property style: str

Calculate style.

class euporie.core.widgets.forms.Text(text: str = '', style: str = 'class:input', height: int = 1, min_height: int = 1, multiline: FilterOrBool = False, expand: FilterOrBool = True, width: int | None = None, completer: Completer | None = None, options: list[str] | Callable[[], list[str]] | None = None, show_borders: DiBool | None = None, on_text_changed: Callable[[Buffer], None] | None = None, validation: Callable[[str], bool] | None = None, accept_handler: BufferAcceptHandler | None = None, placeholder: str | None = None, lexer: Lexer | None = None, input_processors: Sequence[Processor] | None = None, disabled: FilterOrBool = False, password: FilterOrBool = False, wrap_lines: FilterOrBool = False, prompt: AnyFormattedText | None = None, on_focus: Callable[[], None] | None = None, complete_while_typing: FilterOrBool = True, auto_suggest: AutoSuggest | None = None)

Bases: object

A text input widget.

border_style() str

Calculate the style to apply to the widget’s border.

property text: str

Return the input’s text value.

class euporie.core.widgets.forms.ToggleButton(text: AnyFormattedText, on_click: Callable[[ToggleButton], None] | None = None, width: int | None = None, style: str | Callable[[], str] = 'class:input', border: GridStyle | None =  ▁▁  🮇 │▎ 🮇─┼▎  ▔▔ , show_borders: DiBool | None = None, selected: bool = False, disabled: FilterOrBool = False, key_bindings: KeyBindingsBase | None = None, mouse_handler: Callable[[MouseEvent], NotImplementedOrNone] | None = None, dont_extend_height: FilterOrBool = True, dont_extend_width: FilterOrBool = True, padding: DiInt | None = None)

Bases: ToggleableWidget

A toggleable button widget.

container: AnyContainer
default_mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Focus on mouse down and toggle state on mouse up.

disabled: Filter
key_bindings: KeyBindingsBase | None
on_click: Event
property selected: bool

Return the selection state of the toggle button.

toggle() None

Toggle the selected state and trigger the “clicked” callback.

class euporie.core.widgets.forms.ToggleButtons(options: list[Any], labels: Sequence[AnyFormattedText] | None = None, index: int | None = None, indices: list[int] | None = None, n_values: int | None = None, multiple: FilterOrBool = False, max_count: int | None = None, on_change: Callable[[SelectableWidget], None] | None = None, style: str | Callable[[], str] = 'class:input', border: GridStyle | None =  ▁▁  🮇 │▎ 🮇─┼▎  ▔▔ , disabled: FilterOrBool = False, vertical: FilterOrBool = False)

Bases: SelectableWidget

A widget where an option is selected using mutually exclusive toggle-buttons.

get_button_style(index: int) Callable[[], str]

Return the current button style.

hover_rel(rel: int) None

Hover an index relative to the current hovered index.

property index: int | None

Return the first selected index.

property indices: list[int]

Return a list of the selected indices.

key_bindings() KeyBindingsBase

Return key-bindings for the drop-down widget.

load_container() AnyContainer

Load the widget’s container.

property mask: list[bool]

Get mask of selected options.

mouse_handler(i: int, mouse_event: MouseEvent) NotImplementedOrNone

Handle mouse events.

select_rel(rel: int) None

Select an index relative to the current index.

property style: str

Return the widget’s style.

toggle_item(index: int) None

Toggle the selection status of the option at a given index.

update_buttons(widget: SelectableWidget | None = None) None

Set the toggle buttons’ selection state when the selected index changes.

property value: Any

Return the selected value.

property values: list[Any]

Return a list of the selected values.

class euporie.core.widgets.forms.ToggleableWidget

Bases: object

Base class for toggleable widgets.

container: AnyContainer
default_mouse_handler(mouse_event: MouseEvent) NotImplementedOrNone

Focus on mouse down and toggle state on mouse up.

disabled: Filter
key_bindings: KeyBindingsBase | None
on_click: Event
selected: bool
toggle() None

Toggle the selected state and trigger the “clicked” callback.