-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__main__.py
More file actions
27 lines (24 loc) · 925 Bytes
/
Copy path__main__.py
File metadata and controls
27 lines (24 loc) · 925 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
'''
Main entry point for the LCD Generator application.
'''
from essentials import *
from gui import create_gui, export_tab
import sys
import json
if __name__ == "__main__":
argv = sys.argv
if "-p" in argv or "--plot" in argv:
# CLI mode: process configs and export to SVG only
for i in range(1, len(argv)):
if argv[i] in ("-p", "--plot"): continue
if i>1: print("----------------------------------------")
try:
with open(argv[i], 'r') as f:
config = json.load(f)
except (FileNotFoundError, json.JSONDecodeError):
print(f"Error: Could not read or parse {argv[i]}")
continue
export_tab(config, CLI_mode=True)
else:
# GUI mode: launch the application including config editor
create_gui(initial_files=argv[1:])