| @@ -271,7 +271,7 @@ class OpeningMixin: |
| 271 | 271 | # Vorführung: die Gegenwart liegt links (|<), die gedachte Zukunft rechts davon |
| 272 | 272 | self.coach_first = Gtk.Button(icon_name="go-first-symbolic", tooltip_text="Zurück zur Partie (Esc)", |
| 273 | 273 | css_classes=["flat"], visible=False) |
| 274 | | - self.coach_first.connect("clicked", lambda *_: self._demo_end()) |
| 274 | + self.coach_first.connect("clicked", lambda *_: self._coach_first()) |
| 275 | 275 | self.coach_nav.append(self.coach_first) |
| 276 | 276 | self.coach_prev = Gtk.Button(icon_name="go-previous-symbolic", tooltip_text="Vorherige Rückmeldung", |
| 277 | 277 | css_classes=["flat"]) |
| @@ -552,6 +552,24 @@ class OpeningMixin: |
| 552 | 552 | self._refresh() |
| 553 | 553 | self._coach_show() |
| 554 | 554 | |
| 555 | + def _main_line_return(self, node): |
| 556 | + """Der gespielte Zug, den die Nebenvariante mit ``node`` ersetzt (None auf der Hauptlinie).""" |
| 557 | + tree, first = self.demo["tree"], None |
| 558 | + while node.parent is not None and not tree.meta.get(node, {}).get("played"): |
| 559 | + node, first = node.parent, node |
| 560 | + if first is None: |
| 561 | + return None |
| 562 | + return next((c for c in node.variations if tree.meta.get(c, {}).get("played")), node) |
| 563 | + |
| 564 | + def _coach_first(self): |
| 565 | + """|<: beim Nachspielen zurück auf die Hauptlinie, sonst zurück zur Partie.""" |
| 566 | + if self.demo is not None and self.demo.get("game") and self.replaying: |
| 567 | + target = self._main_line_return(self.demo["node"]) |
| 568 | + if target is not None and not self.demo["busy"]: |
| 569 | + self._analysis_open_node(target) |
| 570 | + return |
| 571 | + self._demo_end() |
| 572 | + |
| 555 | 573 | def _demo_end(self): |
| 556 | 574 | if self.demo is None: |
| 557 | 575 | return False |
| @@ -1015,17 +1033,8 @@ class OpeningMixin: |
| 1015 | 1033 | if self.demo.get("game") and not busy else None |
| 1016 | 1034 | if best is not None and best.comment: # „Warum nicht?“: die Begründung schon an der Gabelung |
| 1017 | 1035 | markup += "\n" + _escape(notation.text(best.comment, style)) |
| 1018 | | - if len(node.variations) > 1 and not busy: |
| 1019 | | - board = node.board() |
| 1020 | | - ahead = self._demo_next(node) |
| 1021 | | - others = [c for c in node.variations if c is not ahead] |
| 1022 | | - |
| 1023 | | - def option(child): |
| 1024 | | - name = tree.label(child) |
| 1025 | | - return _escape(notation.move(board, child.move, style)) + (f" ({_escape(name)})" if name else "") |
| 1026 | | - markup += (f"\n<span alpha='70%'>Weiter mit >: {option(ahead)}. Oder Pfeil anklicken: " |
| 1027 | | - + ", ".join(option(c) for c in others) + ".</span>") |
| 1028 | | - elif not busy and (suggested := explain.suggestions(tree, node)): |
| 1036 | + # Gabelungen erklären sich über die Pfeile mit Schild und die Zugliste selbst (24.11.2026) |
| 1037 | + if len(node.variations) <= 1 and not busy and (suggested := explain.suggestions(tree, node)): |
| 1029 | 1038 | board = node.board() |
| 1030 | 1039 | words = [_escape(notation.move(board, move, style)) + (f" ({_escape(label)})" if label else "") |
| 1031 | 1040 | for move, label in suggested] |
| @@ -1037,11 +1046,14 @@ class OpeningMixin: |
| 1037 | 1046 | self.coach_prev.set_sensitive(depth > 0 and not busy) |
| 1038 | 1047 | self.coach_next.set_sensitive(bool(node.variations) and not busy) |
| 1039 | 1048 | self.coach_last.set_visible(False) |
| 1040 | | - self.coach_first.set_visible(True) |
| 1041 | 1049 | if self.demo.get("game") and self.replaying: |
| 1042 | | - self.coach_first.set_tooltip_text("Nachspielen beenden (Esc)") |
| 1043 | | - self.coach_first.set_sensitive(not busy and self.recorder is None) |
| 1050 | + # Nachspielen hat keine Gegenwart, zu der |< zurückführt: nur in einer Nebenvariante |
| 1051 | + # zurück zum gespielten Zug, den sie ersetzt (Esc beendet das Nachspielen weiterhin) |
| 1052 | + self.coach_first.set_visible(self._main_line_return(node) is not None) |
| 1053 | + self.coach_first.set_tooltip_text("Zurück zum gespielten Zug") |
| 1054 | + self.coach_first.set_sensitive(not busy) |
| 1044 | 1055 | else: |
| 1056 | + self.coach_first.set_visible(True) |
| 1045 | 1057 | self.coach_first.set_tooltip_text("Zurück zur Partie (Esc)") |
| 1046 | 1058 | self.coach_first.set_sensitive(True) |
| 1047 | 1059 | self.coach_trace.set_visible(True) |