bec_widgets.utils.busy_loader#

Classes#

BusyLoaderOverlay

A semi-transparent scrim with centered text and an animated spinner.

_OverlayEventFilter

Keeps the overlay sized and stacked over its target widget.

Functions#

install_busy_loader(→ BusyLoaderOverlay)

Attach a BusyLoaderOverlay to target and keep it sized and stacked.

Module Contents#

class BusyLoaderOverlay(parent: qtpy.QtWidgets.QWidget, opacity: float = 0.35, **kwargs)#

Bases: qtpy.QtWidgets.QWidget

A semi-transparent scrim with centered text and an animated spinner. Call show()/hide() directly, or use via install_busy_loader(…).

Parameters:
  • parent (QWidget) – The parent widget to overlay.

  • text (str) – Initial text to display.

  • opacity (float) – Overlay opacity (0..1).

Returns:

The overlay instance.

Return type:

BusyLoaderOverlay

_update_palette()#

Update colors from the current application theme.

cleanup()#

Cleanup resources used by the overlay.

foreground_color() qtpy.QtGui.QColor#

The overlay foreground color (text, spinner).

hideEvent(e)#
resizeEvent(e)#
scrim_color() qtpy.QtGui.QColor#

The overlay scrim color.

set_filter(filt: _OverlayEventFilter)#

Set an event filter to keep the overlay sized and stacked over its target.

Parameters:

filt (QObject) – The event filter instance.

set_opacity(opacity: float)#

Set the overlay opacity. Only values between 0.0 and 1.0 are accepted. If a value outside this range is provided, it will be clamped.

Parameters:

opacity (float) – The opacity value between 0.0 (fully transparent) and 1.0 (fully opaque).

set_widget(widget: qtpy.QtWidgets.QWidget)#

Set a custom widget as an overlay for the busy overlay.

Parameters:

widget (QWidget) – The custom widget to display.

showEvent(e)#
foreground_color_changed#
scrim_color_changed#
class _OverlayEventFilter(target: qtpy.QtWidgets.QWidget, overlay: qtpy.QtWidgets.QWidget)#

Bases: qtpy.QtCore.QObject

Keeps the overlay sized and stacked over its target widget.

eventFilter(obj, event)#
install_busy_loader(target: qtpy.QtWidgets.QWidget, start_loading: bool = False, opacity: float = 0.35) BusyLoaderOverlay#

Attach a BusyLoaderOverlay to target and keep it sized and stacked.

Parameters:
  • target (QWidget) – The widget to overlay.

  • start_loading (bool) – If True, show the overlay immediately.

  • opacity (float) – Overlay opacity (0..1).

Returns:

The overlay instance.

Return type:

BusyLoaderOverlay