def signalHandler(sig, frame): if sig in (SIGINT, SIGTERM): # print("frontend got signal") # global EXIT_PROCESS EXIT_PROCESS[0] = True # ingen_wrapper._FINISH = True signal(SIGINT, signalHandler) signal(SIGTERM, signalHandler) # initial_preset = False print("starting UI") while not EXIT_PROCESS[0]: # debug_print("processing events") try: app.processEvents() # debug_print("processing ui messages") except Exception as e: qCritical("########## e is:" + str(e)) ex_type, ex_value, tb = sys.exc_info() error = ex_type, ex_value, ''.join(traceback.format_tb(tb)) # debug_print("EXception is:", error) sys.exit() sleep(0.01) qWarning("mainloop exited") app.exit() sys.exit() qWarning("sys exit called")