fix splash + update
This commit is contained in:
parent
c2067b2a41
commit
deb62a94de
@ -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"
|
||||
}
|
23
main.py
23
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__":
|
||||
|
Loading…
x
Reference in New Issue
Block a user