def excepthook(excType, excValue, tracebackobj): ''' This exception hook will stop the app if an uncaught error occurred, regardless where in the QApplication. ''' logger.error("Uncaught exception", exc_info=(excType, excValue, tracebackobj)) dialog = util.CrashDialog((excType, excValue, tracebackobj)) answer = dialog.exec_() if (answer == QtGui.QDialog.Rejected): # Shut it down as nicely as possible. sys.excepthook = excepthook_original QtGui.QApplication.closeAllWindows() util.stopLogging() QtGui.QApplication.quit() sys.exit(1)
logger.info(">>> --------------------------- Application Launch") app = QtGui.QApplication(sys.argv) app.setWindowIcon(util.icon("window_icon.png", True)) #Set application icon to nicely stack in the system task bar import ctypes if getattr(ctypes.windll.shell32, "SetCurrentProcessExplicitAppUserModelID", None) is not None: myappid = 'com.faforever.lobby' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) if len(sys.argv) == 1: #Do the magic sys.path += ['.'] runFAF() else: #Try to interpret the argument as a replay. if sys.argv[1].lower().endswith(".fafreplay") or sys.argv[1].lower().endswith(".scfareplay"): import fa fa.exe.replay(sys.argv[1], True) #Launch as detached process #End of show app.closeAllWindows() app.quit() #End the application, perform some housekeeping logger.info("<<< --------------------------- Application Shutdown") util.stopLogging()
#init application framework logger.info(">>> --------------------------- Application Launch") app = QtGui.QApplication(sys.argv) app.setWindowIcon(util.icon("window_icon.png", True)) #Set application icon to nicely stack in the system task bar import ctypes if getattr(ctypes.windll.shell32, "SetCurrentProcessExplicitAppUserModelID", None) is not None: myappid = 'com.faforever.lobby' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) if len(sys.argv) == 1: #Do the magic sys.path += ['.'] runFAF() else: #Try to interpret the argument as a replay. if sys.argv[1].lower().endswith( ".fafreplay") or sys.argv[1].lower().endswith(".scfareplay"): import fa fa.exe.replay(sys.argv[1], True) #Launch as detached process #End of show app.closeAllWindows() app.quit() #End the application, perform some housekeeping logger.info("<<< --------------------------- Application Shutdown") util.stopLogging()