jvconnected.ui.utils

class jvconnected.ui.utils.GenericQObject[source]

Bases: PySide2.QtCore.QObject

Utility class to remove some of the boilerplate code needed to implement QtCore.Property attributes.

The intended pattern uses the following naming convention:

class MyQtObject(GenericQObject):
    _n_fooValue = Signal()      # The 'notify' signal to emit on changes

    def __init__(self, *args):
        self._fooValue = 0      # The instance attribute containing the value

    def _get_fooValue(self):
        return self._fooValue

    def _set_fooValue(self, value):
        self._generic_setter('_fooValue', value)

    fooValue = Property(_get_fooValue, _set_fooValue, notify=_n_fooValue)
_generic_property_changed(attr: str, old_value: Any, new_value: Any)[source]

Fired by _generic_setter() on value changes (after the notify signal emission)

_generic_setter(attr: str, value: Any)[source]

To be used in the ‘getter’ method for a QtCore.Property

Parameters
  • attr (str) – The instance attribute name containing the Property value

  • value – The value passed from the original setter

jvconnected.ui.utils.connect_close_event(f: Callable)[source]

Connect the app aboutToQuit signal to the provided callback function