Archived
0
0
This commit is contained in:
2025-12-16 21:28:53 +08:00
parent 11d130c3fd
commit 1e534e5fe5
37 changed files with 428 additions and 207 deletions

View File

@@ -14,6 +14,7 @@ from heurams.services.logger import get_logger
logger = get_logger(__name__)
class Setting(TypedDict):
__origin__: str
__hint__: str
@@ -49,6 +50,7 @@ class MCQPuzzle(BasePuzzleWidget):
self.alia = alia
self.hashmap = dict()
self.cursor = 0
self.atom = atom
self._load()
def _load(self):
@@ -79,7 +81,7 @@ class MCQPuzzle(BasePuzzleWidget):
yield Button("退格", id="delete")
def update_display(self, error = 0):
def update_display(self, error=0):
# 更新预览标签
preview = self.query_one("#inputpreview")
preview.update(f"当前输入: {self.inputlist}") # type: ignore
@@ -113,7 +115,7 @@ class MCQPuzzle(BasePuzzleWidget):
rating = 4 if is_correct else 2
self.screen.rating = rating # type: ignore
self.handler(rating)
# 重置输入(如果回答错误)
if not is_correct:
self.inputlist = []
@@ -138,7 +140,7 @@ class MCQPuzzle(BasePuzzleWidget):
for button in buttons_to_remove:
logger.info(button)
container.remove_children("#"+button.id) # type: ignore
container.remove_children("#" + button.id) # type: ignore
# 添加当前题目的选项按钮
current_question_index = len(self.inputlist)
@@ -150,3 +152,10 @@ class MCQPuzzle(BasePuzzleWidget):
self.hashmap[button_id] = option
new_button = Button(option, id=button_id)
container.mount(new_button)
def handler(self, rating):
if self.atom.lock():
pass
else:
self.atom.minimize(rating)