spyder.api.widgets.main_container#

Main container widget.

SpyderPluginV2 plugins must provide a CONTAINER_CLASS attribute that is a subclass of PluginMainContainer, if they provide additional widgets like status bar widgets or toolbars.

Classes

PluginMainContainer(name, plugin[, parent])

Spyder plugin main container class.

class spyder.api.widgets.main_container.PluginMainContainer(name, plugin, parent=None)[source]#

Bases: QWidget, SpyderWidgetMixin

Spyder plugin main container class.

This class handles a non-dockable widget to be able to contain, parent and store references to other widgets, like status bar widgets, toolbars, context menus, etc.

Notes

All Spyder non dockable plugins can define a plugin container that must subclass this.

CONTEXT_NAME = None#

This optional attribute defines the context name under which actions, toolbars, toolbuttons and menus should be registered on the Spyder global registry.

If actions, toolbars, toolbuttons or menus belong to the global scope of the plugin, then this attribute should have a None value.

sig_free_memory_requested#

This signal can be emitted to request the main application to garbage collect deleted objects.

sig_quit_requested#

This signal can be emitted to request the main application to quit.

sig_restart_requested#

This signal can be emitted to request the main application to restart.

sig_redirect_stdio_requested#

This signal can be emitted to request the main application to redirect standard output/error when using Open/Save/Browse dialogs within widgets.

Parameters:

enable (bool) – Enable/Disable standard input/output redirection.

sig_exception_occurred#

This signal can be emitted to report an exception handled by this widget.

Parameters:

error_data (dict) –

The dictionary containing error data. The expected keys are:

error_data = {
    "text": str,
    "is_traceback": bool,
    "repo": str,
    "title": str,
    "label": str,
    "steps": str,
}

Notes

The is_traceback key indicates if text contains plain text or a Python error traceback.

The title and repo keys indicate how the error data should customize the report dialog and Github error submission.

The label and steps keys allow customizing the content of the error dialog.

sig_unmaximize_plugin_requested#

This signal is emitted to inform the main window that it needs to unmaximize the currently maximized plugin, if any.

Parameters:

plugin_instance (spyder.api.plugins.SpyderDockablePlugin) – Unmaximize plugin only if it is not plugin_instance.

closeEvent(self, a0: QCloseEvent | None)[source]#
setup()[source]#

Create actions, widgets, add to menu and other setup requirements.

update_actions()[source]#

Update the state of exposed actions.

Exposed actions are actions created by the self.create_action method.

on_close()[source]#

Perform actions before the container is closed.

This method must only operate on local attributes.