Public repository: timo / schach

Reader

Ein aufgeräumtes Schach-Programm für GNOME

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>
Changesetbe58883edac9b6bef1f65e318911afa36f83125a
Author (claimed)Timo Stolz <timo.stolz@nullachtvierzehn.de>,
Parents1265604800a6
Children6b0aab6a6aa9
Pushlog
by timo via ssh
by timo via ssh

modified schach/app.py +8 −1

@@ -2212,6 +2212,12 @@ class Window(OnlineMixin, PuzzleMixin, O
22122212
         current = self.settings.get("time_control", "Ohne Uhr")
22132213
         clock_row.set_selected(labels.index(current) if current in labels else 0)
22142214
         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)
22152221
 
22162222
         elo_row = Adw.ActionRow(title="Stärke von Maia")
22172223
         elo_label = Gtk.Label(css_classes=["numeric", "heading"])
@@ -2246,7 +2252,8 @@ class Window(OnlineMixin, PuzzleMixin, O
22462252
             choice = colors[color_row.get_selected()]
22472253
             self.elo = snap(scale.get_value())
22482254
             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())
22502257
             save_settings(self.settings)
22512258
             color = {"white": chess.WHITE, "black": chess.BLACK}.get(choice)
22522259
             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,
1212
 from .board import DEFAULT_SCHEME, SCHEMES, scheme_colors  # noqa: E402
1313
 from .diagram import USER_PIECES_DIR  # noqa: E402
1414
 
15
-COLORS = [("white", "Weiß"), ("black", "Schwarz"), ("random", "Zufällig")]
1615
 # Zielwerte für FSRS stehen in repetition.RETENTION
1716
 RETENTION_LEVELS = [
1817
     ("relaxed", "Locker", "Weniger Wiederholungen, mehr Neues. Manches wird vergessen, das ist okay."),
@@ -51,17 +50,6 @@ class Preferences(Adw.PreferencesDialog)
5150
         page = Adw.PreferencesPage(title="Allgemein", icon_name="preferences-system-symbolic")
5251
         settings = self.win.settings
5352
 
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
-
6553
         opponent = Adw.PreferencesGroup(title="Gegner")
6654
         spread = Adw.SpinRow(
6755
             title="Streuung von Maia",
@@ -94,14 +82,6 @@ class Preferences(Adw.PreferencesDialog)
9482
         bar.set_selected(sources.index(current) if current in sources else 0)
9583
         bar.connect("notify::selected", lambda row, _p: self._set("wdl_source", sources[row.get_selected()]))
9684
         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)
10585
         page.add(feedback)
10686
         page.add(self._training_group())
10787
         page.add(self._programs_group())