main.py 966 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. """
  2. [App documentation here]
  3. @author:[author], [year]
  4. """
  5. import logging
  6. import sys
  7. import traceback
  8. from PyQt5.Qt import QApplication
  9. from PyQt5.QtWidgets import QMessageBox
  10. from core import logging_
  11. from ui.window import MainWindow
  12. try:
  13. # Necessary to ensure that stacktraces are printed when using PyQt5
  14. # Tough, could make pythonw.exe crash
  15. import ipdb # @UnusedImport
  16. except:
  17. pass
  18. logger = logging.getLogger("hello")
  19. logging_.start("hello", level=10)
  20. # Configure how errors are processed
  21. sys_err = sys.excepthook
  22. def err_handler(typ, value, trace):
  23. QApplication.restoreOverrideCursor()
  24. logger.error("{}\n{}\n{}".format(typ.__name__, value, ''.join(traceback.format_tb(trace))))
  25. QMessageBox.critical(mainw, "Erreur: {}".format(typ.__name__), """{}""".format(value))
  26. sys_err(typ, value, trace)
  27. sys.excepthook = err_handler
  28. # Start UI
  29. app = QApplication(sys.argv)
  30. mainw = MainWindow()
  31. mainw.show()
  32. r = app.exec_()