radioviz.services.signal_blocker

Signal blocking utility for Qt widgets.

This module provides a context manager to temporarily block signals for Qt widgets during programmatic updates. This prevents unwanted signal emissions that could trigger unwanted side effects during bulk operations on UI elements.

Classes

SignalBlocked(*widgets)

A context manager to block signals for one or more QObject widgets while a block of code is executed.

class radioviz.services.signal_blocker.SignalBlocked(*widgets: QObject)[source]

Bases: object

A context manager to block signals for one or more QObject widgets while a block of code is executed.

This context manager temporarily disables signal emission for the specified widgets, allowing safe programmatic updates without triggering connected slots.

Usage:

with SignalBlocked(widget1, widget2, ...):
    # Code that changes widget values programmatically
    widget1.setCurrentText('New Value')
    widget2.setValue(100)

Initializes the context manager with a list of QObject instances.

Parameters:

widgets (QObject) – Variable number of QObject instances to block signals for