改进
This commit is contained in:
7
src/heurams/interface/widgets/__init__.py
Normal file
7
src/heurams/interface/widgets/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from .base_puzzle_widget import BasePuzzleWidget
|
||||
from .basic_puzzle import BasicEvaluation
|
||||
from .cloze_puzzle import ClozePuzzle
|
||||
from .finished import Finished
|
||||
from .mcq_puzzle import MCQPuzzle
|
||||
from .placeholder import Placeholder
|
||||
from .recognition import Recognition
|
||||
@@ -22,7 +22,7 @@ import copy
|
||||
import random
|
||||
from .. import shim
|
||||
|
||||
class DrawCard(BasePuzzleWidget):
|
||||
class MCQPuzzle(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)
|
||||
self.inputlist = []
|
||||
|
||||
@@ -30,9 +30,9 @@ class Recognition(BasePuzzleWidget):
|
||||
|
||||
def compose(self):
|
||||
with Center():
|
||||
yield Static(f"[dim]{self.atom[1]['translation']}[/]")
|
||||
yield Static(f"[dim]{self.atom.register['nucleon']['translation']}[/]")
|
||||
yield Label(f"")
|
||||
s = str(self.atom[1]["content"])
|
||||
s = str(self.atom.register['nucleon']["content"])
|
||||
replace_dict = {
|
||||
", ": ",",
|
||||
". ": ".",
|
||||
@@ -53,15 +53,16 @@ class Recognition(BasePuzzleWidget):
|
||||
f"[b][b]{i.replace('/', ' ')}[/][/]",
|
||||
id="sentence" + str(hash(i)),
|
||||
)
|
||||
for i in self.atom[2]["testdata"]["additional_inf"]:
|
||||
if self.atom[1][i]:
|
||||
if isinstance(self.atom[1][i], list):
|
||||
for j in self.atom[1][i]:
|
||||
yield Markdown(f"### {self.atom[2]['keydata'][i]}: {j}")
|
||||
# 处理orbital/展示配置
|
||||
for i in self.atom.register["orbital"] ["testdata"]["additional_inf"]:
|
||||
if self.atom.register['nucleon'][i]:
|
||||
if isinstance(self.atom.register['nucleon'][i], list):
|
||||
for j in self.atom.register['nucleon'][i]:
|
||||
yield Markdown(f"### {self.atom.register["orbital"] ['keydata'][i]}: {j}")
|
||||
continue
|
||||
if isinstance(self.atom[1][i], Dict):
|
||||
if isinstance(self.atom.register['nucleon'][i], Dict):
|
||||
t = ""
|
||||
for j, k in self.atom[1][i].items(): # type: ignore
|
||||
for j, k in self.atom.register['nucleon'][i].items(): # type: ignore
|
||||
t += f"> **{j}**: {k} \n"
|
||||
yield Markdown(t, id="tran")
|
||||
with Center():
|
||||
|
||||
Reference in New Issue
Block a user