cura_app.py 942 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env python3
  2. # Copyright (c) 2015 Ultimaker B.V.
  3. # Cura is released under the terms of the AGPLv3 or higher.
  4. import sys
  5. import os
  6. def exceptHook(type, value, traceback):
  7. import cura.CrashHandler
  8. cura.CrashHandler.show(type, value, traceback)
  9. sys.excepthook = exceptHook
  10. # Workaround for a race condition on certain systems where there
  11. # is a race condition between Arcus and PyQt. Importing Arcus
  12. # first seems to prevent Sip from going into a state where it
  13. # tries to create PyQt objects on a non-main thread.
  14. import Arcus
  15. import cura.CuraApplication
  16. if sys.platform == "win32" and hasattr(sys, "frozen"):
  17. import os
  18. dirpath = os.path.expanduser("~/AppData/Local/cura/")
  19. os.makedirs(dirpath, exist_ok = True)
  20. sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w")
  21. sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w")
  22. app = cura.CuraApplication.CuraApplication.getInstance()
  23. app.run()