diff --git a/qt_ui/main.py b/qt_ui/main.py index a8fcde91..f3f058ad 100644 --- a/qt_ui/main.py +++ b/qt_ui/main.py @@ -6,10 +6,10 @@ from datetime import datetime from pathlib import Path from typing import Optional -from dcs.payloads import PayloadDirectories from PySide2 import QtWidgets from PySide2.QtGui import QPixmap from PySide2.QtWidgets import QApplication, QSplashScreen +from dcs.payloads import PayloadDirectories from dcs.weapons_data import weapon_ids from game import Game, VERSION, persistency @@ -35,11 +35,10 @@ from qt_ui.windows.preferences.QLiberationFirstStartWindow import ( QLiberationFirstStartWindow, ) - THIS_DIR = Path(__file__).parent -def inject_custom_payloads() -> None: +def inject_custom_payloads(user_path: Path) -> None: dev_payloads = THIS_DIR.parent / "resources/customized_payloads" # The packaged release rearranges the file locations, so the release has the # customized payloads in a different location. @@ -55,6 +54,7 @@ def inject_custom_payloads() -> None: ) # We configure these as fallbacks so that the user's payloads override ours. PayloadDirectories.set_fallback(payloads) + PayloadDirectories.set_preferred(user_path / "MissionEditor" / "UnitPayloads") def run_ui(game: Optional[Game], new_map: bool) -> None: @@ -69,8 +69,6 @@ def run_ui(game: Optional[Game], new_map: bool) -> None: logging.info("Loading stylesheet: %s", liberation_theme.get_theme_css_file()) app.setStyleSheet(stylesheet.read()) - inject_custom_payloads() - first_start = liberation_install.init() if first_start: window = QLiberationFirstStartWindow() @@ -83,6 +81,8 @@ def run_ui(game: Optional[Game], new_map: bool) -> None: ) ) + inject_custom_payloads(Path(persistency.base_path())) + # Splash screen setup pixmap = QPixmap("./resources/ui/splash_screen.png") splash = QSplashScreen(pixmap)