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. |
|
Get the current active (running) Application. |
|
Return the cell ID field defined in a cell JSON object. |
|
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. |
|
|
Asynchronous wrapper around a completer that removes duplicates. |
|
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. |
|
Completer class that can dynamically returns any Completer. |
|
Simple event to which event handlers can be attached. For instance::. |
|
Return results of the first inspector to response. |
|
Control that displays formatted text. |
|
Several layouts, one stacked above/under the other. |
|
Kernel input text areas. |
|
An LSP client's representation of a cell. |
|
A completer for documents using an LSP. |
|
Format a document using a LSP server. |
|
Inspector which retrieves contextual help from a Language Server. |
|
PurePath subclass that can make system calls. |
|
Class for storing a diagnostic report. |
|
A widget to accept kernel input. |
|
Several layouts, one stacked left/right of the other. |
|
Mapping class that references keys weakly. |
|
Container that holds a control. |
partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords. |
- class euporie.core.widgets.cell.Cell(index: int, json: dict, kernel_tab: BaseNotebook, is_new: bool = False)
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
- lsp_open_handler(lsp: LspClient) None
If the LSP does not support notebooks, open this cell as a text document.
- property path: Path
Return a virtual path for this cell (used by LSP clients).
Pylance appears to use URIs like:
../folder.notebook.ipynb:pylance-notebook-cell:W0sZmlsZQ==.py
, which I’ve emulated here.
- 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