""" AR-ShipDesign — Punto de entrada principal. Uso: python main.py """ import sys import os from pathlib import Path def main() -> int: # Asegurar que el directorio raíz del proyecto está en el path project_root = Path(__file__).parent if str(project_root) not in sys.path: sys.path.insert(0, str(project_root)) # Configurar logging antes de importar Qt from arshipdesign.utils.logger import setup_logging from arshipdesign.utils.settings import get_log_level setup_logging(get_log_level()) from arshipdesign.utils.logger import get_logger logger = get_logger("main") logger.info("Iniciando AR-ShipDesign v0.1.0") # Importar Qt try: from PySide6.QtWidgets import QApplication from PySide6.QtCore import Qt from PySide6.QtGui import QFont except ImportError as e: print(f"ERROR: No se puede importar PySide6: {e}") print("Instala las dependencias con: pip install -r requirements.txt") return 1 # High DPI os.environ.setdefault("QT_AUTO_SCREEN_SCALE_FACTOR", "1") app = QApplication(sys.argv) app.setApplicationName("AR-ShipDesign") app.setOrganizationName("AlvaroRomero") app.setApplicationVersion("0.1.0") # Fuente por defecto font = QFont("Segoe UI", 10) app.setFont(font) # Aplicar tema from arshipdesign.utils.settings import get_theme theme = get_theme() theme_path = Path(__file__).parent / "arshipdesign" / "ui" / "themes" / f"{theme}.qss" if theme_path.exists(): app.setStyleSheet(theme_path.read_text(encoding="utf-8")) # Ventana principal from arshipdesign.ui.main_window import MainWindow window = MainWindow() window.show() logger.info("Ventana principal lista") return app.exec() if __name__ == "__main__": sys.exit(main())