style: 格式化代码

This commit is contained in:
2026-05-07 19:48:07 +08:00
parent fcda88488b
commit 048e74ad7f
19 changed files with 164 additions and 132 deletions

View File

@@ -7,6 +7,7 @@ import pickle
logger = get_logger(__name__)
def start_debug_server(app):
logger = get_logger("zmq_debug")
context = zmq.Context()

View File

@@ -16,7 +16,6 @@ from textual.widgets import (
Label,
ListItem,
ListView,
Markdown,
Static,
)
@@ -117,7 +116,13 @@ class FavoriteManagerScreen(Screen):
# 创建列表项, 包含移除按钮
container = Horizontal(
Label(display_text, classes="favorite-content"),
Button("移除", id=f"remove-{button_key}", variant="error", flat=True, classes="favorite-item-btn"),
Button(
"移除",
id=f"remove-{button_key}",
variant="error",
flat=True,
classes="favorite-item-btn",
),
classes="favorite-item",
)
return ListItem(container)

View File

@@ -140,7 +140,11 @@ class MemScreen(Screen):
if config_var.get()["interface"]["global"]["persist_to_file"]:
self.repo.persist_to_repodir()
container.mount(Finished(is_saved=config_var.get()["interface"]["global"]["persist_to_file"]))
container.mount(
Finished(
is_saved=config_var.get()["interface"]["global"]["persist_to_file"]
)
)
def on_button_pressed(self, event):
event.stop()
@@ -162,6 +166,7 @@ class MemScreen(Screen):
play_by_path(path)
else:
from heurams.services.tts_service import convertor
convertor(self.atom.registry["nucleon"]["tts_text"], path)
play_by_path(path)
@@ -224,6 +229,7 @@ class MemScreen(Screen):
def action_go_back_notif(self):
self.notify("确定吗? 按下大写 Q 以返回")
def action_go_back(self):
self.app.pop_screen()

View File

@@ -81,10 +81,10 @@ class ClozePuzzle(BasePuzzleWidget):
btnid = f"sel000-{h}"
logger.debug(f"建立按钮 {btnid}")
self.btn_shortcuts[f"{c}"] = btnid
btns.append(Button(f"{i}", id=f"{btnid}", classes='cloze-option-btn'))
for i in range((len(btns)+1)//2):
btns.append(Button(f"{i}", id=f"{btnid}", classes="cloze-option-btn"))
for i in range((len(btns) + 1) // 2):
if 2 * i + 1 + 1 <= len(btns):
yield Horizontal(btns[i], btns[len(btns) - 1 - i], classes='hori')
yield Horizontal(btns[i], btns[len(btns) - 1 - i], classes="hori")
else:
yield btns[i]
s.focus()
@@ -136,7 +136,7 @@ class ClozePuzzle(BasePuzzleWidget):
self.atom.minimize(rating)
def on_key(self, event: Key) -> None:
#self.notify(event.key)
# self.notify(event.key)
if event.key in self.btn_shortcuts:
btn_id = self.btn_shortcuts.get(event.key)
btn_id = "#" + btn_id