main.py 936 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_.get("mew", level=10)
  19. # Configure how errors are processed
  20. sys_err = sys.excepthook
  21. def err_handler(typ, value, trace):
  22. QApplication.restoreOverrideCursor()
  23. logger.error("{}\n{}\n{}".format(typ.__name__, value, ''.join(traceback.format_tb(trace))))
  24. QMessageBox.critical(mainw, "Erreur: {}".format(typ.__name__), """{}""".format(value))
  25. sys_err(typ, value, trace)
  26. sys.excepthook = err_handler
  27. # Start UI
  28. app = QApplication(sys.argv)
  29. mainw = MainWindow()
  30. mainw.show()
  31. r = app.exec_()