cura_app.py 957 B

1234567891011121314151617181920212223242526272829
  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. def exceptHook(hook_type, value, traceback):
  6. import cura.CrashHandler
  7. cura.CrashHandler.show(hook_type, value, traceback)
  8. sys.excepthook = exceptHook
  9. # Workaround for a race condition on certain systems where there
  10. # is a race condition between Arcus and PyQt. Importing Arcus
  11. # first seems to prevent Sip from going into a state where it
  12. # tries to create PyQt objects on a non-main thread.
  13. import Arcus #@UnusedImport
  14. import cura.CuraApplication
  15. if sys.platform == "win32" and hasattr(sys, "frozen"):
  16. import os
  17. dirpath = os.path.expanduser("~/AppData/Local/cura/")
  18. os.makedirs(dirpath, exist_ok = True)
  19. sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w")
  20. sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w")
  21. app = cura.CuraApplication.CuraApplication.getInstance()
  22. app.run()