spinetoolbox.widgets.spine_console_widget

Class for a custom RichJupyterWidget that can run Tool instances.

authors
  1. Marin (KTH), P. Savolainen (VTT)

date

22.10.2019

Module Contents

Classes

SpineConsoleWidget

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

Attributes

traitlets_logger

asyncio_logger

spinetoolbox.widgets.spine_console_widget.traitlets_logger[source]
spinetoolbox.widgets.spine_console_widget.asyncio_logger[source]
class spinetoolbox.widgets.spine_console_widget.SpineConsoleWidget(toolbox, 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

  • name (str) – Console name, e.g. ‘Python Console’

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

name(self)[source]

Returns console name.

property owner_names(self)[source]
start_console(self, checked=False)[source]

Starts chosen Python/Julia kernel if available and not already running. Context menu start action handler.

restart_console(self, checked=False)[source]

Restarts current Python/Julia kernel. Starts a new kernel if it is not running or if chosen kernel has been changed in Settings. Context menu restart action handler.

call_start_kernel(self, k_name=None)[source]

Finds a valid kernel and calls start_kernel() with it.

start_kernel(self, k_name, k_path)[source]

Starts a kernel manager and kernel client and attaches the client to Julia or Python Console.

Parameters
  • k_name (str) – Kernel name

  • k_path (str) – Directory where the the kernel specs are located

shutdown_kernel(self)[source]

Shut down Julia/Python kernel.

dragEnterEvent(self, e)[source]

Don’t accept project item drops.

_handle_status(self, msg)[source]

Handles status message.

enterEvent(self, event)[source]

Sets busy cursor during console (re)starts.

abstract _is_complete(self, source, interactive)[source]

See base class.

_context_menu_make(self, pos)[source]

Reimplemented to add actions to console context-menus.

copy_input(self)[source]

Copies only input.

_replace_client(self)[source]
connect_to_kernel(self, kernel_name, connection_file)[source]

Connects to an existing kernel. Used when Spine Engine is managing the kernel for project execution.

Parameters
  • kernel_name (str) –

  • connection_file (str) – Path to the connection file of the kernel

interrupt(self)[source]

[TODO: Remove?] Sends interrupt signal to kernel.