code: def _wait_signal(signal, timeout=None):
      
      # http://jdreaver.com/posts/2014-07-03-waiting-for-signals-pyside-pyqt.html
      loop = QEventLoop()
      signal.connect(loop.quit)
  
      yield
  
      if timeout is not None:
          QTimer.singleShot(timeout, loop.quit)
      loop.exec_()
docs: Block loop until signal emitted, or timeout (ms) elapses.