main.main

Main entry point for the GliAAns-UI application.

This module initializes the PyQt6 application, sets up logging, and launches the main Controller, which manages the GUI workflow.

It ensures that the environment and resources are correctly configured before starting the event loop.

 1"""
 2Main entry point for the GliAAns-UI application.
 3
 4This module initializes the PyQt6 application, sets up logging, and launches
 5the main `Controller`, which manages the GUI workflow.
 6
 7It ensures that the environment and resources are correctly configured
 8before starting the event loop.
 9"""
10
11import os
12import sys
13
14from PyQt6.QtCore import Qt
15from PyQt6.QtGui import QIcon, QGuiApplication
16from PyQt6.QtWidgets import QApplication, QStyleFactory
17
18from controller import Controller
19from logger import setup_logger
20from utils import resource_path, get_shell_path
21
22
23if __name__ == "__main__":
24    # Create the main Qt application instance
25    app = QApplication(sys.argv)
26
27    try:
28        QGuiApplication.styleHints().setColorScheme(Qt.ColorScheme.Light)
29    except AttributeError:
30        # Fallback to a cross-platform style
31        app.setStyle('Fusion')
32
33    # Set the main window/application icon
34    app.setWindowIcon(QIcon(resource_path(os.path.join("resources", "GliAAns-logo.ico"))))
35
36    # Initialize and configure the logger
37    # Logs to both console and compressed rotating file by default
38    log = setup_logger(console=True)
39    log.info("Program started")
40
41    # Extend PATH environment variable to include shell utilities
42    os.environ["PATH"] = get_shell_path()
43
44    # Create and start the main application controller
45    controller = Controller()
46    controller.start()
47
48    # Begin Qt event loop (blocking call)
49    sys.exit(app.exec())