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_os": "Windows",
|
||||||
"app_version": "1.0.0",
|
"app_version": "1.0.0",
|
||||||
"architecture": "x64",
|
"architecture": "x64",
|
||||||
"icon_path": "data/assets/icon.ico",
|
"icon_path": "data/assets/icon.ico",
|
||||||
"splash_image": "splash",
|
"splash_image": "splash",
|
||||||
"main_script": "main.py",
|
"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()
|
update_manager = main_manager.get_update_manager()
|
||||||
|
|
||||||
app: QApplication = QApplication(sys.argv)
|
app: QApplication = QApplication(sys.argv)
|
||||||
|
app.setStyleSheet(theme_manager.get_sheet())
|
||||||
app.setApplicationName(settings_manager.get_config("app_name"))
|
app.setApplicationName(settings_manager.get_config("app_name"))
|
||||||
app.setWindowIcon(QIcon(paths.get_asset_path("icon")))
|
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"))
|
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()
|
use_splash = splash_image_path and paths.Path(splash_image_path).exists()
|
||||||
|
|
||||||
|
# Créer la fenêtre principale
|
||||||
|
window: MainWindow = MainWindow()
|
||||||
|
|
||||||
if use_splash:
|
if use_splash:
|
||||||
# Créer et afficher le splash screen
|
# Créer et afficher le splash screen
|
||||||
splash = SplashScreen(duration=1500)
|
splash = SplashScreen(duration=1500)
|
||||||
splash.show_splash()
|
splash.show_splash()
|
||||||
|
|
||||||
# Vérifier les mises à jour en arrière-plan
|
# Connecter le signal finished pour afficher la fenêtre principale et vérifier les mises à jour
|
||||||
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
|
|
||||||
def show_main_window():
|
def show_main_window():
|
||||||
splash.close()
|
splash.close()
|
||||||
|
if update_manager.check_for_update():
|
||||||
|
return 0
|
||||||
window.show()
|
window.show()
|
||||||
|
|
||||||
splash.finished.connect(show_main_window)
|
splash.finished.connect(show_main_window)
|
||||||
else:
|
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():
|
if update_manager.check_for_update():
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
# Créer et afficher directement la fenêtre principale
|
|
||||||
window: MainWindow = MainWindow()
|
|
||||||
window.show()
|
window.show()
|
||||||
|
|
||||||
app.setStyleSheet(theme_manager.get_sheet())
|
|
||||||
return app.exec()
|
return app.exec()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user