feat(ui): Maia think-time switch in new-game dialog
public
feat(ui): Maia think-time switch in new-game dialog - move 'Maia denkt wie ein Mensch nach' out of preferences; saved with elo and clock on 'Spielen', applies per game, not live - drop duplicate colour choice from preferences Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| Changeset | be58883edac9b6bef1f65e318911afa36f83125a |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@nullachtvierzehn.de>, |
| Parents | 1265604800a6 |
| Children | 6b0aab6a6aa9 |
| Pushlog | by timo via ssh by timo via ssh |
modified schach/app.py +8 −1
| @@ -2212,6 +2212,12 @@ class Window(OnlineMixin, PuzzleMixin, O | ||
| 2212 | 2212 | current = self.settings.get("time_control", "Ohne Uhr") |
| 2213 | 2213 | clock_row.set_selected(labels.index(current) if current in labels else 0) |
| 2214 | 2214 | group.add(clock_row) |
| 2215 | + think_row = Adw.SwitchRow( | |
| 2216 | + title="Maia denkt wie ein Mensch nach", | |
| 2217 | + subtitle="Ein paar Sekunden, bei schwierigen Stellungen länger. Aus: Maia antwortet sofort.", | |
| 2218 | + active=bool(self.settings.get("human_time", True)), | |
| 2219 | + ) | |
| 2220 | + group.add(think_row) | |
| 2215 | 2221 | |
| 2216 | 2222 | elo_row = Adw.ActionRow(title="Stärke von Maia") |
| 2217 | 2223 | elo_label = Gtk.Label(css_classes=["numeric", "heading"]) |
| @@ -2246,7 +2252,8 @@ class Window(OnlineMixin, PuzzleMixin, O | ||
| 2246 | 2252 | choice = colors[color_row.get_selected()] |
| 2247 | 2253 | self.elo = snap(scale.get_value()) |
| 2248 | 2254 | label = TIME_CONTROLS[clock_row.get_selected()][0] |
| 2249 | - self.settings.update(elo=self.elo, color=choice, time_control=label) | |
| 2255 | + self.settings.update(elo=self.elo, color=choice, time_control=label, | |
| 2256 | + human_time=think_row.get_active()) | |
| 2250 | 2257 | save_settings(self.settings) |
| 2251 | 2258 | color = {"white": chess.WHITE, "black": chess.BLACK}.get(choice) |
| 2252 | 2259 | self.new_game(color if color is not None else random.choice([chess.WHITE, chess.BLACK]), label) |
modified schach/prefs.py +0 −20
| @@ -12,7 +12,6 @@ from . import energy, export, notation, | ||
| 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 | -COLORS = [("white", "Weiß"), ("black", "Schwarz"), ("random", "Zufällig")] | |
| 16 | 15 | # Zielwerte für FSRS stehen in repetition.RETENTION |
| 17 | 16 | RETENTION_LEVELS = [ |
| 18 | 17 | ("relaxed", "Locker", "Weniger Wiederholungen, mehr Neues. Manches wird vergessen, das ist okay."), |
| @@ -51,17 +50,6 @@ class Preferences(Adw.PreferencesDialog) | ||
| 51 | 50 | page = Adw.PreferencesPage(title="Allgemein", icon_name="preferences-system-symbolic") |
| 52 | 51 | settings = self.win.settings |
| 53 | 52 | |
| 54 | - game = Adw.PreferencesGroup(title="Neue Partie") | |
| 55 | - color = Adw.ComboRow( | |
| 56 | - title="Deine Farbe", subtitle="Vorauswahl im Dialog „Neue Partie“", | |
| 57 | - model=Gtk.StringList.new([label for _, label in COLORS]), | |
| 58 | - ) | |
| 59 | - keys = [key for key, _ in COLORS] | |
| 60 | - color.set_selected(keys.index(settings.get("color", "white")) if settings.get("color") in keys else 0) | |
| 61 | - color.connect("notify::selected", lambda row, _p: self._set("color", keys[row.get_selected()])) | |
| 62 | - game.add(color) | |
| 63 | - page.add(game) | |
| 64 | - | |
| 65 | 53 | opponent = Adw.PreferencesGroup(title="Gegner") |
| 66 | 54 | spread = Adw.SpinRow( |
| 67 | 55 | title="Streuung von Maia", |
| @@ -94,14 +82,6 @@ class Preferences(Adw.PreferencesDialog) | ||
| 94 | 82 | bar.set_selected(sources.index(current) if current in sources else 0) |
| 95 | 83 | bar.connect("notify::selected", lambda row, _p: self._set("wdl_source", sources[row.get_selected()])) |
| 96 | 84 | feedback.add(bar) |
| 97 | - think = Adw.SwitchRow( | |
| 98 | - title="Maia denkt wie ein Mensch nach", | |
| 99 | - subtitle="Ein paar Sekunden Bedenkzeit, bei schwierigen Stellungen länger – so hetzt die " | |
| 100 | - "Partie nicht. Ausgeschaltet antwortet Maia sofort.", | |
| 101 | - active=bool(settings.get("human_time", True)), | |
| 102 | - ) | |
| 103 | - think.connect("notify::active", lambda row, _p: self._set("human_time", row.get_active())) | |
| 104 | - opponent.add(think) | |
| 105 | 85 | page.add(feedback) |
| 106 | 86 | page.add(self._training_group()) |
| 107 | 87 | page.add(self._programs_group()) |