style: 格式化代码
This commit is contained in:
@@ -4,15 +4,8 @@ import pathlib
|
||||
from textual.app import ComposeResult
|
||||
from textual.containers import ScrollableContainer
|
||||
from textual.screen import Screen
|
||||
from textual.widgets import (
|
||||
Button,
|
||||
Footer,
|
||||
Header,
|
||||
Label,
|
||||
ListItem,
|
||||
ListView,
|
||||
Static,
|
||||
)
|
||||
from textual.widgets import (Button, Footer, Header, Label, ListItem, ListView,
|
||||
Static)
|
||||
|
||||
import heurams.services.timer as timer
|
||||
import heurams.services.version as version
|
||||
@@ -54,7 +47,7 @@ class DashboardScreen(Screen):
|
||||
ListView(id="union-list", classes="union-list-view"),
|
||||
Label(
|
||||
f'"潜进" 启发式辅助记忆调度器 | 版本 {version.ver} '
|
||||
f'{version.codename.capitalize()} 2025'
|
||||
f"{version.codename.capitalize()} 2025"
|
||||
),
|
||||
)
|
||||
yield Footer()
|
||||
@@ -113,7 +106,7 @@ class DashboardScreen(Screen):
|
||||
|
||||
# 更新状态
|
||||
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"
|
||||
@@ -157,9 +150,7 @@ class DashboardScreen(Screen):
|
||||
|
||||
for file in nucleon_files:
|
||||
text = self.texts[file]
|
||||
list_item = ListItem(
|
||||
Label(f"{text[0]}\n{text[1]}")
|
||||
)
|
||||
list_item = ListItem(Label(f"{text[0]}\n{text[1]}"))
|
||||
union_list_widget.append(list_item)
|
||||
|
||||
if not self.stay_enabled[file]:
|
||||
@@ -177,21 +168,19 @@ class DashboardScreen(Screen):
|
||||
return
|
||||
|
||||
# 提取文件名
|
||||
selected_filename = pathlib.Path(
|
||||
label_text.partition("\0")[0].replace("*", "")
|
||||
)
|
||||
selected_filename = pathlib.Path(label_text.partition("\0")[0].replace("*", ""))
|
||||
|
||||
# 构建文件路径
|
||||
nucleon_dir = config_var.get()["paths"]["nucleon_dir"]
|
||||
electron_dir = config_var.get()["paths"]["electron_dir"]
|
||||
|
||||
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(
|
||||
PreparationScreen(nucleon_file_path, electron_file_path)
|
||||
)
|
||||
self.app.push_screen(PreparationScreen(nucleon_file_path, electron_file_path))
|
||||
|
||||
def on_button_pressed(self, event) -> None:
|
||||
"""处理按钮点击事件"""
|
||||
@@ -199,11 +188,13 @@ class DashboardScreen(Screen):
|
||||
|
||||
if button_id == "new_nucleon_button":
|
||||
from .nucreator import NucleonCreatorScreen
|
||||
|
||||
new_screen = NucleonCreatorScreen()
|
||||
self.app.push_screen(new_screen)
|
||||
|
||||
elif button_id == "precache_all_button":
|
||||
from .precache import PrecachingScreen
|
||||
|
||||
precache_screen = PrecachingScreen()
|
||||
self.app.push_screen(precache_screen)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user