This commit is contained in:
2025-11-05 00:17:12 +08:00
parent 4eaff18685
commit b63813f84d
8 changed files with 70 additions and 66 deletions

View File

@@ -14,6 +14,9 @@ from textual.screen import Screen
from heurams.kernel.particles import *
from heurams.context import *
import heurams.services.version as version
import heurams.services.timer as timer
from .preparation import PreparationScreen
class DashboardScreen(Screen):
@@ -21,16 +24,17 @@ class DashboardScreen(Screen):
yield Header(show_clock=True)
yield Container(
Label(f'欢迎使用 "潜进" 启发式辅助记忆调度器', classes="title-label"),
Label(f"当前的 UNIX 日时间戳: 0"),
Label(f'包含时间戳修正: UTC+0'),
Label(f"当前的 UNIX 日时间戳: {timer.get_daystamp()}"),
Label(f'时区修正: UTC+{config_var.get()["timezone_offset"] / 3600}'),
Label("选择待学习或待修改的记忆单元集:", classes="title-label"),
ListView(id="union-list", classes="union-list-view"),
Label(f'"潜进" 开放源代码软件项目 | 版本 0.0.1 | Wang Zhiyu 2025'),
Label(f'"潜进" 开放源代码软件项目 | 版本 {version.ver} {version.codename.capitalize()} | Wang Zhiyu 2025'),
)
yield Footer()
def item_desc_generator(self, path) -> dict:
res = dict()
path = pathlib.Path(path)
res[0] = f"{path.name}\0"
res[1] = f""
res[1] = " 尚未激活"
@@ -60,16 +64,17 @@ class DashboardScreen(Screen):
if "未找到任何 .toml 文件" in str(selected_label.renderable):
return
selected_filename = str(selected_label.renderable).partition('\0')[0].replace('*', "")
# 这里需要导入相应的文件处理逻辑
# nucleon_file = pt.NucleonUnion(pathlib.Path("./nucleon") / selected_filename)
# electron_file_path = pathlib.Path("./electron") / selected_filename
# if electron_file_path.exists():
# pass
# else:
# electron_file_path.touch()
# electron_file = pt.ElectronUnion(pathlib.Path("./electron") / selected_filename)
# self.app.push_screen(PreparationScreen(nucleon_file, electron_file))
selected_filename = pathlib.Path(str(selected_label.renderable).partition('\0')[0].replace('*', ""))
nucleon_file_path = pathlib.Path(config_var.get()["paths"]["nucleon_dir"]) / selected_filename
electron_file_path = pathlib.Path(config_var.get()["paths"]["electron_dir"]) / (str(selected_filename.stem) + ".json")
if electron_file_path.exists():
pass
else:
electron_file_path.touch()
with open(electron_file_path, 'w') as f:
f.write("{}")
self.app.push_screen(PreparationScreen(nucleon_file_path, electron_file_path))
def on_button_pressed(self, event) -> None:
if event.button.id == "new_nucleon_button":