mirror of
https://github.com/RetroGameSets/RGSX.git
synced 2026-03-25 02:05:59 +01:00
v2.3.0.2
- show toast notification when download completd but not open history - move toast notification on top right corner
This commit is contained in:
@@ -928,7 +928,12 @@ async def main():
|
||||
config.download_result_error = not success
|
||||
config.download_progress.clear()
|
||||
config.pending_download = None
|
||||
config.menu_state = "history"
|
||||
# Afficher un toast au lieu de changer de page
|
||||
if success:
|
||||
toast_msg = f"[OK] {game_name}\n{_('download_completed') if _ else 'Download completed'}"
|
||||
else:
|
||||
toast_msg = f"[ERROR] {game_name}\n{_('download_failed') if _ else 'Download failed'}"
|
||||
show_toast(toast_msg, 3000)
|
||||
config.needs_redraw = True
|
||||
del config.download_tasks[task_id]
|
||||
except Exception as e:
|
||||
@@ -948,7 +953,9 @@ async def main():
|
||||
config.download_result_error = True
|
||||
config.download_progress.clear()
|
||||
config.pending_download = None
|
||||
config.menu_state = "history"
|
||||
# Afficher un toast au lieu de changer de page
|
||||
toast_msg = f"[ERROR] {game_name}\n{_('download_failed') if _ else 'Download failed'}"
|
||||
show_toast(toast_msg, 3000)
|
||||
config.needs_redraw = True
|
||||
del config.download_tasks[task_id]
|
||||
else:
|
||||
@@ -982,9 +989,14 @@ async def main():
|
||||
config.download_result_error = not success
|
||||
config.download_progress.clear()
|
||||
config.pending_download = None
|
||||
config.menu_state = "history"
|
||||
# Afficher un toast au lieu de changer de page
|
||||
if success:
|
||||
toast_msg = f"[OK] {game_name}\n{_('download_completed') if _ else 'Download completed'}"
|
||||
else:
|
||||
toast_msg = f"[ERROR] {game_name}\n{_('download_failed') if _ else 'Download failed'}"
|
||||
show_toast(toast_msg, 3000)
|
||||
config.needs_redraw = True
|
||||
logger.debug(f"[DOWNLOAD_TASK] Menu state changed to history after completion, task_id={task_id}")
|
||||
logger.debug(f"[DOWNLOAD_TASK] Toast displayed after completion, task_id={task_id}")
|
||||
del config.download_tasks[task_id]
|
||||
else:
|
||||
downloaded, total_size = data[1], data[2]
|
||||
|
||||
@@ -13,7 +13,7 @@ except Exception:
|
||||
pygame = None # type: ignore
|
||||
|
||||
# Version actuelle de l'application
|
||||
app_version = "2.3.0.1"
|
||||
app_version = "2.3.0.2"
|
||||
|
||||
|
||||
def get_application_root():
|
||||
|
||||
@@ -2670,7 +2670,7 @@ def draw_popup(screen):
|
||||
|
||||
|
||||
def draw_toast(screen):
|
||||
"""Affiche une notification toast dans le coin inférieur droit (2s max).
|
||||
"""Affiche une notification toast dans le coin supérieur droit (2s max).
|
||||
|
||||
Utilise config.toast_message pour le contenu.
|
||||
Utilise config.toast_duration (par défaut 2000ms) pour la durée.
|
||||
@@ -2716,10 +2716,10 @@ def draw_toast(screen):
|
||||
toast_width = max_width
|
||||
toast_height = len(wrapped_lines) * line_height + 2 * toast_padding
|
||||
|
||||
# Position: coin inférieur droit
|
||||
# Position: coin supérieur droit
|
||||
margin = 20
|
||||
toast_x = config.screen_width - toast_width - margin
|
||||
toast_y = config.screen_height - toast_height - margin
|
||||
toast_y = margin
|
||||
|
||||
# Créer une surface avec transparence
|
||||
toast_surface = pygame.Surface((toast_width, toast_height), pygame.SRCALPHA)
|
||||
|
||||
Reference in New Issue
Block a user