refactor: 开始翻新状态机

This commit is contained in:
2026-04-21 12:52:30 +08:00
parent e53e905e1b
commit fc70aa07f6
19 changed files with 111 additions and 135 deletions
@@ -2,7 +2,7 @@ import copy
import random
from typing import TypedDict
from textual.containers import Container
from textual.containers import Container, ScrollableContainer
from textual.message import Message
from textual.widget import Widget
from textual.widgets import Button, Label, Markdown
@@ -68,7 +68,7 @@ class ClozePuzzle(BasePuzzleWidget):
yield Label(self.puzzle.wording, id="sentence")
yield Markdown(f"> {self.listprint(self.inputlist)}", id="inputpreview")
# 渲染当前问题的选项
with Container(id="btn-container"):
with ScrollableContainer(id="btn-container"):
for i in self.ans:
h = str(hash(i))
self.hashmap[h] = i
+1 -1
View File
@@ -28,7 +28,7 @@ class Finished(Widget):
def compose(self):
yield Label("本次记忆进程结束", id="finished_msg")
yield Label(f"算法数据{'已保存' if self.is_saved else "未能保存"}")
yield Button("返回上一级", id="back-to-menu")
yield Button("返回上一级", flat=True, id="back-to-menu")
def on_button_pressed(self, event):
button_id = event.button.id
+1 -1
View File
@@ -75,7 +75,7 @@ class MCQPuzzle(BasePuzzleWidget):
yield Label(f"当前输入: {self.inputlist}", id="inputpreview")
# 渲染当前问题的选项
with Container(id="btn-container"):
with ScrollableContainer(id="btn-container"):
for i in current_options:
self.hashmap[str(hash(i))] = i
btnid = f"sel{str(self.cursor).zfill(3)}-{hash(i)}"