Menú d'opcions: ocultar no descarregats i comprovar actualitzacions, amb persistència

This commit is contained in:
2026-05-29 21:29:12 +02:00
parent 9d13c2434b
commit 235a3966d2
7 changed files with 200 additions and 6 deletions
+32
View File
@@ -19,6 +19,7 @@ class _Signals(QObject):
log = Signal(str) # línea de log
finished = Signal(object) # payload según el worker (GameMeta o int exit code)
error = Signal(str) # mensaje de error
result = Signal(str, bool) # (game_id, has_update) — CheckUpdatesWorker
class DownloadWorker(QRunnable):
@@ -57,3 +58,34 @@ class RunWorker(QRunnable):
self.signals.error.emit(str(exc))
return
self.signals.finished.emit(code)
class CheckUpdatesWorker(QRunnable):
"""Comprueba actualizaciones pendientes de los juegos ya descargados.
Emite `result(game_id, has_update)` por cada juego instalado y `finished` al final.
"""
def __init__(self, root: Path, games: list[Game]) -> None:
super().__init__()
self.root = root
self.games = games
self.signals = _Signals()
def run(self) -> None: # noqa: D401 - API de QRunnable
try:
for game in self.games:
if not gitops.is_installed(self.root, game):
continue
try:
has_update = gitops.check_update(
self.root, game, log=self.signals.log.emit
)
except Exception as exc: # noqa: BLE001 - no abortar el resto
self.signals.log.emit(f"check {game.id}: {exc}")
continue
self.signals.result.emit(game.id, has_update)
except Exception as exc: # noqa: BLE001 - reportar a la UI
self.signals.error.emit(str(exc))
return
self.signals.finished.emit(None)