style: 代码格式化

This commit is contained in:
2026-04-23 00:13:57 +08:00
parent 1c05f42b61
commit 5b7b4ba443
23 changed files with 144 additions and 104 deletions

View File

@@ -79,14 +79,14 @@ class ClozePuzzle(BasePuzzleWidget):
self.hashmap[h] = i
btnid = f"sel000-{h}"
logger.debug(f"建立按钮 {btnid}")
self.btn_shortcuts[f'{c}'] = btnid
yield Button(f'[{c}] {i}', id=f"{btnid}")
self.btn_shortcuts[f"{c}"] = btnid
yield Button(f"[{c}] {i}", id=f"{btnid}")
s.focus()
yield Button("退格", id="delete")
self.btn_shortcuts[f'0'] = 'delete'
self.btn_shortcuts[f'backspace'] = 'delete'
self.btn_shortcuts[f'delete'] = 'delete'
self.btn_shortcuts[f"0"] = "delete"
self.btn_shortcuts[f"backspace"] = "delete"
self.btn_shortcuts[f"delete"] = "delete"
def listprint(self, lst):
s = ""
@@ -128,10 +128,10 @@ class ClozePuzzle(BasePuzzleWidget):
pass
else:
self.atom.minimize(rating)
def on_key(self, event: Key) -> None:
self.notify(event.key)
if event.key in self.btn_shortcuts:
btn_id = self.btn_shortcuts.get(event.key)
btn_id = '#' + btn_id
btn_id = "#" + btn_id
self.query_one(btn_id, Button).press()