iblrig.gui.tools.StatefulButton

Inheritance diagram of StatefulButton

class iblrig.gui.tools.StatefulButton[source]

A QPushButton that maintains an active/inactive state and emits different signals based on its state when clicked.

Parameters:

active (bool, optional) – Initial state of the button (default is False).

clickedWhileActive

Emitted when the button is clicked while it is in the active state.

Type:

pyqtSignal

clickedWhileInactive

Emitted when the button is clicked while it is in the inactive state.

Type:

pyqtSignal

stateChanged

Emitted when the button’s state has changed. The signal carries the new state.

Type:

pyqtSignal

__init__(*args, active=False, **kwargs)[source]

Initialize the StateButton with the specified active state.

Parameters:
  • *args (tuple) – Positional arguments to be passed to the QPushButton constructor.

  • active (bool, optional) – Initial state of the button (default is False).

  • **kwargs (dict) – Keyword arguments to be passed to the QPushButton constructor.

Parameters:

active (bool)

setActive(active)[source]

Set the active state of the button.

Emits stateChanged if the state has changed.

Parameters:

active (bool) – The new active state of the button.

Parameters:

active (bool)

clickedWhileActive

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

clickedWhileInactive

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

isActive
pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

stateChanged

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name