main.py 942 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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_, db
  11. from core.logging_ import Logger
  12. from ui.window import MainWindow
  13. try:
  14. # Necessary to ensure that stacktraces are printed when using PyQt5
  15. # Tough, could make pythonw.exe crash
  16. import ipdb # @UnusedImport
  17. except:
  18. pass
  19. logger = Logger.get()
  20. # Configure how errors are processed
  21. sys_err = sys.excepthook
  22. def err_handler(typ, value, trace):
  23. QApplication.restoreOverrideCursor()
  24. QMessageBox.critical(mainw, "Erreur: {}".format(typ.__name__), """{}""".format(value))
  25. sys_err(typ, value, trace)
  26. sys.excepthook = err_handler
  27. # Create db if not existing
  28. try:
  29. db.create()
  30. except FileExistsError:
  31. pass
  32. # Start UI
  33. app = QApplication(sys.argv)
  34. mainw = MainWindow()
  35. mainw.show()
  36. r = app.exec_()