-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
49 lines (34 loc) · 1.15 KB
/
Copy pathmain.py
File metadata and controls
49 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python3
"""TD Filament Studio — entry point."""
from __future__ import annotations
import sys
from app.constants import ensure_data_dir
from app.main_window import TDFilamentStudioApp
def _install_exception_logging() -> None:
from creality_nfc.app_log import log_exception
def _hook(exc_type, exc, tb) -> None:
if exc is not None:
log_exception("Unbehandelte Ausnahme", exc)
sys.__excepthook__(exc_type, exc, tb)
sys.excepthook = _hook
def main(argv: list[str] | None = None) -> int:
if argv is None:
argv = sys.argv[1:]
if "--watch-creality" in argv:
from creality_nfc.creality_watch import run_watch_loop
ensure_data_dir()
return run_watch_loop()
ensure_data_dir()
_install_exception_logging()
app = TDFilamentStudioApp()
try:
app.mainloop()
finally:
from app.shutdown import exit_process_after_frozen_app
exit_process_after_frozen_app()
return 0
if __name__ == "__main__":
_code = main()
from app.shutdown import hard_exit_frozen
hard_exit_frozen(int(_code) if _code else 0)
raise SystemExit(_code)