euporie.notebook.tabs
Tab for use in euporie notebook editor.
Modules
Contain a tab for displaying files. |
|
Contain a tab for displaying files. |
|
Contain a tab for displaying JSON data. |
|
Initiate logging for euporie.core. |
|
Contain the main class for a notebook file. |
Classes
|
Tab class for displaying files. |
|
Tab class for editing text files. |
|
Tab class for JSON data. |
|
A tab which allows you to view log entries. |
|
Interactive notebooks. |
|
Tab class for displaying files. |
- class euporie.notebook.tabs.DisplayTab(app: BaseApp, path: Path | None = None)
Bases:
euporie.core.tabs.base.Tab
Tab class for displaying files.
- close(cb: Callable | None = None) None
Close a tab with a callback.
- Parameters
cb – A function to call after the tab is closed.
- container: AnyContainer
- load_container() AnyContainer
Abcract method for loading the notebook’s main container.
- class euporie.notebook.tabs.EditorTab(app: BaseApp, path: Path | None = None, kernel: Kernel | None = None, comms: dict[str, Comm] | None = None, use_kernel_history: bool = False)
Bases:
euporie.core.tabs.base.KernelTab
Tab class for editing text files.
- bg_init = True
- change_kernel(msg: str | None = None, startup: bool = False) None
Prompt the user to select a new kernel.
- comm_open(content: dict, buffers: Sequence[bytes]) None
Register a new kernel Comm object in the notebook.
- container: AnyContainer
- default_callbacks: MsgCallbacks
- init_kernel(kernel: Kernel | None = None, comms: dict[str, Comm] | None = None, use_kernel_history: bool = False, connection_file: Path | None = None) None
Set up the tab’s kernel and related components.
- property kernel_display_name: str
Return the display name of the kernel defined in the notebook JSON.
- property kernel_lang_file_ext: str
Return the display name of the kernel defined in the notebook JSON.
- kernel_started(result: dict[str, Any] | None = None) None
Task to run when the kernel has started.
- load_container() AnyContainer
Abcract method for loading the notebook’s main container.
- class euporie.notebook.tabs.JsonTab(app: BaseApp, path: Path | None = None)
Bases:
euporie.core.tabs.base.Tab
Tab class for JSON data.
- close(cb: Callable | None = None) None
Close a tab with a callback.
- Parameters
cb – A function to call after the tab is closed.
- container: AnyContainer
- filte_types = {'.json'}
- load_container() AnyContainer
Abcract method for loading the notebook’s main container.
- class euporie.notebook.tabs.LogView(app: BaseApp, path: Path | None = None)
Bases:
euporie.core.tabs.base.Tab
A tab which allows you to view log entries.
- add_record(message: prompt_toolkit.formatted_text.base.FormattedText) None
Add a single new record to the textarea.
- Parameters
message – The formatted log record to add
- container: AnyContainer
- class euporie.notebook.tabs.Notebook(app: BaseApp, path: Path | None = None, kernel: Kernel | None = None, comms: dict[str, Comm] | None = None, use_kernel_history: bool = True, json: dict[str, Any] | None = None)
Bases:
euporie.core.tabs.notebook.BaseNotebook
Interactive notebooks.
A tab which allows running and editing a notebook.
- add(index: int, source: str = '', **kwargs: Any) None
Create a new cell at a given index.
- Parameters
index – The position at which to insert a new cell
source – The contents of the new cell
kwargs – Additional parameters for the cell
- bg_init = True
- property cell: euporie.core.widgets.cell.Cell
Return the currently selected Cell in this Notebook.
- change_kernel(msg: str | None = None, startup: bool = False) None
Prompt the user to select a new kernel.
- close(cb: Callable | None = None) None
Check if the user want to save an unsaved notebook, then close the file.
- Parameters
cb – A callback to run if after closing the notebook.
- comm_open(content: dict, buffers: Sequence[bytes]) None
Register a new kernel Comm object in the notebook.
- container: AnyContainer
- copy(slice_: slice | None = None) None
Add a copy of the selected cells to the Notebook’s clipboard.
- cut(slice_: slice | None = None) None
Remove cells from the notebook and them to the Notebook’s clipboard.
- default_callbacks: MsgCallbacks
- edit_mode = False
- get_cell_by_id(cell_id: str) euporie.core.widgets.cell.Cell | None
Return a reference to the Cell container with a given cell id.
- init_kernel(kernel: Kernel | None = None, comms: dict[str, Comm] | None = None, use_kernel_history: bool = False, connection_file: Path | None = None) None
Set up the tab’s kernel and related components.
- property kernel_display_name: str
Return the display name of the kernel defined in the notebook JSON.
- property kernel_lang_file_ext: str
Return the display name of the kernel defined in the notebook JSON.
- load_container() AnyContainer
Load the main notebook container.
- mode() str
Return a symbol representing the current mode.
^
: Notebook mode>
: Navigation modeI
: Insert modev
: Visual mode
- Returns
A character representing the current mode
- move(n: int, slice_: slice | None = None) None
Move a slice of cells up or down.
- Parameters
slice – A slice describing the cell indices to move
n – The amount to move them by
- paste(index: int | None = None) None
Append the contents of the Notebook’s clipboard below the current cell.
- refresh(slice_: slice | None = None, scroll: bool = True) None
Refresh the rendered contents of this notebook.
- refresh_cell(cell: euporie.core.widgets.cell.Cell) None
Trigger the refresh of a notebook cell.
- rendered_cells() list[euporie.core.widgets.cell.Cell]
Return a list of rendered notebooks’ cells.
- run_cell(cell: Cell, wait: bool = False, callback: Callable[..., None] | None = None) None
Run a cell.
- Parameters
cell – The rendered cell to run. If
None
, runs the currently selected cell.wait – If
True
, blocks until cell execution is finishedcallback – Function to run after completion
- run_selected_cells(advance: bool = False, insert: bool = False) None
Run the currently selected cells.
- Parameters
advance – If True, move to next cell. If True and at the last cell, create a new cell at the end of the notebook.
insert – If True, add a new empty cell below the current cell and select it.
- save(path: Path | None = None, cb: Callable | None = None) None
Write the notebook’s JSON to the current notebook’s file.
Additionally save the widget state to the notebook metadata.
- Parameters
path – An optional new path at which to save the tab
cb – A callback to run if after saving the notebook.
- select(index: int, extend: bool = False, position: int | None = None, scroll: bool = True) None
Select a cell or adds it to the selection.
- Parameters
index – The index of the cell to select
extend – If true, the selection will be extended to include the cell
position – An optional cursor position index to apply to the cell input
scroll – Whether to scroll the page
- class euporie.notebook.tabs.WebTab(app: BaseApp, path: Path | None)
Bases:
euporie.core.tabs.base.Tab
Tab class for displaying files.
- close(cb: Callable | None = None) None
Close a tab with a callback.
- Parameters
cb – A function to call after the tab is closed.
- container: AnyContainer
- load_container() AnyContainer
Abcract method for loading the notebook’s main container.