fix: 改进

This commit is contained in:
2025-12-06 13:51:46 +08:00
parent 07d23bd268
commit c98f3a4418
8 changed files with 24 additions and 12 deletions

View File

@@ -1,2 +1 @@
print("Hello from HeurAMS Program :)") print("Hello from HeurAMS Program :)")

View File

@@ -22,7 +22,7 @@ max_riddles_num = 2
[puzzles.cloze] [puzzles.cloze]
min_denominator = 3 min_denominator = 3
[paths] # 相对于配置文件的 ".." (即工作目录) 而言 或绝对路径 [paths] # 相对于工作目录而言 或绝对路径
nucleon_dir = "./data/nucleon" nucleon_dir = "./data/nucleon"
electron_dir = "./data/electron" electron_dir = "./data/electron"
orbital_dir = "./data/orbital" orbital_dir = "./data/orbital"

View File

@@ -1,3 +1,4 @@
import heurams.context as cxt
from textual.app import App, ComposeResult from textual.app import App, ComposeResult
from textual.widgets import Button, Header, Label, Footer from textual.widgets import Button, Header, Label, Footer
from .screens.dashboard import DashboardScreen from .screens.dashboard import DashboardScreen
@@ -12,7 +13,7 @@ class HeurAMSApp(App):
BINDINGS = [("q", "quit", "退出"), BINDINGS = [("q", "quit", "退出"),
("d", "toggle_dark", "改变色调"), ("d", "toggle_dark", "改变色调"),
("1", "app.push_screen('dashboard')", "仪表盘"), ("1", "app.push_screen('dashboard')", "仪表盘"),
("2", "app.push_screen('precache_all')", "缓存管理"), ("2", "app.push_screen('precache_all')", "缓存管理"),
("3", "app.push_screen('nucleon_creator')", "创建新单元"), ("3", "app.push_screen('nucleon_creator')", "创建新单元"),
] ]
SCREENS = { SCREENS = {
@@ -28,7 +29,15 @@ class HeurAMSApp(App):
self.exit(event.button.id) self.exit(event.button.id)
def environment_check(): def environment_check():
from heurams.context import working_var from pathlib import Path
for i in cxt.config_var.get()["paths"].values():
i = Path(i)
if not i.exists():
print(f"创建 {i}")
i.mkdir(exist_ok = True, parents = True)
else:
print(f"找到 {i}")
environment_check()
app = HeurAMSApp() app = HeurAMSApp()
app.run() app.run()

View File

@@ -25,7 +25,8 @@ class AboutScreen(Screen):
with Container(id="about_container"): with Container(id="about_container"):
yield Label("关于 '潜进' 启发式先进记忆调度器", classes="title-label") yield Label("关于 '潜进' 启发式先进记忆调度器", classes="title-label")
yield Static(f"\n版本: {version.ver} {version.codename.capitalize()}") yield Static(f"\n版本: {version.ver} {version.codename.capitalize()}")
yield Static(f"开发者名单: Wang Zhiyu") # TODO: 取消硬编码, 和 git/vcs 集成 yield Static(f"开发者名单:") # TODO: 取消硬编码, 和 git/vcs 集成
yield Static(f"@pluvium27 (Wang Zhiyu)") # TODO: 取消硬编码, 和 git/vcs 集成
yield Static(f"Copyright 2025") yield Static(f"Copyright 2025")
yield Static("\n") yield Static("\n")

View File

@@ -18,13 +18,15 @@ import heurams.services.version as version
import heurams.services.timer as timer import heurams.services.timer as timer
from .preparation import PreparationScreen from .preparation import PreparationScreen
import pathlib
class DashboardScreen(Screen): class DashboardScreen(Screen):
def compose(self) -> ComposeResult: def compose(self) -> ComposeResult:
yield Header(show_clock=True) yield Header(show_clock=True)
yield Container( yield Container(
Label(f'欢迎使用 "潜进" 启发式先进记忆调度器', classes="title-label"), Label(f'欢迎使用 "潜进" 启发式先进记忆调度器', classes="title-label"),
Label(f"当前 UNIX 日时间戳: {timer.get_daystamp()}"), Label(f"当前 UNIX 日时间戳: {timer.get_daystamp()}"),
Label(f'时区修正: UTC+{config_var.get()["timezone_offset"] / 3600}'), Label(f'时区修正: UTC+{config_var.get()["timezone_offset"] / 3600}'),
Label("选择待学习或待修改的记忆单元集:", classes="title-label"), Label("选择待学习或待修改的记忆单元集:", classes="title-label"),
ListView(id="union-list", classes="union-list-view"), ListView(id="union-list", classes="union-list-view"),

View File

@@ -22,12 +22,14 @@ class MemScreen(Screen):
("d", "toggle_dark", "改变色调"), ("d", "toggle_dark", "改变色调"),
("v", "play_voice", "朗读"), ("v", "play_voice", "朗读"),
] ]
if config_var.get()["quick_pass"]: if config_var.get()["quick_pass"]:
BINDINGS.append(("k", "quick_pass", "跳过")) BINDINGS.append(("k", "quick_pass", "跳过"))
def __init__(self, atoms: list): def __init__(self, atoms: list, name: str | None = None, id: str | None = None, classes: str | None = None) -> None:
super().__init__(name=None, id=None, classes=None) super().__init__(name, id, classes)
self.atoms = atoms self.atoms = atoms
#print(atoms)
self.phaser = Phaser(atoms) self.phaser = Phaser(atoms)
self.procession: Procession = self.phaser.current_procession() # type: ignore self.procession: Procession = self.phaser.current_procession() # type: ignore

View File

@@ -21,7 +21,6 @@ class RecognitionConfig(TypedDict):
top_dim: List[str] top_dim: List[str]
class Recognition(BasePuzzleWidget): class Recognition(BasePuzzleWidget):
def __init__(self, *children: Widget, atom: pt.Atom, alia: str = "", name: str | None = None, id: str | None = None, classes: str | None = None, disabled: bool = False, markup: bool = True) -> None: def __init__(self, *children: Widget, atom: pt.Atom, alia: str = "", name: str | None = None, id: str | None = None, classes: str | None = None, disabled: bool = False, markup: bool = True) -> None:
super().__init__(*children, atom=atom, name=name, id=id, classes=classes, disabled=disabled, markup=markup) super().__init__(*children, atom=atom, name=name, id=id, classes=classes, disabled=disabled, markup=markup)
if alia == "": if alia == "":