spinetoolbox.widgets.jupyter_console_widget

Class for a custom RichJupyterWidget that can run Tool instances.

Module Contents

Classes

JupyterConsoleWidget

Base class for all embedded console widgets that can run tool instances.

Attributes

traitlets_logger

asyncio_logger

spinetoolbox.widgets.jupyter_console_widget.traitlets_logger[source]
spinetoolbox.widgets.jupyter_console_widget.asyncio_logger[source]
class spinetoolbox.widgets.jupyter_console_widget.JupyterConsoleWidget(toolbox, kernel_name, owner=None)[source]

Bases: qtconsole.rich_jupyter_widget.RichJupyterWidget

Base class for all embedded console widgets that can run tool instances.

Parameters
  • toolbox (ToolboxUI) – QMainWindow instance

  • kernel_name (str) – Kernel name to start

  • owner (ProjectItem, NoneType) – Item that owns the console.

property owner_names[source]
console_closed[source]
request_start_kernel(conda=False)[source]

Requests Spine Engine to launch a kernel manager for the given kernel_name.

Parameters

conda (bool) – Conda kernel or not

Returns

Path to connection file if kernel manager was launched successfully, None otherwise

Return type

str or None

release_exec_mngr_resources()[source]

Closes _io.TextIOWrapper files.

_handle_kernel_started_msg(msg)[source]

Handles the response message from KernelExecutionManager.

Parameters

msg (dict) – Message with item_name, type, etc. keys

Returns

Path to a connection file if engine started the requested kernel manager successfully, None otherwise.

Return type

str or None

_execute(source, hidden)[source]

Catches exit or similar commands and closes the console immediately if user so chooses.

insert_text_to_console(msg)[source]

Inserts given message to console.

Parameters

msg (str) – Text to insert

set_connection_file(connection_file)[source]

Sets connection file obtained from engine to this console.

Parameters

connection_file (str) – Path to a connection file obtained from a running kernel manager.

connect_to_kernel()[source]

Connects a local kernel client to a kernel manager running on Spine Engine.

request_restart_kernel_manager()[source]

Restarts kernel manager on engine and connects a new kernel client to it.

request_shutdown_kernel_manager()[source]

Sends a shutdown kernel manager request to engine.

name()[source]

Returns console name for display purposes.

shutdown_kernel_client()[source]

Shuts down local kernel client.

dragEnterEvent(e)[source]

Rejects dropped project items.

_context_menu_make(pos)[source]

Reimplemented to add actions to console context-menus.

copy_input()[source]

Copies only input.

_show_interpreter_prompt(number=None)[source]

Reimplemented for IPython-style prompts.

closeEvent(e)[source]

Catches close event to shut down the kernel client and sends a signal to Toolbox to request Spine Engine to shut down the kernel manager.