style: 格式化代码

This commit is contained in:
2025-12-21 23:44:13 +08:00
parent 87cefedb61
commit b5f30ec4ee

View File

@@ -4,15 +4,8 @@ import pathlib
from textual.app import ComposeResult from textual.app import ComposeResult
from textual.containers import ScrollableContainer from textual.containers import ScrollableContainer
from textual.screen import Screen from textual.screen import Screen
from textual.widgets import ( from textual.widgets import (Button, Footer, Header, Label, ListItem, ListView,
Button, Static)
Footer,
Header,
Label,
ListItem,
ListView,
Static,
)
import heurams.services.timer as timer import heurams.services.timer as timer
import heurams.services.version as version import heurams.services.version as version
@@ -54,7 +47,7 @@ class DashboardScreen(Screen):
ListView(id="union-list", classes="union-list-view"), ListView(id="union-list", classes="union-list-view"),
Label( Label(
f'"潜进" 启发式辅助记忆调度器 | 版本 {version.ver} ' f'"潜进" 启发式辅助记忆调度器 | 版本 {version.ver} '
f'{version.codename.capitalize()} 2025' f"{version.codename.capitalize()} 2025"
), ),
) )
yield Footer() yield Footer()
@@ -113,7 +106,7 @@ class DashboardScreen(Screen):
# 更新状态 # 更新状态
self.nextdates[filename] = nextdate self.nextdates[filename] = nextdate
self.stay_enabled[filename] = (is_due or is_more) self.stay_enabled[filename] = is_due or is_more
# 构建返回结果 # 构建返回结果
result[0] = f"{filename}\0" result[0] = f"{filename}\0"
@@ -157,9 +150,7 @@ class DashboardScreen(Screen):
for file in nucleon_files: for file in nucleon_files:
text = self.texts[file] text = self.texts[file]
list_item = ListItem( list_item = ListItem(Label(f"{text[0]}\n{text[1]}"))
Label(f"{text[0]}\n{text[1]}")
)
union_list_widget.append(list_item) union_list_widget.append(list_item)
if not self.stay_enabled[file]: if not self.stay_enabled[file]:
@@ -177,21 +168,19 @@ class DashboardScreen(Screen):
return return
# 提取文件名 # 提取文件名
selected_filename = pathlib.Path( selected_filename = pathlib.Path(label_text.partition("\0")[0].replace("*", ""))
label_text.partition("\0")[0].replace("*", "")
)
# 构建文件路径 # 构建文件路径
nucleon_dir = config_var.get()["paths"]["nucleon_dir"] nucleon_dir = config_var.get()["paths"]["nucleon_dir"]
electron_dir = config_var.get()["paths"]["electron_dir"] electron_dir = config_var.get()["paths"]["electron_dir"]
nucleon_file_path = pathlib.Path(nucleon_dir) / selected_filename nucleon_file_path = pathlib.Path(nucleon_dir) / selected_filename
electron_file_path = pathlib.Path(electron_dir) / f"{selected_filename.stem}.json" electron_file_path = (
pathlib.Path(electron_dir) / f"{selected_filename.stem}.json"
)
# 跳转到准备屏幕 # 跳转到准备屏幕
self.app.push_screen( self.app.push_screen(PreparationScreen(nucleon_file_path, electron_file_path))
PreparationScreen(nucleon_file_path, electron_file_path)
)
def on_button_pressed(self, event) -> None: def on_button_pressed(self, event) -> None:
"""处理按钮点击事件""" """处理按钮点击事件"""
@@ -199,11 +188,13 @@ class DashboardScreen(Screen):
if button_id == "new_nucleon_button": if button_id == "new_nucleon_button":
from .nucreator import NucleonCreatorScreen from .nucreator import NucleonCreatorScreen
new_screen = NucleonCreatorScreen() new_screen = NucleonCreatorScreen()
self.app.push_screen(new_screen) self.app.push_screen(new_screen)
elif button_id == "precache_all_button": elif button_id == "precache_all_button":
from .precache import PrecachingScreen from .precache import PrecachingScreen
precache_screen = PrecachingScreen() precache_screen = PrecachingScreen()
self.app.push_screen(precache_screen) self.app.push_screen(precache_screen)