spinetoolbox.widgets.jupyter_console_widget
Class for a custom RichJupyterWidget that can run Tool instances.
Module Contents
Classes
Base class for all embedded console widgets that can run tool instances. |
Attributes
- 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.
- 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
- _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.
Reimplemented to add actions to console context-menus.