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>
| Changeset | 33e93f259f17e3d296bc692d7e204f1f5a17f112 |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@nullachtvierzehn.de>, |
| Parents | 7726f8369605 |
| Children | 25df28b8ce26 |
| Pushlog | by timo via ssh by timo via ssh |
modified schach/app.py +6 −2
| @@ -16,6 +16,7 @@ gi.require_version("Adw", "1") | ||
| 16 | 16 | from gi.repository import Adw, Gdk, Gio, GLib, GObject, Gtk # noqa: E402 |
| 17 | 17 | |
| 18 | 18 | from . import annotate, clipboard, energy, lichess, notation, savegames # noqa: E402 |
| 19 | +from .repetition import DEFAULT_RETENTION # noqa: E402 | |
| 19 | 20 | from .board import BoardView, available_themes # noqa: E402 |
| 20 | 21 | from .movelist import MoveList # noqa: E402 |
| 21 | 22 | from .prefs import Preferences # noqa: E402 |
| @@ -24,7 +25,7 @@ from .threat import null_board, threat_j | ||
| 24 | 25 | from .explain import explain_job, explore_job, graft, why_not_job # noqa: E402 |
| 25 | 26 | from .online import OnlineMixin # noqa: E402 |
| 26 | 27 | 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 | |
| 28 | 29 | from .duo import DuoMixin # noqa: E402 |
| 29 | 30 | from .setup import SetupMixin # noqa: E402 |
| 30 | 31 | from .explorer import ExplorerMixin # noqa: E402 |
| @@ -77,7 +78,7 @@ DEFAULTS = { | ||
| 77 | 78 | "elo": 1200, "color": "white", "theme": "cburnett", "puzzle_difficulty": "normal", |
| 78 | 79 | "temperature": OPPONENT_TEMPERATURE, "scheme": "holz", "hint_helper": DEFAULT_HELPER, |
| 79 | 80 | "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, | |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | 84 | |
| @@ -2133,6 +2134,7 @@ class SchachApp(Adw.Application): | ||
| 2133 | 2134 | def do_startup(self): |
| 2134 | 2135 | Adw.Application.do_startup(self) |
| 2135 | 2136 | set_book_paths(load_settings().get("books", [])) |
| 2137 | + set_retention(load_settings()["retention"]) | |
| 2136 | 2138 | # eigene Symbole (z. B. das Schwert für Drohungen), eingefärbt wie die GNOME-Symbole |
| 2137 | 2139 | Gtk.IconTheme.get_for_display(Gdk.Display.get_default()).add_search_path(ICON_DIR) |
| 2138 | 2140 | self.maia = EngineWorker(MAIA_CMD, on_ready=self._on_maia_ready, cwd=MAIA_CWD, |
| @@ -2229,6 +2231,8 @@ class SchachApp(Adw.Application): | ||
| 2229 | 2231 | save_settings(settings) |
| 2230 | 2232 | if key == "books": |
| 2231 | 2233 | set_book_paths(value) # einmal für alle Fenster, vor deren Auffrischen |
| 2234 | + if key == "retention": | |
| 2235 | + set_retention(value) | |
| 2232 | 2236 | for win in self._windows(): |
| 2233 | 2237 | win.apply_setting(key, value) |
| 2234 | 2238 | |
modified schach/prefs.py +29 −1
| @@ -8,11 +8,17 @@ gi.require_version("Gtk", "4.0") | ||
| 8 | 8 | gi.require_version("Adw", "1") |
| 9 | 9 | from gi.repository import Adw, Gio, GLib, Gtk # noqa: E402 |
| 10 | 10 | |
| 11 | -from . import energy, notation, opening # noqa: E402 | |
| 11 | +from . import energy, notation, opening, repetition # noqa: E402 | |
| 12 | 12 | from .board import DEFAULT_SCHEME, SCHEMES, scheme_colors # noqa: E402 |
| 13 | 13 | from .diagram import USER_PIECES_DIR # noqa: E402 |
| 14 | 14 | |
| 15 | 15 | 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 | +] | |
| 16 | 22 | |
| 17 | 23 | |
| 18 | 24 | class Preferences(Adw.PreferencesDialog): |
| @@ -86,11 +92,33 @@ class Preferences(Adw.PreferencesDialog) | ||
| 86 | 92 | think.connect("notify::active", lambda row, _p: self._set("human_time", row.get_active())) |
| 87 | 93 | opponent.add(think) |
| 88 | 94 | page.add(feedback) |
| 95 | + page.add(self._training_group()) | |
| 89 | 96 | self.books_group = None |
| 90 | 97 | self._books_page = page |
| 91 | 98 | self._build_books() |
| 92 | 99 | return page |
| 93 | 100 | |
| 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 | + | |
| 94 | 122 | def _build_books(self): |
| 95 | 123 | """Gruppe „Eröffnungsbücher“: gewählte Dateien (entfernbar) und gefundene (Bücherordner, PyChess).""" |
| 96 | 124 | if self.books_group is not None: |