spyder.api.widgets.auxiliary_widgets#

Spyder API auxiliary widgets.

Classes

MainCornerWidget(parent, name)

Toolbar widget displayed in the top right hand corner of dockable plugins.

SpyderWindowWidget(widget)

An undocked window for a SpyderDockablePlugin.

class spyder.api.widgets.auxiliary_widgets.SpyderWindowWidget(widget: PluginMainWidget)[source]#

Bases: QMainWindow, SpyderMainWindowMixin

An undocked window for a SpyderDockablePlugin.

sig_closed: Signal#

Signal emitted when the close event is fired.

sig_window_state_changed(PyQt_PyObject): Signal#

Signal is emitted when this window’s state has changed.

For instance, if the window changed between maximized and minimized state.

Parameters:

window_state (WindowStates) – The new window state that was changed to.

__init__(widget: PluginMainWidget) None[source]#

Create a window for a SpyderDockablePlugin.

Parameters:

widget (PluginMainWidget) – The main widget of this window’s corresponding SpyderDockablePlugin.

Return type:

None

widget: PluginMainWidget#

The main widget of this window’s corresponding dockable plugin.

is_window_widget: bool#

Distinguish these windows from the main Spyder one.

closeEvent(event: QCloseEvent) None[source]#

Event handler for when the window is closed.

Overrides the default closeEvent method to emit a custom sig_closed signal.

changeEvent(event: QEvent) None[source]#

Event handler for when the window state is changed (e.g. minimized).

Overrides the default changeEvent method to emit a custom sig_window_state_changed signal.

class spyder.api.widgets.auxiliary_widgets.MainCornerWidget(parent: PluginMainWidget, name: str)[source]#

Bases: QToolBar

Toolbar widget displayed in the top right hand corner of dockable plugins.

It is used to display the options (hamburger) menu, progress spinner and additional toolbar items to the right of the main toolbar.

__init__(parent: PluginMainWidget, name: str) None[source]#

Create a new corner widget for a plugin’s toolbar.

Parameters:
Return type:

None

add_widget(
widget: spyder.utils.qthelpers.SpyderAction | QWidget,
before: spyder.utils.qthelpers.SpyderAction | QWidget | None = None,
) None[source]#

Add a widget to the corner toolbar.

By default, widgets are added to the left of the last toolbar item. Corner widgets provide an options menu button and a spinner so any additional widgets will be placed the left of the spinner, if visible (unless before is set).

Parameters:
  • widget (spyder.utils.qthelpers.SpyderAction | QWidget) – The action or widget to add to the toolbar.

  • before (spyder.utils.qthelpers.SpyderAction | QWidget | None, optional) – The action or widget to add widget before (to the right of). If None (the default), the widget will be added to the left of the left-most widget.

Return type:

None

Raises:

SpyderAPIError – If either widget or before lacks a name attribute; a widget with the same name as widget was already added; a widget with before.name has not been added previously; or the first widget added is not the options (hamburger) menu widget.

get_widget(widget_id: str) QWidget | None[source]#

Return a widget by its unique ID (i.e. its name attribute).

Parameters:

widget_id (str) – The name attribute of the widget to return.

Returns:

The widget object corresponding to widget_id, or None if a widget with that name does not exist.

Return type:

QWidget | None

get_action(
widget_id: str,
) spyder.utils.qthelpers.SpyderAction | None[source]#

Return an action by its unique ID (i.e. its name attribute).

Parameters:

widget_id (str) – The name attribute of the action to return.

Returns:

The action object corresponding to widget_id, or None if an action with that name does not exist.

Return type:

spyder.utils.qthelpers.SpyderAction | None