mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Fix issues with crash handler and log file creation on Windows
This commit is contained in:
parent
07d35a3439
commit
ba86352642
@ -5,14 +5,13 @@ import webbrowser
|
|||||||
|
|
||||||
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QCoreApplication
|
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QCoreApplication
|
||||||
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit
|
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit
|
||||||
from UM.Application import Application
|
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
debug_mode = False
|
debug_mode = False
|
||||||
|
|
||||||
def show(exception_type, value, tb):
|
def show(exception_type, value, tb):
|
||||||
if Application.getInstance().getCommandLineOption("debug-mode", False):
|
if QCoreApplication.instance() and QCoreApplication.instance().getCommandLineOption("debug-mode", False):
|
||||||
debug_mode = True
|
debug_mode = True
|
||||||
|
|
||||||
traceback.print_exception(exception_type, value, tb)
|
traceback.print_exception(exception_type, value, tb)
|
||||||
|
@ -14,9 +14,11 @@ sys.excepthook = exceptHook
|
|||||||
import cura.CuraApplication
|
import cura.CuraApplication
|
||||||
|
|
||||||
if sys.platform == "win32" and hasattr(sys, "frozen"):
|
if sys.platform == "win32" and hasattr(sys, "frozen"):
|
||||||
import os.path
|
import os
|
||||||
sys.stdout = open(os.path.expanduser("~/AppData/Local/cura/stdout.log"), "w")
|
dirpath = os.path.expanduser("~/AppData/Local/cura/")
|
||||||
sys.stderr = open(os.path.expanduser("~/AppData/Local/cura/stderr.log"), "w")
|
os.makedirs(dirpath, exist_ok = True)
|
||||||
|
sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w")
|
||||||
|
sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w")
|
||||||
|
|
||||||
app = cura.CuraApplication.CuraApplication.getInstance()
|
app = cura.CuraApplication.CuraApplication.getInstance()
|
||||||
app.run()
|
app.run()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user