fix splash when update
This commit is contained in:
parent
18e546989d
commit
dbc6361027
@ -62,16 +62,26 @@ class UpdateManager:
|
||||
return []
|
||||
return releases_list
|
||||
|
||||
def check_for_update(self, parent=None) -> bool:
|
||||
def check_for_update(self, parent=None, splash_screen=None) -> bool:
|
||||
current_version = self.settings_manager.get_config("app_version")
|
||||
releases = self.get_releases_with_asset()
|
||||
release = releases[0] if releases else None
|
||||
if release and version.parse(release["tag_name"]) > version.parse(current_version):
|
||||
# Fermer le splash avant d'afficher la boîte de dialogue
|
||||
if splash_screen:
|
||||
splash_screen.hide()
|
||||
|
||||
choice = self.show_update_dialog(releases, current_version, parent)
|
||||
|
||||
if choice:
|
||||
folder = QFileDialog.getExistingDirectory(parent, self.language_manager.get_text("choose_update_folder"))
|
||||
if folder:
|
||||
return self.download(release["download_url"], release["tag_name"], folder, parent)
|
||||
|
||||
# Rouvrir le splash si l'utilisateur a refusé la mise à jour
|
||||
if splash_screen:
|
||||
splash_screen.show()
|
||||
|
||||
return False
|
||||
|
||||
def download(self, download_url, version, folder, parent=None):
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"app_name": "Application",
|
||||
"app_name": "Applications",
|
||||
"app_os": "Windows",
|
||||
"app_version": "1.0.0",
|
||||
"architecture": "x64",
|
||||
|
9
main.py
9
main.py
@ -8,12 +8,13 @@ from app.core.main_manager import MainManager
|
||||
|
||||
preloaded_window = None
|
||||
|
||||
def preload_application(progress_callback):
|
||||
def preload_application(progress_callback, splash=None):
|
||||
"""
|
||||
Fonction de préchargement qui s'exécute pendant l'affichage du splash screen
|
||||
|
||||
Args:
|
||||
progress_callback: Fonction pour mettre à jour le texte de progression
|
||||
splash: Référence au splash screen (optionnel)
|
||||
|
||||
Returns:
|
||||
bool: True si tout s'est bien passé, False sinon
|
||||
@ -26,8 +27,8 @@ def preload_application(progress_callback):
|
||||
update_manager = main_manager.get_update_manager()
|
||||
|
||||
progress_callback(language_manager.get_text("checking_updates"))
|
||||
|
||||
if update_manager.check_for_update():
|
||||
|
||||
if update_manager.check_for_update(splash, splash):
|
||||
return False
|
||||
|
||||
progress_callback(language_manager.get_text("initializing"))
|
||||
@ -58,7 +59,7 @@ def main() -> int:
|
||||
use_splash = splash_image_path and paths.Path(splash_image_path).exists()
|
||||
|
||||
if use_splash:
|
||||
splash = SplashScreen(preload_function=preload_application)
|
||||
splash = SplashScreen(preload_function=lambda callback: preload_application(callback, splash))
|
||||
splash.show_splash()
|
||||
|
||||
def on_splash_finished(success):
|
||||
|
Loading…
x
Reference in New Issue
Block a user