diff --git a/src/heurams/__init__.py b/src/heurams/__init__.py index b9464d6..43fca4d 100644 --- a/src/heurams/__init__.py +++ b/src/heurams/__init__.py @@ -1,2 +1 @@ print("Hello from HeurAMS Program :)") - diff --git a/src/heurams/default/config/config.toml b/src/heurams/default/config/config.toml index f44ff80..5a7938d 100644 --- a/src/heurams/default/config/config.toml +++ b/src/heurams/default/config/config.toml @@ -22,7 +22,7 @@ max_riddles_num = 2 [puzzles.cloze] min_denominator = 3 -[paths] # 相对于配置文件的 ".." (即工作目录) 而言 或绝对路径 +[paths] # 相对于工作目录而言 或绝对路径 nucleon_dir = "./data/nucleon" electron_dir = "./data/electron" orbital_dir = "./data/orbital" diff --git a/src/heurams/interface/__main__.py b/src/heurams/interface/__main__.py index d55637b..56bdfe8 100644 --- a/src/heurams/interface/__main__.py +++ b/src/heurams/interface/__main__.py @@ -1,3 +1,4 @@ +import heurams.context as cxt from textual.app import App, ComposeResult from textual.widgets import Button, Header, Label, Footer from .screens.dashboard import DashboardScreen @@ -12,7 +13,7 @@ class HeurAMSApp(App): BINDINGS = [("q", "quit", "退出"), ("d", "toggle_dark", "改变色调"), ("1", "app.push_screen('dashboard')", "仪表盘"), - ("2", "app.push_screen('precache_all')", "缓存管理"), + ("2", "app.push_screen('precache_all')", "缓存管理器"), ("3", "app.push_screen('nucleon_creator')", "创建新单元"), ] SCREENS = { @@ -28,7 +29,15 @@ class HeurAMSApp(App): self.exit(event.button.id) 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.run() diff --git a/src/heurams/interface/screens/about.py b/src/heurams/interface/screens/about.py index 07eff3b..7487326 100644 --- a/src/heurams/interface/screens/about.py +++ b/src/heurams/interface/screens/about.py @@ -25,7 +25,8 @@ class AboutScreen(Screen): with Container(id="about_container"): yield Label("关于 '潜进' 启发式先进记忆调度器", classes="title-label") 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("\n") @@ -42,7 +43,7 @@ class AboutScreen(Screen): ## 参与贡献 -我们是一个年轻且包容的社区, 由技术人员, 设计师, 文书工作者, 以及创意人员共同构成, +我们是一个年轻且包容的社区, 由技术人员, 设计师, 文书工作者, 以及创意人员共同构成, 通过我们协力开发的软件为所有人谋取福祉. diff --git a/src/heurams/interface/screens/dashboard.py b/src/heurams/interface/screens/dashboard.py index e3ffe7e..310aaf5 100644 --- a/src/heurams/interface/screens/dashboard.py +++ b/src/heurams/interface/screens/dashboard.py @@ -18,13 +18,15 @@ import heurams.services.version as version import heurams.services.timer as timer from .preparation import PreparationScreen +import pathlib + class DashboardScreen(Screen): def compose(self) -> ComposeResult: yield Header(show_clock=True) yield Container( 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("选择待学习或待修改的记忆单元集:", classes="title-label"), ListView(id="union-list", classes="union-list-view"), @@ -91,4 +93,4 @@ class DashboardScreen(Screen): self.app.push_screen(precache_screen) def action_quit_app(self) -> None: - self.app.exit() \ No newline at end of file + self.app.exit() diff --git a/src/heurams/interface/screens/memorizor.py b/src/heurams/interface/screens/memorizor.py index bf7ded1..4093a11 100644 --- a/src/heurams/interface/screens/memorizor.py +++ b/src/heurams/interface/screens/memorizor.py @@ -22,12 +22,14 @@ class MemScreen(Screen): ("d", "toggle_dark", "改变色调"), ("v", "play_voice", "朗读"), ] + if config_var.get()["quick_pass"]: BINDINGS.append(("k", "quick_pass", "跳过")) - def __init__(self, atoms: list): - super().__init__(name=None, id=None, classes=None) + def __init__(self, atoms: list, name: str | None = None, id: str | None = None, classes: str | None = None) -> None: + super().__init__(name, id, classes) self.atoms = atoms + #print(atoms) self.phaser = Phaser(atoms) self.procession: Procession = self.phaser.current_procession() # type: ignore diff --git a/src/heurams/interface/shim.py b/src/heurams/interface/shim.py index e663b8f..651f8df 100644 --- a/src/heurams/interface/shim.py +++ b/src/heurams/interface/shim.py @@ -21,4 +21,4 @@ puzzle2widget = { pz.ClozePuzzle: pzw.ClozePuzzle, pz.MCQPuzzle: pzw.MCQPuzzle, pz.BasePuzzle: pzw.BasePuzzleWidget, -} +} \ No newline at end of file diff --git a/src/heurams/interface/widgets/recognition.py b/src/heurams/interface/widgets/recognition.py index 5a970ab..b3f0064 100644 --- a/src/heurams/interface/widgets/recognition.py +++ b/src/heurams/interface/widgets/recognition.py @@ -21,7 +21,6 @@ class RecognitionConfig(TypedDict): top_dim: List[str] 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: super().__init__(*children, atom=atom, name=name, id=id, classes=classes, disabled=disabled, markup=markup) if alia == "":