euporie.notebook.tabs.edit

Contain a tab for displaying files.

Functions

detect_lexer([text, path, language])

Detect the pygments lexer for a file.

load_registered_bindings(*names[, config])

Assign key-bindings to commands based on a dictionary.

Classes

Dimension([min, max, weight, preferred])

Specified dimension (width/height) of a user control or window.

EditorTab(app[, path, kernel, comms, ...])

Tab class for editing text files.

Kernel(kernel_tab[, threaded, allow_stdin, ...])

Run a notebook kernel and communicates with it asynchronously.

KernelInput(kernel_tab, *args[, ...])

Kernel input text areas.

KernelTab(app[, path, kernel, comms, ...])

A Tab which connects to a kernel.

MarginContainer(margin, target)

A container which renders a stand-alone margin.

MsgCallbacks

Typed dictionary for named message callbacks.

ScrollbarMargin([display_arrows, ...])

Margin displaying a scrollbar.

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

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

class euporie.notebook.tabs.edit.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.

allow_stdin: bool = True
bg_init = True
change_kernel(msg: str | None = None, startup: bool = False) None

Prompt the user to select a new kernel.

close(cb: Callable | None = None) None

Shut down kernel when tab is closed.

comm_close(content: dict, buffers: Sequence[bytes]) None

Close a notebook Comm.

comm_msg(content: dict, buffers: Sequence[bytes]) None

Respond to a Comm message from the kernel.

comm_open(content: dict, buffers: Sequence[bytes]) None

Register a new kernel Comm object in the notebook.

container: AnyContainer
default_callbacks: MsgCallbacks
file_extensions: set[str] = {}
focus() None

Focus the tab (or make it visible).

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.

interrupt_kernel() None

Interrupt the current Notebook’s kernel.

kernel: Kernel
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_language: str
property kernel_name: str

Return the 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.

property language: str

Return the name of the kernel defined in the notebook JSON.

load() None

Load the text file.

load_container() AnyContainer

Abcract method for loading the notebook’s main container.

async load_history() None

Load kernel history.

property metadata: dict[str, Any]

Return a dictionary to hold notebook / kernel metadata.

mime_types: set[str] = {'text/*'}
name: str | None = 'Text Editor'
property path_name: str

Return the path name.

property position: str

Return the position of the cursor in the document.

post_init_kernel() None

Load UI and file in background after kernel has inited.

pre_init_kernel() None

Run stuff before the kernel is loaded.

report_kernel_error(error: Exception | None) None

Report a kernel error to the user.

reset() None

Reet the state of the tab.

restart_kernel(cb: Callable | None = None) None

Restart the current Notebook’s kernel.

save(path: Path | None = None, cb: Callable | None = None) None

Save the current file.

set_kernel_info(info: dict) None

Handle kernel info requests.

property title: str

Return the tab title.

weight: int = 1