"""Application entry point for the PyQt GUI."""

from __future__ import annotations

from pathlib import Path
import sys

import pyqtgraph as pg
from PyQt6.QtWidgets import QApplication

# Ensure imports are resolved when started as a script.
PROJECT_ROOT = Path(__file__).resolve().parents[2]
if str(PROJECT_ROOT) not in sys.path:
    sys.path.insert(0, str(PROJECT_ROOT))

from python_app.gui.app_window import AppWindow
from python_app.gui.theme import apply_light_theme


def main() -> int:
    """Run Qt event loop and show main radar control window."""
    app = QApplication(sys.argv)
    apply_light_theme(app)
    # PyQtGraph foreground controls axis lines, tick text, labels, and titles.
    pg.setConfigOptions(antialias=True, background="#ffffff", foreground="#ffffff")
    window = AppWindow(PROJECT_ROOT)
    window.showMaximized()
    return app.exec()


if __name__ == "__main__":
    raise SystemExit(main())
