euporie.core.widgets.inputs

Define a cell object with input are and rich outputs, and related objects.

Functions

add_cmd(**kwargs)

Add a command to the centralized command system.

add_setting(name, default, help_, description)

Register a new config item.

get_app()

Get the current active (running) Application.

get_lexer_by_name(_alias, **options)

Return an instance of a Lexer subclass that has alias in its aliases list.

has_focus(value)

Enable when this buffer has the focus.

is_true(value)

Test whether value is True.

load_registered_bindings(*names[, config])

Assign key-bindings to commands based on a dictionary.

merge_key_bindings(bindings)

Merge multiple Keybinding objects together.

register_bindings(bindings)

Update the key-binding registry.

scrollable(window)

Return a filter which indicates if a window is scrollable.

to_filter(bool_or_filter)

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

Classes

AppendLineAutoSuggestion([style])

Append the auto suggestion to the current line of the input.

AutoSuggest()

Base class for auto suggestion implementations.

BeforeInput(text[, style])

Insert text before the input.

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.

Completer()

Base class for completer implementations.

Condition(func)

Turn any callable into a Filter.

ConditionalAutoSuggestAsync(auto_suggest, filter)

Auto suggest that can be turned on and of according to a certain condition.

ConditionalContainer(content, filter)

Wrapper around any other container that can change the visibility.

ConditionalMargin(margin, filter)

Wrapper around other Margin classes to show/hide them.

ConditionalProcessor(processor, filter)

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

D

alias of Dimension

DiagnosticProcessor(report[, style])

Highlight diagnostics.

DisplayMultipleCursors()

When we're in Vi block insert mode, display all the cursors.

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.

DynamicAutoSuggest(get_auto_suggest)

Validator class that can dynamically returns any Validator.

DynamicCompleter(get_completer)

Completer class that can dynamically returns any Completer.

DynamicLexer(get_lexer)

Lexer class that can dynamically returns any Lexer.

DynamicValidator(get_validator)

Validator class that can dynamically returns any Validator.

HighlightIncrementalSearchProcessor()

Highlight the search terms that are used for highlighting the incremental search.

HighlightMatchingBracketProcessor([chars, ...])

When the cursor is on or right after a bracket, it highlights the matching bracket.

HighlightSelectionProcessor()

Processor that highlights the selection in the document.

KernelInput(kernel_tab[, text, multiline, ...])

Kernel input text areas.

MarginContainer(margin, target)

A container which renders a stand-alone margin.

NumberedMargin([diagnostics, show_diagnostics])

Margin that displays the line numbers of a Window.

OverflowMargin()

A margin which indicates lines extending beyond the edge of the window.

PagerState(code, cursor_pos, data)

A named tuple which describes the state of a pager.

PasswordProcessor([char])

Processor that masks the input.

Processor()

Manipulate the fragments for a given line in a BufferControl.

PygmentsLexer(pygments_lexer_cls[, ...])

Lexer that calls a pygments lexer.

Report([iterable])

Class for storing a diagnostic report.

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

Scroll offsets for the Window class.

ScrollbarMargin([display_arrows, ...])

Margin displaying a scrollbar.

SearchToolbar([search_buffer, vi_mode, ...])

param vi_mode:

Display '/' and '?' instead of I-search.

ShowTrailingWhiteSpaceProcessor([char, style])

Make trailing whitespace visible.

SimpleLexer([style])

Lexer that doesn't do any tokenizing and returns the whole input as one token.

StdInput(kernel_tab)

A widget to accept kernel input.

TabsProcessor([tabstop, char1, char2, style])

Render tabs as spaces (instead of ^I) or make them visible (for instance, by replacing them with dots.)

TextArea([text, multiline, password, lexer, ...])

A simple input field.

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

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

Validator()

Abstract base class for an input validator.

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

Container that holds a control.

Exceptions

ClassNotFound

Raised if one of the lookup functions didn't find a matching class.

class euporie.core.widgets.inputs.KernelInput(kernel_tab: KernelTab, text: str = '', multiline: FilterOrBool = True, password: FilterOrBool = False, lexer: Lexer | None = None, auto_suggest: AutoSuggest | None = None, completer: Completer | None = None, complete_while_typing: FilterOrBool = True, validator: Validator | None = None, accept_handler: BufferAcceptHandler | None = None, history: History | None = None, focusable: FilterOrBool = True, focus_on_click: FilterOrBool = True, wrap_lines: FilterOrBool = False, read_only: FilterOrBool = False, width: AnyDimension = None, height: AnyDimension = None, dont_extend_height: FilterOrBool = False, dont_extend_width: FilterOrBool = False, line_numbers: bool = False, get_line_prefix: GetLinePrefixCallable | None = None, scrollbar: FilterOrBool = True, style: str = 'class:kernel-input', search_field: SearchToolbar | None = None, preview_search: FilterOrBool = False, prompt: AnyFormattedText = '', input_processors: list[Processor] | None = None, name: str = '', left_margins: Sequence[Margin] | None = None, right_margins: Sequence[Margin] | None = None, on_text_changed: Callable[[Buffer], None] | None = None, on_cursor_position_changed: Callable[[Buffer], None] | None = None, tempfile_suffix: str | Callable[[], str] = '', key_bindings: KeyBindingsBase | None = None, enable_history_search: FilterOrBool = False, autosuggest_while_typing: FilterOrBool = True, validate_while_typing: FilterOrBool = False, scroll_offsets: ScrollOffsets | None = None, formatters: list[Formatter] | None = None, language: str | Callable[[], str] | None = None, diagnostics: Report | Callable[[], Report] | None = None, inspector: Inspector | None = None, show_diagnostics: FilterOrBool = True)

Bases: TextArea

Kernel input text areas.

A customized text area for the cell input.

property accept_handler: Optional[Callable[[Buffer], bool]]

The accept handler. Called when the user accepts the input.

property current_diagnostic_message: StyleAndTextTuples

Format the currently selected diagnostic message.

property diagnostics: Report

The current diagnostics report.

property document: Document

The Buffer document (text + cursor position).

async inspect(auto: bool = False) None

Get contextual help for the current cursor position in the current cell.

property language: str

The current language of the text in the input box.

reformat() None

Reformat the cell’s input.

property text: str

The Buffer text.

class euporie.core.widgets.inputs.StdInput(kernel_tab: KernelTab)

Bases: object

A widget to accept kernel input.

accept(buffer: Buffer) bool

Send the input to the kernel and hide the input box.

get_input(prompt: str = 'Please enter a value: ', password: bool = False) None

Prompt the user for input and sends the result to the kernel.