You've already forked HeurAMS-Legacy
51 lines
1.9 KiB
Python
51 lines
1.9 KiB
Python
from textual.widgets import (
|
|
Markdown,
|
|
Label,
|
|
Static,
|
|
Button,
|
|
)
|
|
from textual.containers import Container, Horizontal, Center
|
|
from textual.screen import Screen
|
|
from textual.widget import Widget
|
|
import heurams.kernel.particles as pt
|
|
import heurams.kernel.puzzles as pz
|
|
from .base_puzzle_widget import BasePuzzleWidget
|
|
|
|
class BasicEvaluation(BasePuzzleWidget):
|
|
def __init__(self, *children: Widget, atom: pt.Atom, name: str | None = None, id: str | None = None, classes: str | None = None, disabled: bool = False, markup: bool = True) -> None:
|
|
super().__init__(*children, atom = atom, name=name, id=id, classes=classes, disabled=disabled, markup=markup)
|
|
|
|
feedback_mapping = {
|
|
"feedback_5": 5,
|
|
"feedback_4": 4,
|
|
"feedback_3": 3,
|
|
"feedback_2": 2,
|
|
"feedback_1": 1,
|
|
"feedback_0": 0,
|
|
}
|
|
|
|
def compose(self):
|
|
yield Label(self.atom.register["nucleon"]["content"], id="main")
|
|
with Container(id="button_container"):
|
|
btn = {}
|
|
btn["5"] = Button(
|
|
"完美回想", variant="success", id="feedback_5", classes="choice"
|
|
)
|
|
btn["4"] = Button(
|
|
"犹豫后正确", variant="success", id="feedback_4", classes="choice"
|
|
)
|
|
btn["3"] = Button(
|
|
"困难地正确", variant="warning", id="feedback_3", classes="choice"
|
|
)
|
|
btn["2"] = Button(
|
|
"错误但熟悉", variant="warning", id="feedback_2", classes="choice"
|
|
)
|
|
btn["1"] = Button(
|
|
"错误且不熟", variant="error", id="feedback_1", classes="choice"
|
|
)
|
|
btn["0"] = Button(
|
|
"完全空白", variant="error", id="feedback_0", classes="choice"
|
|
)
|
|
yield Horizontal(btn["5"], btn["4"])
|
|
yield Horizontal(btn["3"], btn["2"])
|
|
yield Horizontal(btn["1"], btn["0"]) |