56 lines
1.5 KiB
Python
56 lines
1.5 KiB
Python
"""Punto de entrada principal de la aplicación."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Agregar el directorio raíz al path
|
|
ROOT_DIR = Path(__file__).parent
|
|
sys.path.insert(0, str(ROOT_DIR))
|
|
|
|
from PySide6.QtWidgets import QApplication
|
|
from PySide6.QtCore import Qt
|
|
|
|
from app.ui.main_window import MainWindow
|
|
from app.utils.logger import app_logger
|
|
from app.constants import DATA_DIR, LOGS_DIR
|
|
|
|
|
|
def main():
|
|
"""Función principal."""
|
|
# Crear directorios necesarios
|
|
DATA_DIR.mkdir(parents=True, exist_ok=True)
|
|
LOGS_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
app_logger.info("=" * 80)
|
|
app_logger.info("CloudRestoreAS - Iniciando aplicación")
|
|
app_logger.info("=" * 80)
|
|
|
|
# Configurar aplicación Qt
|
|
app = QApplication(sys.argv)
|
|
app.setApplicationName("CloudRestoreAS")
|
|
app.setOrganizationName("Aduanasoft")
|
|
|
|
# Habilitar high DPI scaling
|
|
app.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling)
|
|
|
|
try:
|
|
# Crear y mostrar ventana principal
|
|
window = MainWindow()
|
|
window.show()
|
|
|
|
app_logger.info("Ventana principal mostrada")
|
|
|
|
# Ejecutar aplicación
|
|
exit_code = app.exec()
|
|
|
|
app_logger.info(f"Aplicación finalizada con código: {exit_code}")
|
|
sys.exit(exit_code)
|
|
|
|
except Exception as e:
|
|
app_logger.critical(f"Error fatal en la aplicación: {e}", exc_info=True)
|
|
sys.exit(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|