Files
pokerfreak/cockpit/ui/trainer.slint
T
mmintelandClaude Opus 5.5 ae6dbb7290 Trainer: Ansagen von Tara (nach dem Zug, vor dem Zug, beide)
Einstellung ansagen (aus | nach | vor | beide) in allen drei Oberflaechen;
stimme bleibt der Hauptschalter. betrieb/ansage.Ansager baut zahlenfreie
Lagen (lehrer_persona.lage_abgleich / lage_hinweis / lage_tipp) und legt sie
beim Sprecher ab, Tara spricht ueber lehrer_llm. Nach dem Zug nur gemeldete
Abweichungen; vor dem Zug im Trainer die Lage ohne die Antwort, im Assistenten
die Empfehlung; nur an Spielgeldtischen (zeigt_kern). Das Spiel wartet nie,
ein Fehler laesst Tara schweigen.

Specs tests/ansage_spec.py: ansage_nur_gemeldet, ansage_zahlenfrei,
ansage_vor_ohne_antwort, ansage_schweigt_bei_fehler rot vorher (Modul fehlte),
gruen nachher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 18:43:01 +01:00

356 lines
14 KiB
Plaintext

// Der Reiter "Trainer" (Plan 2026-11-19 trainer, Stufe 1 Schritt 6): Start/Stopp, alle
// Einstellungen, die Sitzung in bb und der Abgleich "du gegen den Kern", neueste Hand zuerst.
// Rust rechnet alles (src/trainer.rs), hier wird nur gezeichnet. Jede Eingabe geht als
// eingabe(art, a, b) hinaus - die Codes stehen in trainer::Eingabe::aus_code.
import { Farbe, Icon, Segmentschalter, Auswahl, Stepper, Toggle } from "bausteine.slint";
export struct TrainerD {
laeuft: bool,
status: string,
status-farbe: color,
knopf: string,
knopf-aktiv: bool,
meldung: string,
meldung-ok: bool,
text: string,
leer: string,
format-titel: [string],
format-index: int,
stake-da: bool,
stake-titel: [string],
stake-index: int,
gegner-titel: [string],
gegner-index: int,
je-sitz: bool,
rueck-titel: [string],
rueck-index: int,
schwelle: string,
schwelle-auf: bool,
schwelle-ab: bool,
uhr-client: bool,
uhr: string,
uhr-auf: bool,
uhr-ab: bool,
tische: string,
tische-auf: bool,
tische-ab: bool,
hilfe-titel: [string],
hilfe-index: int,
assistent: bool,
stimme: bool,
ansagen-titel: [string],
ansagen-index: int,
ansagen-aktiv: bool,
sitzung: string,
}
export struct TSitz { name: string, titel: [string], index: int }
export struct TKennzahl { titel: string, wert: string, farbe: color }
export struct TZug { zeile: string, warum: string, quelle: string, kosten: string, farbe: color, gemeldet: bool }
export struct TTipp { titel: string, karten: string, empfehlung: string, farbe: color, quelle: string, warum: string }
export struct THand { titel: string, urteil: string, urteil-farbe: color, zuege: [TZug] }
component Karte inherits Rectangle {
background: Farbe.karte;
border-radius: 8px;
border-width: 1px;
border-color: Farbe.linie;
}
component Ueberschrift inherits Text {
color: Farbe.gedaempft;
font-size: 11px;
font-weight: 700;
}
// Eine Zeile: Beschriftung links, das Bedienelement rechts.
component Zeile inherits HorizontalLayout {
in property <string> titel;
in property <string> fuss;
spacing: 10px;
min-height: 34px;
VerticalLayout {
alignment: center;
horizontal-stretch: 1;
Text { text: root.titel; color: Farbe.text; font-size: 13px; vertical-alignment: center; }
if root.fuss != "": Text { text: root.fuss; color: Farbe.gedaempft; font-size: 11px; wrap: word-wrap; }
}
@children
}
component Hauptknopf inherits Rectangle {
in property <string> text;
in property <bool> laeuft;
in property <bool> aktiv: true;
callback geklickt();
height: 36px;
border-radius: 4px;
opacity: aktiv ? 1 : 0.5;
background: root.laeuft
? (ta.pressed ? #9e2a22 : ta.has-hover ? #d23a2e : Farbe.rot)
: (ta.pressed ? #005a9e : ta.has-hover ? #1a86d9 : Farbe.akzent-fuell);
Text { text: root.text; color: #ffffff; font-size: 14px; font-weight: 600; horizontal-alignment: center; vertical-alignment: center; }
ta := TouchArea { enabled: root.aktiv; clicked => { root.geklickt(); } }
}
export component TrainerInhalt inherits VerticalLayout {
in property <TrainerD> t;
in property <[TSitz]> sitze;
in property <[TKennzahl]> kennzahlen;
in property <[THand]> haende;
in property <[TTipp]> tipps;
callback knopf();
callback eingabe(int, int, int);
padding: 14px;
padding-bottom: 18px;
spacing: 12px;
// ---- Kopf: Status und Start/Stopp ------------------------------------------------------
Karte {
VerticalLayout {
padding: 12px;
spacing: 10px;
HorizontalLayout {
spacing: 8px;
Icon { art: "lehrer"; farbe: Farbe.teal; groesse: 20px; y: (parent.height - self.height) / 2; }
Text { text: "Trainer"; color: Farbe.text; font-size: 16px; font-weight: 700; vertical-alignment: center; horizontal-stretch: 1; }
Rectangle {
width: st.preferred-width + 14px;
height: 20px;
y: (parent.height - self.height) / 2;
border-radius: 10px;
background: root.t.status-farbe.transparentize(80%);
st := Text { text: root.t.status; color: root.t.status-farbe; font-size: 11px; font-weight: 700; }
}
}
if root.t.text != "": Text { text: root.t.text; color: Farbe.hell; font-size: 12px; wrap: word-wrap; }
Hauptknopf {
text: root.t.knopf;
laeuft: root.t.laeuft;
aktiv: root.t.knopf-aktiv;
geklickt => { root.knopf(); }
}
if root.t.meldung != "": Text {
text: root.t.meldung;
color: root.t.meldung-ok ? Farbe.gruen : Farbe.rot-hell;
font-size: 12px;
wrap: word-wrap;
}
}
}
// ---- Assistent: der Tipp je Tisch, groß (nur Spielgeldtische - die Ansicht reicht nichts anderes durch)
if root.t.assistent: Ueberschrift { text: "ASSISTENT · EMPFEHLUNG VOR DEM ZUG"; }
if root.t.assistent && root.tipps.length == 0: Text {
text: "Noch kein Tipp - er erscheint an deinem Zug (nur an Spielgeldtischen)";
color: Farbe.gedaempft;
font-size: 12px;
wrap: word-wrap;
}
if root.t.assistent: VerticalLayout {
spacing: 8px;
for tp in root.tipps: Karte {
VerticalLayout {
padding: 12px;
spacing: 4px;
HorizontalLayout {
spacing: 8px;
Text { text: tp.titel; color: Farbe.gedaempft; font-size: 12px; horizontal-stretch: 1; overflow: elide; }
Text { text: tp.karten; color: Farbe.hell; font-size: 12px; font-weight: 600; }
}
Text { text: tp.empfehlung; color: tp.farbe; font-size: 28px; font-weight: 800; }
Text { text: tp.quelle; color: Farbe.gedaempft; font-size: 11px; }
if tp.warum != "": Text { text: tp.warum; color: Farbe.hell; font-size: 13px; wrap: word-wrap; }
}
}
}
// ---- Sitzung -------------------------------------------------------------------------------
Ueberschrift { text: "SITZUNG"; }
HorizontalLayout {
spacing: 8px;
for k in root.kennzahlen: Karte {
horizontal-stretch: 1;
VerticalLayout {
padding: 10px;
spacing: 2px;
Text { text: k.titel; color: Farbe.gedaempft; font-size: 11px; }
Text { text: k.wert; color: k.farbe; font-size: 18px; font-weight: 700; }
}
}
}
if root.t.sitzung != "": Text { text: root.t.sitzung; color: Farbe.gedaempft; font-size: 12px; wrap: word-wrap; }
// ---- Einstellungen ------------------------------------------------------------------------
Ueberschrift { text: "EINSTELLUNGEN"; }
if root.t.laeuft: Text { text: "Änderungen gelten ab dem nächsten Start."; color: Farbe.gedaempft; font-size: 11px; }
Karte {
VerticalLayout {
padding: 12px;
spacing: 6px;
Text { text: "Format"; color: Farbe.text; font-size: 13px; }
Segmentschalter {
titel: root.t.format-titel;
farben: [Farbe.akzent, Farbe.akzent, Farbe.akzent, Farbe.akzent];
aktuell: root.t.format-index;
gewaehlt(i) => { root.eingabe(0, i, 0); }
}
if root.t.stake-da: Zeile {
titel: "Stake";
Auswahl {
width: 170px;
y: (parent.height - self.height) / 2;
optionen: root.t.stake-titel;
index: root.t.stake-index;
menue-breite: 170px;
gewaehlt(i) => { root.eingabe(1, i, 0); }
}
}
if !root.t.stake-da: Zeile {
titel: "Stake";
fuss: "Turnier: kein Stake, gerechnet wird mit ICM";
}
Zeile {
titel: "Gegner";
Auswahl {
width: 170px;
y: (parent.height - self.height) / 2;
optionen: root.t.gegner-titel;
index: root.t.gegner-index;
menue-breite: 170px;
gewaehlt(i) => { root.eingabe(2, i, 0); }
}
}
if root.t.je-sitz: VerticalLayout {
padding-left: 12px;
spacing: 4px;
for s[i] in root.sitze: Zeile {
titel: s.name;
Auswahl {
width: 150px;
y: (parent.height - self.height) / 2;
optionen: s.titel;
index: s.index;
gewaehlt(j) => { root.eingabe(3, i, j); }
}
}
}
Text { text: "Rückmeldung"; color: Farbe.text; font-size: 13px; }
Segmentschalter {
titel: root.t.rueck-titel;
farben: [Farbe.akzent, Farbe.akzent, Farbe.akzent];
aktuell: root.t.rueck-index;
gewaehlt(i) => { root.eingabe(4, i, 0); }
}
Zeile {
titel: "Schwelle";
fuss: "erst ab dieser Abweichung meldet der Coach";
Stepper {
text: root.t.schwelle;
auf-ok: root.t.schwelle-auf;
ab-ok: root.t.schwelle-ab;
auf => { root.eingabe(5, 0, 0); }
ab => { root.eingabe(6, 0, 0); }
}
}
Zeile {
titel: "Uhr des Clients";
fuss: root.t.uhr-client ? "" : "eigene Bedenkzeit je Zug";
Toggle {
an: root.t.uhr-client;
y: (parent.height - self.height) / 2;
umgeschaltet => { root.eingabe(7, root.t.uhr-client ? 0 : 1, 0); }
}
}
if !root.t.uhr-client: Zeile {
titel: "Bedenkzeit";
Stepper {
text: root.t.uhr;
auf-ok: root.t.uhr-auf;
ab-ok: root.t.uhr-ab;
auf => { root.eingabe(8, 0, 0); }
ab => { root.eingabe(9, 0, 0); }
}
}
Zeile {
titel: "Tische";
Stepper {
text: root.t.tische;
auf-ok: root.t.tische-auf;
ab-ok: root.t.tische-ab;
auf => { root.eingabe(10, 0, 0); }
ab => { root.eingabe(11, 0, 0); }
}
}
Text { text: "Hilfe vor dem Zug"; color: Farbe.text; font-size: 13px; }
Segmentschalter {
titel: root.t.hilfe-titel;
farben: [Farbe.akzent, Farbe.akzent, Farbe.teal];
aktuell: root.t.hilfe-index;
gewaehlt(i) => { root.eingabe(12, i, 0); }
}
Text {
text: "Lage: die Lage, nicht die Antwort. Empfehlung: der Assistent - nur an Spielgeldtischen, nie an Echtgeld.";
color: Farbe.gedaempft;
font-size: 11px;
wrap: word-wrap;
}
Zeile {
titel: "Stimme";
Toggle { an: root.t.stimme; y: (parent.height - self.height) / 2; umgeschaltet => { root.eingabe(13, 0, 0); } }
}
Text { text: "Ansagen (Tara)"; color: Farbe.text; font-size: 13px; }
Segmentschalter {
titel: root.t.ansagen-titel;
farben: [Farbe.akzent, Farbe.akzent, Farbe.akzent, Farbe.akzent];
aktuell: root.t.ansagen-index;
gewaehlt(i) => { root.eingabe(14, i, 0); }
}
Text {
text: root.t.stimme
? "Nach dem Zug: nur gemeldete Abweichungen. Vor dem Zug: die Lage - im Assistenten die Empfehlung. Ohne Zahlen."
: "Ansagen sprechen nur mit eingeschalteter Stimme.";
color: Farbe.gedaempft;
font-size: 11px;
wrap: word-wrap;
}
}
}
// ---- Abgleich ------------------------------------------------------------------------------
Ueberschrift { text: "ABGLEICH · DU GEGEN DEN KERN"; }
if root.haende.length == 0: Text {
text: root.t.leer != "" ? root.t.leer : "Noch keine Hand abgeglichen";
color: Farbe.gedaempft;
font-size: 12px;
}
for h in root.haende: Karte {
VerticalLayout {
padding: 10px;
spacing: 6px;
HorizontalLayout {
spacing: 8px;
Text { text: h.titel; color: Farbe.text; font-size: 13px; font-weight: 600; horizontal-stretch: 1; overflow: elide; }
Text { text: h.urteil; color: h.urteil-farbe; font-size: 12px; font-weight: 700; }
}
for z in h.zuege: HorizontalLayout {
spacing: 8px;
// gemeldete Abweichungen tragen links einen orangen Strich
Rectangle { width: 3px; border-radius: 1.5px; background: z.gemeldet ? #f0a030 : Farbe.linie; }
VerticalLayout {
horizontal-stretch: 1;
spacing: 2px;
HorizontalLayout {
spacing: 8px;
Text { text: z.zeile; color: Farbe.hell; font-size: 12px; horizontal-stretch: 1; wrap: word-wrap; }
Text { text: z.kosten; color: z.farbe; font-size: 12px; font-weight: 600; }
}
Text { text: z.quelle + (z.warum != "" ? ": " + z.warum : ""); color: Farbe.gedaempft; font-size: 11px; wrap: word-wrap; }
}
}
}
}
}