code: def init_signal(self):
          
          signal.signal(signal.SIGINT, lambda sig, frame: self.exit(-2))
          # need a timer, so that QApplication doesn't block until a real
          # Qt event fires (can require mouse movement)
          # timer trick from http://stackoverflow.com/q/4938723/938949
          timer = QtCore.QTimer()
          # Let the interpreter run each 200 ms:
          timer.timeout.connect(lambda: None)
          timer.start(200)
          # hold onto ref, so the timer doesn't get cleaned up
          self._sigint_timer = timer
docs: allow clean shutdown on sigint