spyder.api.widgets.auxiliary_widgets#
Spyder API auxiliary widgets.
Classes
|
Toolbar widget displayed in the top right hand corner of dockable plugins. |
|
An undocked window for a |
- class spyder.api.widgets.auxiliary_widgets.SpyderWindowWidget(widget: PluginMainWidget)[source]#
Bases:
QMainWindow,SpyderMainWindowMixinAn undocked window for a
SpyderDockablePlugin.- 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.
- closeEvent(event: QCloseEvent) None[source]#
Event handler for when the window is closed.
Overrides the default
closeEventmethod to emit a customsig_closedsignal.
- changeEvent(event: QEvent) None[source]#
Event handler for when the window state is changed (e.g. minimized).
Overrides the default
changeEventmethod to emit a customsig_window_state_changedsignal.
- class spyder.api.widgets.auxiliary_widgets.MainCornerWidget(parent: PluginMainWidget, name: str)[source]#
Bases:
QToolBarToolbar 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:
widget (PluginMainWidget) – The main widget of this window’s corresponding
SpyderDockablePlugin.name (str) – Name of this corner widget, nominally
spyder.api.widgets.PluginMainWidgetWidgets.CornerWidget.
- Return type:
None
- add_widget(
- widget: spyder.utils.qthelpers.SpyderAction | QWidget,
- before: spyder.utils.qthelpers.SpyderAction | QWidget | None = None,
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
beforeis 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
widgetbefore (to the right of). IfNone(the default), the widget will be added to the left of the left-most widget.
- Return type:
None
- Raises:
SpyderAPIError – If either
widgetorbeforelacks anameattribute; a widget with the samenameaswidgetwas already added; a widget withbefore.namehas 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
nameattribute).
- get_action(
- widget_id: str,
Return an action by its unique ID (i.e. its
nameattribute).- Parameters:
widget_id (str) – The
nameattribute of the action to return.- Returns:
The action object corresponding to
widget_id, orNoneif an action with thatnamedoes not exist.- Return type:
spyder.utils.qthelpers.SpyderAction | None