La fila és el botó: clic descarrega/actualitza o juga, amb text d'acció
This commit is contained in:
@@ -53,8 +53,7 @@ class MainWindow(QMainWindow):
|
||||
list_layout.setSpacing(6)
|
||||
for game in config.games:
|
||||
row = GameRow(game, root)
|
||||
row.download_requested.connect(self._on_download)
|
||||
row.run_requested.connect(self._on_run)
|
||||
row.activated.connect(self._on_activate)
|
||||
row.delete_requested.connect(self._on_delete)
|
||||
self.rows[game.id] = row
|
||||
list_layout.addWidget(row)
|
||||
@@ -151,6 +150,14 @@ class MainWindow(QMainWindow):
|
||||
|
||||
# --------------------------------------------------------------- accions
|
||||
|
||||
def _on_activate(self, game: Game) -> None:
|
||||
"""Clic sobre la fila: descarrega/actualitza si cal, si no juga."""
|
||||
row = self.rows[game.id]
|
||||
if row.primary_action_is_download():
|
||||
self._on_download(game)
|
||||
else:
|
||||
self._on_run(game)
|
||||
|
||||
def _on_download(self, game: Game) -> None:
|
||||
row = self.rows[game.id]
|
||||
row.set_busy(True, "Descarregant…")
|
||||
|
||||
Reference in New Issue
Block a user