main.py 970 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. """
  2. [App documentaion here]
  3. @author:[author], [year]
  4. """
  5. import sys
  6. from PyQt5.Qt import QApplication
  7. from PyQt5.QtWidgets import QMessageBox
  8. from ui.window import MainWindow
  9. import updater
  10. try:
  11. # Necessary to ensure that stacktraces are printed when using PyQt5
  12. # Tough, could make pythonw.exe crash
  13. import ipdb # @UnusedImport
  14. except:
  15. pass
  16. with open("VERSION") as f:
  17. __VERSION__ = f.read()
  18. updater.autoupdate()
  19. # Configure how errors are processed
  20. sys_err = sys.excepthook
  21. def gestionnaire_erreurs(typ, value, traceback):
  22. QApplication.restoreOverrideCursor()
  23. sys_err(typ, value, traceback)
  24. QMessageBox.critical(mainw, "Erreur: {}".format(typ.__name__), """{}""".format(value))
  25. with open("err.log", "w+") as f:
  26. f.write("{}: {}".format(typ.__name__, value))
  27. mainw.cancel()
  28. sys.excepthook = gestionnaire_erreurs
  29. # Start UI
  30. app = QApplication(sys.argv)
  31. mainw = MainWindow()
  32. mainw.show()
  33. r = app.exec_()