euporie.core.widgets.cell
Define a cell object with input are and rich outputs, and related objects.
Functions
|
Register a new config item. |
|
Cast a value to a type. |
|
Format a code string using :py:mod:``. |
|
Get the current active (running) Application. |
|
Return the cell ID field defined in a cell JSON object. |
|
Return an instance of a Lexer subclass that has alias in its aliases list. |
|
Get a pygments lexer class by name, ignoring errors. |
|
Return a mouse handler which call a given function on click. |
Classes
|
A kernel_tab cell element. |
|
An area below a cell where one or more cell outputs can be shown. |
|
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. |
|
This is a immutable class around the text and cursor position, and contains methods for querying this data, e.g. |
|
Lexer class that can dynamically returns any Lexer. |
|
Control that displays formatted text. |
|
Several layouts, one stacked above/under the other. ::. |
|
Kernel input text areas. |
|
Lexer that calls a pygments lexer. |
|
Lexer that doesn't do any tokenizing and returns the whole input as one token. |
|
A widget to accept kernel input. |
|
Several layouts, one stacked left/right of the other. ::. |
|
Container that holds a control. |
partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords. |
Exceptions
Raised if one of the lookup functions didn't find a matching class. |
- class euporie.core.widgets.cell.Cell(index: int, json: dict, kernel_tab: BaseNotebook)
Bases:
object
A kernel_tab cell element.
Contains a transparent clickable overlay, which is not displayed when the cell is focused.
- clear_output(wait: bool = False) None
Remove the cells output, optionally when new output is generated.
- focus(position: int | None = None, scroll: bool = False) None
Focus the relevant control in this cell.
- Parameters
position – An optional cursor position index to apply to the input box
scroll – Whether to scroll the page to make the selection visible
- get_input(prompt: str = 'Please enter a value:', password: bool = False) None
Scroll the cell requesting input into view and render it before asking for input.
- input_box: KernelInput
- ran(content: dict | None = None) None
Update the cell status and update display when the cell has finished.
- run_or_render(buffer: Buffer | None = None, wait: bool = False, callback: Callable[..., None] | None = None) bool
Send the cell’s source code the the kernel to run.
- Parameters
buffer – Unused parameter, required when accepting the contents of a cell’s input buffer
wait – Has no effect
callback – Callable to run when the kernel has finished running the cell
- Returns
Always returns True
- set_cell_type(cell_type: Literal['markdown', 'code', 'raw'], clear: bool = False) None
Convert the cell to a different cell type.
- Parameters
cell_type – The desired cell type.
clear – If True, cell outputs will be cleared
- euporie.core.widgets.cell.get_cell_id(cell_json: dict) str
Return the cell ID field defined in a cell JSON object.
If no cell ID is defined (as per
`:mod:`nbformat`<4.5
), then one is generated and added to the cell.- Parameters
cell_json – The cell’s JSON object as a python dictionary
- Returns
The ID string