feat(training): name the due line, hint follows it
public
feat(training): name the due line, hint follows it Coach bar opens with "Heute dran: Linie 3 von 13 (neu) – <name>". Hint showed the main line even when another line was due. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| Changeset | b7d17513a96354675c872cb40ec8c194f0f34018 |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@nullachtvierzehn.de>, |
| Parents | 2ef09b306316 |
| Children | b987c60917a3 |
| Pushlog | by timo via ssh by timo via ssh |
modified schach/training.py +17 −2
| @@ -250,7 +250,8 @@ class OpeningMixin: | ||
| 250 | 250 | self.view.flipped = self.human == chess.BLACK |
| 251 | 251 | self.list_btn.set_active(False) |
| 252 | 252 | self.coach_log = [] |
| 253 | - self._coach(_escape(notation.text(course.welcome or course.intro, self._notation()))) | |
| 253 | + welcome = _escape(notation.text(course.welcome or course.intro, self._notation())) | |
| 254 | + self._coach(f"{welcome}\n<b>{_escape(self._opening_line_text())}</b>") | |
| 254 | 255 | self._changed() |
| 255 | 256 | self._refresh() |
| 256 | 257 | self._opening_next_step() |
| @@ -295,6 +296,19 @@ class OpeningMixin: | ||
| 295 | 296 | |
| 296 | 297 | self.maia.submit(maia_candidates(board, self.elo, count=8), pick) |
| 297 | 298 | |
| 299 | + def _opening_line_text(self): | |
| 300 | + """„Heute dran: Linie 3 von 13 (neu) – Italienisch: Giuoco Pianissimo“.""" | |
| 301 | + line_id, moves = self.course_line | |
| 302 | + all_ids = [i for i, _m in repetition.lines(self.course)] | |
| 303 | + end = self.course.start() | |
| 304 | + for move in moves: | |
| 305 | + end.push(move) | |
| 306 | + name = _names().name(end) | |
| 307 | + name = notation.text(name, self._notation()) if name else "" | |
| 308 | + kind = "neu" if progress().card(self.course, line_id) is None else "Wiederholung" | |
| 309 | + text = f"Heute dran: Linie {all_ids.index(line_id) + 1} von {len(all_ids)} ({kind})" | |
| 310 | + return f"{text} – {name}" if name and name != self.course.title else text | |
| 311 | + | |
| 298 | 312 | def _opening_target(self, options): |
| 299 | 313 | """Kursantwort entlang der heutigen Linie – solange die Partie noch auf ihr ist.""" |
| 300 | 314 | if self.course_line is None: |
| @@ -393,7 +407,8 @@ class OpeningMixin: | ||
| 393 | 407 | def _opening_hint(self): |
| 394 | 408 | options = self.course.options(self.board) if self.course else [] |
| 395 | 409 | if options: |
| 396 | - self.hint_move = options[0].move | |
| 410 | + target = self._opening_target(options) # Hinweis folgt der Linie von heute | |
| 411 | + self.hint_move = (target or options[0]).move | |
| 397 | 412 | self.course_stats["hints"] += 1 |
| 398 | 413 | |
| 399 | 414 | def _opening_finished(self): |