"""QApplication bootstrap.""" from __future__ import annotations import sys from PySide6.QtWidgets import QApplication from .config import AppConfig from .ui.main_window import MainWindow def run(config: AppConfig, target: str | None = None) -> int: app = QApplication(sys.argv) app.setApplicationName("HVideoTool") window = MainWindow(config) window.show() if target: window.open_path(target) # open the given project else: window._auto_open_last() # reopen the last project, if any return app.exec()