spyder.api.widgets.status#
Status bar widgets API.
Classes
|
Base class for status bar widgets that update based on timers. |
|
Base class for status bar widgets. |
- class spyder.api.widgets.status.StatusBarWidget(
- parent: QWidget | None = None,
- show_icon: bool = True,
- show_label: bool = True,
- show_spinner: bool = False,
Bases:
QWidget,SpyderWidgetMixinBase class for status bar widgets.
These widgets consist by default of an icon, a label and a spinner, which are organized from left to right in that order.
You can also add any other
QWidgetto this layout by setting theCUSTOM_WIDGET_CLASSclass attribute. It’ll be put between the label and the spinner.- CUSTOM_WIDGET_CLASS: type[QWidget] | None = None#
A custom widget class object to add to the default layout, or
Noneto not add one.
- INTERACT_ON_CLICK: bool = False#
If
True, the user can interact with widget when clicking it (for example, to show a menu). IfFalse, the default, the widget is not interactive.
- __init__(
- parent: QWidget | None = None,
- show_icon: bool = True,
- show_label: bool = True,
- show_spinner: bool = False,
Base class for status bar widgets.
These are composed of the following widgets, which are arranged in a
QHBoxLayoutfrom left to right:Icon
Label
Custom
QWidgetSpinner
- Parameters:
parent (QWidget | None, optional) – The parent widget of this one, or
None(default).show_icon (bool, optional) – If
True(default), show an icon in the widget. IfFalse, don’t show an icon.show_label (bool, optional) – If
True(default), show a label in the widget. IfFalse, don’t show a label.show_spinner (bool, optional) – If
True, show a progress spinner in the widget. IfFalse(default), don’t show a spinner.
Notes
To use an icon, you need to redefine the
get_icon()method.To use a label, you need to call
set_value().
- get_icon() QIcon | None[source]#
Get the widget’s icon.
- Returns:
The widget’s icon object, or
Noneif it doesn’t have one.- Return type:
QIcon | None
- set_value(value: str) None[source]#
Set formatted text value for the widget.
- Parameters:
value (str) – The formatted text value to set.
- Return type:
None
- get_tooltip() str[source]#
Get the widget’s tooltip text.
- Returns:
The widget’s tooltip text.
- Return type:
- update_tooltip() str[source]#
Update the tooltip for the widget.
- Returns:
The updated tooltip text.
- Return type:
- mousePressEvent(event: QMouseEvent) None[source]#
Change the widget’s background color when it’s clicked.
- Parameters:
event (QMouseEvent) – The mouse event that was triggered.
- Return type:
None
- mouseReleaseEvent(event: QMouseEvent) None[source]#
Change the widget’s background color & emit a signal when it’s clicked.
- Parameters:
event (QMouseEvent) – The mouse release event.
- Return type:
None
- enterEvent(event: QEnterEvent) None[source]#
Change the widget’s background color and cursor shape on hover.
- Parameters:
event (QEnterEvent) – The mouse hover event.
- Return type:
None
- class spyder.api.widgets.status.BaseTimerStatus(parent: QWidget | None = None)[source]#
Bases:
StatusBarWidgetBase class for status bar widgets that update based on timers.
- __init__(parent: QWidget | None = None) None[source]#
Base class for status bar widgets that update based on timers.
- Parameters:
parent (QWidget | None, optional) – The parent widget of this one, or
None(default).- Return type:
None
- closeEvent(event: QCloseEvent) None[source]#
Handle the widget close event by stopping the timer.
- Parameters:
event (QCloseEvent) – The widget close event.
- Return type:
None
- setVisible(value: bool) None[source]#
Stop the timer if the widget is not visible.
- Parameters:
value (bool) –
Trueif the timer should be started,Falseto stop it.- Return type:
None
- update_status() None[source]#
Update the status label widget, if the widget is visible.
- Return type:
None
- set_interval(interval: int) None[source]#
Set the timer interval.
- Parameters:
interval (int) – The timer interval, in integer milliseconds.
- Return type:
None
- get_value() str[source]#
Return the formatted text value shown in the widget.
- Returns:
The formatted text value.
- Return type:
- Raises:
NotImplementedError – Must be implemented by subclasses to work.