euporie.core.tabs.base

Contain tab base classes.

Functions

add_cmd(**kwargs)

Add a command to the centralized command system.

add_setting(name, default, help_, description)

Register a new config item.

get_app()

Get the current active (running) Application.

open_comm(comm_container, content, buffers)

Create a new object respsenting a Comm.

register_bindings(bindings)

Update the key-binding registry.

run_in_thread_with_context(func, *args[, daemon])

Run a function in an thread, but make sure it uses the same contextvars.

Classes

ABCMeta(name, bases, namespace, /, **kwargs)

Metaclass for defining Abstract Base Classes (ABCs).

FormattedTextControl([text, style, ...])

Control that displays formatted text.

HistoryAutoSuggest(history[, cache_size])

Suggest line completions from a History object.

InMemoryHistory([history_strings])

History class that keeps a list of all strings in memory.

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

Run a notebook kernel and communicates with it asynchronously.

KernelCompleter(kernel)

A prompt_toolkit completer which provides completions from a Jupyter kernel.

KernelHistory(kernel[, n])

Load the kernel's command history.

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

A Tab which connects to a kernel.

MsgCallbacks

Typed dictionary for named message callbacks.

Tab(app[, path])

Base class for interface tabs.

Window([content, width, height, z_index, ...])

Container that holds a control.

WindowAlign(value[, names, module, ...])

Alignment of the Window content.

deque

deque([iterable[, maxlen]]) --> deque object

partial

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

class euporie.core.tabs.base.KernelTab(app: BaseApp, path: Path | None = None, kernel: Kernel | None = None, comms: dict[str, Comm] | None = None, use_kernel_history: bool = False, connection_file: Path | None = None)

Bases: euporie.core.tabs.base.Tab

A Tab which connects to a kernel.

allow_stdin: bool
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.

async load_history() None

Load kernel history.

property metadata: dict[str, Any]

Return a dictionary to hold notebook / kernel metadata.

mime_types: set[str] = {}
name: str | None = None
post_init_kernel() None

Run stuff after the kernel is loaded.

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 notebook.

set_kernel_info(info: dict) None

Handle kernel info requests.

property title: str

Return the tab title.

weight: int = 0
class euporie.core.tabs.base.Tab(app: BaseApp, path: Path | None = None)

Bases: object

Base class for interface tabs.

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
file_extensions: set[str] = {}
focus() None

Focus the tab (or make it visible).

mime_types: set[str] = {}
name: str | None = None
reset() None

Reet the state of the tab.

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

Save the current notebook.

property title: str

Return the tab title.

weight: int = 0