Public repository: timo / schach

Reader

Ein aufgeräumtes Schach-Programm für GNOME

feat(prefs): choose how often lines come back

public

feat(prefs): choose how often lines come back

"Wiederholen" under Allgemein > Training sets FSRS desired retention:
Locker 0.80, Ausgewogen 0.85 (default, fewer reviews for kids),
Gründlich 0.92. Above ~0.9 the review load climbs steeply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Changeset33e93f259f17e3d296bc692d7e204f1f5a17f112
Author (claimed)Timo Stolz <timo.stolz@nullachtvierzehn.de>,
Parents7726f8369605
Children25df28b8ce26
Pushlog
by timo via ssh
by timo via ssh

modified schach/app.py +6 −2

@@ -16,6 +16,7 @@ gi.require_version("Adw", "1")
1616
 from gi.repository import Adw, Gdk, Gio, GLib, GObject, Gtk  # noqa: E402
1717
 
1818
 from . import annotate, clipboard, energy, lichess, notation, savegames  # noqa: E402
19
+from .repetition import DEFAULT_RETENTION  # noqa: E402
1920
 from .board import BoardView, available_themes  # noqa: E402
2021
 from .movelist import MoveList  # noqa: E402
2122
 from .prefs import Preferences  # noqa: E402
@@ -24,7 +25,7 @@ from .threat import null_board, threat_j
2425
 from .explain import explain_job, explore_job, graft, why_not_job  # noqa: E402
2526
 from .online import OnlineMixin  # noqa: E402
2627
 from .puzzles import PuzzleMixin  # noqa: E402
27
-from .training import OpeningMixin, set_book_paths  # noqa: E402
28
+from .training import OpeningMixin, set_book_paths, set_retention  # noqa: E402
2829
 from .duo import DuoMixin  # noqa: E402
2930
 from .setup import SetupMixin  # noqa: E402
3031
 from .explorer import ExplorerMixin  # noqa: E402
@@ -77,7 +78,7 @@ DEFAULTS = {
7778
     "elo": 1200, "color": "white", "theme": "cburnett", "puzzle_difficulty": "normal",
7879
     "temperature": OPPONENT_TEMPERATURE, "scheme": "holz", "hint_helper": DEFAULT_HELPER,
7980
     "threat_source": "opponent", "notation": notation.DEFAULT, "time_control": "Ohne Uhr",
80
-    "live_glyphs": True, "human_time": True, "books": [],
81
+    "live_glyphs": True, "human_time": True, "books": [], "retention": DEFAULT_RETENTION,
8182
 }
8283
 
8384
 
@@ -2133,6 +2134,7 @@ class SchachApp(Adw.Application):
21332134
     def do_startup(self):
21342135
         Adw.Application.do_startup(self)
21352136
         set_book_paths(load_settings().get("books", []))
2137
+        set_retention(load_settings()["retention"])
21362138
         # eigene Symbole (z. B. das Schwert für Drohungen), eingefärbt wie die GNOME-Symbole
21372139
         Gtk.IconTheme.get_for_display(Gdk.Display.get_default()).add_search_path(ICON_DIR)
21382140
         self.maia = EngineWorker(MAIA_CMD, on_ready=self._on_maia_ready, cwd=MAIA_CWD,
@@ -2229,6 +2231,8 @@ class SchachApp(Adw.Application):
22292231
         save_settings(settings)
22302232
         if key == "books":
22312233
             set_book_paths(value)  # einmal für alle Fenster, vor deren Auffrischen
2234
+        if key == "retention":
2235
+            set_retention(value)
22322236
         for win in self._windows():
22332237
             win.apply_setting(key, value)
22342238
 

modified schach/prefs.py +29 −1

@@ -8,11 +8,17 @@ gi.require_version("Gtk", "4.0")
88
 gi.require_version("Adw", "1")
99
 from gi.repository import Adw, Gio, GLib, Gtk  # noqa: E402
1010
 
11
-from . import energy, notation, opening  # noqa: E402
11
+from . import energy, notation, opening, repetition  # noqa: E402
1212
 from .board import DEFAULT_SCHEME, SCHEMES, scheme_colors  # noqa: E402
1313
 from .diagram import USER_PIECES_DIR  # noqa: E402
1414
 
1515
 COLORS = [("white", "Weiß"), ("black", "Schwarz"), ("random", "Zufällig")]
16
+# Zielwerte für FSRS stehen in repetition.RETENTION
17
+RETENTION_LEVELS = [
18
+    ("relaxed", "Locker", "Weniger Wiederholungen, mehr Neues. Manches wird vergessen, das ist okay."),
19
+    ("balanced", "Ausgewogen", "Gut für Kinder und zum Spaß."),
20
+    ("thorough", "Gründlich", "Mehr Wiederholungen, dafür sitzt es."),
21
+]
1622
 
1723
 
1824
 class Preferences(Adw.PreferencesDialog):
@@ -86,11 +92,33 @@ class Preferences(Adw.PreferencesDialog)
8692
         think.connect("notify::active", lambda row, _p: self._set("human_time", row.get_active()))
8793
         opponent.add(think)
8894
         page.add(feedback)
95
+        page.add(self._training_group())
8996
         self.books_group = None
9097
         self._books_page = page
9198
         self._build_books()
9299
         return page
93100
 
101
+    def _training_group(self):
102
+        """Wie oft geübte Kurslinien wiederkommen (Zielwert von FSRS)."""
103
+        group = Adw.PreferencesGroup(title="Training")
104
+        keys = [key for key, _label, _text in RETENTION_LEVELS]
105
+        labels = [label for _key, label, _text in RETENTION_LEVELS]
106
+        row = Adw.ComboRow(title="Wiederholen", model=Gtk.StringList.new(labels))
107
+        current = self.win.settings.get("retention", repetition.DEFAULT_RETENTION)
108
+        row.set_selected(keys.index(current) if current in keys else keys.index(repetition.DEFAULT_RETENTION))
109
+
110
+        def show(*_):
111
+            row.set_subtitle(RETENTION_LEVELS[row.get_selected()][2])
112
+
113
+        def changed(*_):
114
+            show()
115
+            self._set("retention", keys[row.get_selected()])
116
+
117
+        show()
118
+        row.connect("notify::selected", changed)
119
+        group.add(row)
120
+        return group
121
+
94122
     def _build_books(self):
95123
         """Gruppe „Eröffnungsbücher“: gewählte Dateien (entfernbar) und gefundene (Bücherordner, PyChess)."""
96124
         if self.books_group is not None: