feat: 代码格式化, 改进仪表盘, 新增多CSS支持

This commit is contained in:
2026-04-20 16:30:04 +08:00
parent 845a505ca1
commit 65fbdec0a9
43 changed files with 551 additions and 349 deletions
@@ -15,7 +15,7 @@ class BasePuzzleWidget(Widget):
id: str | None = None,
classes: str | None = None,
disabled: bool = False,
markup: bool = True
markup: bool = True,
) -> None:
super().__init__(
*children,
@@ -23,7 +23,7 @@ class BasePuzzleWidget(Widget):
id=id,
classes=classes,
disabled=disabled,
markup=markup
markup=markup,
)
self.atom = atom
@@ -83,7 +83,7 @@ class ClozePuzzle(BasePuzzleWidget):
if lst:
lastone = lst[-1]
for i in lst[:-1]:
s += (i + ' ')
s += i + " "
s += f" `{lastone}`"
return s
+2 -2
View File
@@ -55,8 +55,8 @@ class MCQPuzzle(BasePuzzleWidget):
def _load(self):
cfg = self.atom.registry["nucleon"]["puzzles"][self.alia]
if cfg['mapping'] == {}:
self.screen.rating = 5 # type: ignore
if cfg["mapping"] == {}:
self.screen.rating = 5 # type: ignore
self.puzzle = pz.MCQPuzzle(
cfg["mapping"], cfg["jammer"], int(cfg["max_riddles_num"]), cfg["prefix"]
)
+2 -2
View File
@@ -11,7 +11,7 @@ class Placeholder(Widget):
id: str | None = None,
classes: str | None = None,
disabled: bool = False,
markup: bool = True
markup: bool = True,
) -> None:
super().__init__(
*children,
@@ -19,7 +19,7 @@ class Placeholder(Widget):
id=id,
classes=classes,
disabled=disabled,
markup=markup
markup=markup,
)
def compose(self):
+2 -2
View File
@@ -67,7 +67,7 @@ class Recognition(BasePuzzleWidget):
f";{delim}": ";",
f":{delim}": ":",
}
primary = cfg["primary"]
with Center():
@@ -88,7 +88,7 @@ class Recognition(BasePuzzleWidget):
for item in cfg["secondary"]:
if isinstance(item, list):
for j in item:
yield Markdown(f"### 笔记: {j}") #TODO ANNOTATION
yield Markdown(f"### 笔记: {j}") # TODO ANNOTATION
continue
if isinstance(item, Dict):
total = ""