euporie.core.io
Define custom inputs and outputs, and related methods.
Functions
|
Encode the bytes-like object s using Base64 and return a bytes object. |
Classes
Input for use in a DummyApplication |
|
An input which ignores input but does not immediately close the app. |
|
|
A Vt100Parser which checks input against additional key patterns. |
|
A Vt100 output which enables SGR pixel mouse positioning. |
- class euporie.core.io.IgnoredInput
Bases:
prompt_toolkit.input.base.DummyInput
An input which ignores input but does not immediately close the app.
- attach(input_ready_callback: Callable[[], None]) ContextManager[None]
Do not call the callback, so the input is never closed.
- cooked_mode() ContextManager[None]
Context manager that turns the input into cooked mode.
- detach() ContextManager[None]
Return a context manager that makes sure that this input is not active in the current event loop.
- flush_keys() list[prompt_toolkit.key_binding.key_processor.KeyPress]
Flush the underlying parser. and return the pending keys. (Used for vt100 input.)
- raw_mode() ContextManager[None]
Context manager that turns the input into raw mode.
- read_keys() list[prompt_toolkit.key_binding.key_processor.KeyPress]
Return a list of Key objects which are read/parsed from the input.
- class euporie.core.io.Vt100Parser(*args: Any, **kwargs: Any)
Bases:
prompt_toolkit.input.vt100_parser.Vt100Parser
A Vt100Parser which checks input against additional key patterns.
- flush() None
Flush the buffer of the input stream.
This will allow us to handle the escape key (or maybe meta) sooner. The input received by the escape key is actually the same as the first characters of e.g. Arrow-Up, so without knowing what follows the escape sequence, we don’t know whether escape has been pressed, or whether it’s something else. This flush function should be called after a timeout, and processes everything that’s still in the buffer as-is, so without assuming any characters will follow.
- class euporie.core.io.Vt100_Output(stdout: TextIO, get_size: Callable[[], prompt_toolkit.data_structures.Size], term: str | None = None, default_color_depth: prompt_toolkit.output.color_depth.ColorDepth | None = None, enable_bell: bool = True, enable_cpr: bool = True)
Bases:
prompt_toolkit.output.vt100.Vt100_Output
A Vt100 output which enables SGR pixel mouse positioning.
- classmethod from_pty(stdout: TextIO, term: str | None = None, default_color_depth: prompt_toolkit.output.color_depth.ColorDepth | None = None, enable_bell: bool = True) prompt_toolkit.output.vt100.Vt100_Output
Create an Output class from a pseudo terminal. (This will take the dimensions by reading the pseudo terminal attributes.)
- get_default_color_depth() prompt_toolkit.output.color_depth.ColorDepth
Return the default color depth for a vt100 terminal, according to the our term value.
We prefer 256 colors almost always, because this is what most terminals support these days, and is a good default.
- get_size() prompt_toolkit.data_structures.Size
Return the size of the output window.
- reset_cursor_key_mode() None
For vt100 only. Put the terminal in cursor mode (instead of application mode).
- property responds_to_cpr: bool
True if the Application can expect to receive a CPR response after calling ask_for_cpr (this will come back through the corresponding Input).
This is used to determine the amount of available rows we have below the cursor position. In the first place, we have this so that the drop down autocompletion menus are sized according to the available space.
On Windows, we don’t need this, there we have get_rows_below_cursor_position.
- set_attributes(attrs: prompt_toolkit.styles.base.Attrs, color_depth: prompt_toolkit.output.color_depth.ColorDepth) None
Create new style and output.
- Parameters
attrs – Attrs instance.
- set_cursor_shape(cursor_shape: prompt_toolkit.cursor_shapes.CursorShape) None
Set cursor shape to block, beam or underline.