From deb62a94decd656f03fd2514c6e62b7761fd2b52 Mon Sep 17 00:00:00 2001 From: Louis Mazin Date: Tue, 9 Sep 2025 19:14:56 +0200 Subject: [PATCH] fix splash + update --- config.json | 4 ++-- main.py | 23 ++++++++--------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/config.json b/config.json index 2735aaa..c0d8290 100644 --- a/config.json +++ b/config.json @@ -1,10 +1,10 @@ { - "app_name": "Application", + "app_name": "HoDA", "app_os": "Windows", "app_version": "1.0.0", "architecture": "x64", "icon_path": "data/assets/icon.ico", "splash_image": "splash", "main_script": "main.py", - "git_repo": "https://gitea.louismazin.ovh/LouisMazin/PythonApplicationTemplate" + "git_repo": "https://gitea.louismazin.ovh/LouisMazin/HoDA" } \ No newline at end of file diff --git a/main.py b/main.py index 290ded6..284f24e 100644 --- a/main.py +++ b/main.py @@ -13,6 +13,7 @@ def main() -> int: update_manager = main_manager.get_update_manager() app: QApplication = QApplication(sys.argv) + app.setStyleSheet(theme_manager.get_sheet()) app.setApplicationName(settings_manager.get_config("app_name")) app.setWindowIcon(QIcon(paths.get_asset_path("icon"))) @@ -20,35 +21,27 @@ def main() -> int: splash_image_path = paths.get_asset_path(settings_manager.get_config("splash_image")) use_splash = splash_image_path and paths.Path(splash_image_path).exists() + # Créer la fenêtre principale + window: MainWindow = MainWindow() + if use_splash: # Créer et afficher le splash screen splash = SplashScreen(duration=1500) splash.show_splash() - # Vérifier les mises à jour en arrière-plan - if update_manager.check_for_update(): - splash.close_splash() - return 0 - - # Créer la fenêtre principale - window: MainWindow = MainWindow() - - # Connecter le signal finished pour afficher la fenêtre principale + # Connecter le signal finished pour afficher la fenêtre principale et vérifier les mises à jour def show_main_window(): splash.close() + if update_manager.check_for_update(): + return 0 window.show() splash.finished.connect(show_main_window) else: - # Pas de splash screen, vérifier directement les mises à jour + # Pas de splash screen, afficher directement la fenêtre principale et vérifier les mises à jour if update_manager.check_for_update(): return 0 - - # Créer et afficher directement la fenêtre principale - window: MainWindow = MainWindow() window.show() - - app.setStyleSheet(theme_manager.get_sheet()) return app.exec() if __name__ == "__main__":