-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclickflow.py
More file actions
39 lines (26 loc) · 958 Bytes
/
Copy pathclickflow.py
File metadata and controls
39 lines (26 loc) · 958 Bytes
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
"""Executable launcher for ClickFlow.
This file is intentionally small: PyInstaller uses it as the entry point, and
normal source runs can also call it with `python clickflow.py`.
"""
from __future__ import annotations
import os
import sys
from pathlib import Path
def _app_root() -> Path:
"""Return the folder that should contain workflows, images, and queues."""
if getattr(sys, "frozen", False):
return Path(sys.executable).resolve().parent
return Path(__file__).resolve().parent
def _prepare_runtime_folders(root: Path) -> None:
for name in ("workflows", "images", "queues", "debug_screenshots"):
(root / name).mkdir(parents=True, exist_ok=True)
def main() -> None:
root = _app_root()
os.chdir(root)
if str(root) not in sys.path:
sys.path.insert(0, str(root))
_prepare_runtime_folders(root)
from gui.app import main as gui_main
gui_main()
if __name__ == "__main__":
main()