feat(board): show player names in all game modes
public
feat(board): show player names in all game modes Name strips existed only for Lichess games; local games now show Maia strength vs Du, reviews show the stored opponent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| Changeset | ec708f031861d7fb705e408d109b5f44d902de7e |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@nullachtvierzehn.de>, |
| Parents | 32c4e917b89c |
| Children | 65c63618cf62 |
| Pushlog | by timo via ssh by timo via ssh |
modified schach/app.py +14 −0
| @@ -402,6 +402,7 @@ class Window(OnlineMixin, PuzzleMixin, A | ||
| 402 | 402 | self.title.set_subtitle(f"Maia {self.elo} · du spielst {side}") |
| 403 | 403 | default_title = {"puzzle": "Rätsel", "online": "Lichess"}.get(self.mode, "Schach") |
| 404 | 404 | self.title.set_title(self.save_name or default_title) |
| 405 | + self._refresh_players() | |
| 405 | 406 | |
| 406 | 407 | hints = self.mode in ("maia", "puzzle") |
| 407 | 408 | can_hint = ( |
| @@ -446,6 +447,19 @@ class Window(OnlineMixin, PuzzleMixin, A | ||
| 446 | 447 | self.movelist.update(self.board, self.evals, self.symbols, self.browse_ply) |
| 447 | 448 | self._request_missing_evals() |
| 448 | 449 | |
| 450 | + def _refresh_players(self): | |
| 451 | + """Spieler-Zeilen über und unter dem Brett: wer spielt hier gegen wen?""" | |
| 452 | + if self.mode == "online": | |
| 453 | + return # Namen und Uhren setzt die Lichess-Verbindung | |
| 454 | + if self.mode == "maia": | |
| 455 | + other = f"Maia-3 · {self.elo}" | |
| 456 | + elif self.mode == "review" and self.opponent: | |
| 457 | + other = self.opponent | |
| 458 | + else: | |
| 459 | + self.view.names = None | |
| 460 | + return | |
| 461 | + self.view.names = {self.human: "Du", not self.human: other} | |
| 462 | + | |
| 449 | 463 | def _human_has_moved(self): |
| 450 | 464 | n = len(self.board.move_stack) |
| 451 | 465 | return n >= 1 if self.human == chess.WHITE else n >= 2 |