@contextmanager
def signals_disabled(qobject):
 old_state = qobject.signalsBlocked()
 qobject.blockSignals(True)
 try:
  (yield)
 finally:
  qobject.blockSignals(old_state)

@ contextmanager def signals_disabled ( qobject ) : old_state = qobject . signalsBlocked ( ) qobject . blockSignals ( True ) try : ( yield ) finally : qobject . blockSignals ( old_state )
disables signals on an instance of qobject .