OptimaLab35/main.py

47 lines
1.1 KiB
Python
Raw Normal View History

2024-12-30 20:19:49 +00:00
import sys
2024-12-17 11:25:44 +00:00
import os
2024-12-30 20:19:49 +00:00
import subprocess
from argparse import ArgumentParser
exif_file = "local_files/exif.yaml"
# Mainly from ChatGPT
def check_pyside_installed():
try:
import PySide6 # Replace with PySide2 if using that version
return True
except ImportError:
return False
def start_gui():
import gui
gui.main(exif_file)
def start_tui():
import tui
tui.main(exif_file)
def main():
parser = ArgumentParser(description="Start the Optima35 application.")
parser.add_argument("--tui", action="store_true", help="Start in terminal UI mode.")
args = parser.parse_args()
if args.tui:
print("Starting TUI...")
start_tui()
2024-12-30 20:19:49 +00:00
return
2024-12-17 11:25:44 +00:00
# Check OS and start GUI if on Windows
if os.name == "nt":
print("Detected Windows. Starting GUI...")
start_gui()
else:
# Non-Windows: Check if PySide is installed
if check_pyside_installed():
print("PySide detected. Starting GUI...")
start_gui()
else:
print("PySide is not installed. Falling back to TUI...")
start_tui()
2024-12-17 11:25:44 +00:00
if __name__ == "__main__":
main()