diff --git a/AGENTS.md b/AGENTS.md index 618d65f..46cc8aa 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -58,17 +58,6 @@ python -m heurams.interface heurams # (if console scripts are configured) ``` -### Testing -```bash -# Run tests (if test suite exists) -pytest - -# Run with coverage -pytest --cov=heurams -``` - -**Note**: The test directory appears to have been removed. Previous test files were located in `tests/` (deleted per git status). If adding new tests, follow pytest conventions and place them in a `tests/` directory at the project root. - ### Linting and Formatting No specific linting or formatting configuration observed. Use standard Python conventions. @@ -131,23 +120,6 @@ No specific linting or formatting configuration observed. Use standard Python co - Service abstraction with provider pattern (audio, TTS, LLM) - Configuration-driven behavior with fallback defaults -## Testing Approach - -**Current State**: Test directory removed, but `.pytest_cache` indicates pytest was used. - -**If adding tests**: -- Place tests in `tests/` directory at project root -- Follow pytest conventions -- Use `pytest.fixture` for shared test resources -- Mock external dependencies (audio, TTS, LLM providers) -- Test configuration overrides via `ConfigContext` - -**Testable Components**: -- Algorithm implementations (FSRS, SM2) -- Puzzle logic validation -- Configuration loading and saving -- Atom persistence and evaluation - ## Important Gotchas ### Configuration Loading diff --git a/src/heurams/interface/__main__.py b/src/heurams/interface/__main__.py index 7786546..fd14a4a 100644 --- a/src/heurams/interface/__main__.py +++ b/src/heurams/interface/__main__.py @@ -11,7 +11,7 @@ logger = get_logger(__name__) class HeurAMSApp(App): TITLE = "潜进" - # CSS_PATH = str(cxt.rootdir / "interface" / "css" / "main.css") + CSS_PATH = "css/main.tcss" SUB_TITLE = "启发式先进记忆调度器" BINDINGS = [ ("q", "quit", "退出"), diff --git a/src/heurams/interface/css/main.tcss b/src/heurams/interface/css/main.tcss new file mode 100644 index 0000000..e69de29 diff --git a/src/heurams/interface/screens/about.py b/src/heurams/interface/screens/about.py index 24a40a3..7d3c75b 100644 --- a/src/heurams/interface/screens/about.py +++ b/src/heurams/interface/screens/about.py @@ -8,7 +8,7 @@ from textual.widgets import ( Button, Markdown, ) -from textual.containers import Container +from textual.containers import ScrollableContainer, ScrollableContainer from textual.screen import Screen import heurams.services.version as version @@ -19,7 +19,7 @@ class AboutScreen(Screen): def compose(self) -> ComposeResult: yield Header(show_clock=True) - with Container(id="about_container"): + with ScrollableContainer(id="about_container"): yield Label("[b]关于与版本信息[/b]") about_text = f""" # 关于 "潜进" diff --git a/src/heurams/interface/screens/dashboard.py b/src/heurams/interface/screens/dashboard.py index e9955f5..5a9b5d2 100644 --- a/src/heurams/interface/screens/dashboard.py +++ b/src/heurams/interface/screens/dashboard.py @@ -9,7 +9,7 @@ from textual.widgets import ( Button, Static, ) -from textual.containers import Container +from textual.containers import ScrollableContainer from textual.screen import Screen from heurams.kernel.particles import * @@ -26,7 +26,7 @@ class DashboardScreen(Screen): def compose(self) -> ComposeResult: yield Header(show_clock=True) - yield Container( + yield ScrollableContainer( Label(f'欢迎使用 "潜进" 启发式先进记忆调度器', classes="title-label"), Label(f"当前 UNIX 日时间戳: {timer.get_daystamp()}"), Label(f'时区修正: UTC+{config_var.get()["timezone_offset"] / 3600}'), diff --git a/src/heurams/interface/screens/memorizor.py b/src/heurams/interface/screens/memorizor.py index 7d3025f..a82f4e2 100644 --- a/src/heurams/interface/screens/memorizor.py +++ b/src/heurams/interface/screens/memorizor.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 from textual.app import ComposeResult from textual.widgets import Header, Footer, Label, Static, Button -from textual.containers import Center, Container +from textual.containers import Center, ScrollableContainer from textual.screen import Screen from textual.reactive import reactive from enum import Enum, auto @@ -70,12 +70,13 @@ class MemScreen(Screen): def compose(self) -> ComposeResult: yield Header(show_clock=True) - with Center(): - yield Static( - f"当前进度: {self.procession.process()}/{self.procession.total_length()}" - ) - # self.mount(self.current_widget()) # type: ignore - yield Container(id="puzzle-container") + with ScrollableContainer(): + with Center(): + yield Static( + f"当前进度: {self.procession.process()}/{self.procession.total_length()}" + ) + # self.mount(self.current_widget()) # type: ignore + yield ScrollableContainer(id="puzzle-container") # yield Button("重新学习此单元", id="re-recognize", variant="warning") yield Footer() diff --git a/src/heurams/interface/screens/nucreator.py b/src/heurams/interface/screens/nucreator.py index bd772ff..5743bd0 100644 --- a/src/heurams/interface/screens/nucreator.py +++ b/src/heurams/interface/screens/nucreator.py @@ -9,7 +9,7 @@ from textual.widgets import ( Button, Markdown, ) -from textual.containers import Container +from textual.containers import ScrollableContainer from textual.screen import Screen from heurams.services.version import ver @@ -44,7 +44,7 @@ class NucleonCreatorScreen(Screen): def compose(self) -> ComposeResult: yield Header(show_clock=True) - with Container(id="vice_container"): + with ScrollableContainer(id="vice_container"): yield Label(f"[b]空白单元集创建向导\n") yield Markdown( "> 提示: 你可能注意到当选中文本框时底栏和操作按键绑定将被覆盖 \n只需选中(使用鼠标或 Tab)选择框即可恢复底栏功能" diff --git a/src/heurams/interface/screens/precache.py b/src/heurams/interface/screens/precache.py index 225fcc2..f6b6899 100644 --- a/src/heurams/interface/screens/precache.py +++ b/src/heurams/interface/screens/precache.py @@ -8,8 +8,8 @@ from textual.widgets import ( Static, ProgressBar, ) -from textual.containers import Container, Horizontal -from textual.containers import Container +from textual.containers import ScrollableContainer, Horizontal +from textual.containers import ScrollableContainer from textual.screen import Screen import pathlib @@ -50,7 +50,7 @@ class PrecachingScreen(Screen): def compose(self) -> ComposeResult: yield Header(show_clock=True) - with Container(id="precache_container"): + with ScrollableContainer(id="precache_container"): yield Label("[b]音频预缓存[/b]", classes="title-label") if self.nucleons: diff --git a/src/heurams/interface/screens/preparation.py b/src/heurams/interface/screens/preparation.py index a4dc2bc..11b73dd 100644 --- a/src/heurams/interface/screens/preparation.py +++ b/src/heurams/interface/screens/preparation.py @@ -8,7 +8,7 @@ from textual.widgets import ( Button, Markdown, ) -from textual.containers import Container +from textual.containers import ScrollableContainer from textual.screen import Screen import heurams.kernel.particles as pt @@ -28,7 +28,7 @@ class PreparationScreen(Screen): def compose(self) -> ComposeResult: yield Header(show_clock=True) - with Container(id="vice_container"): + with ScrollableContainer(id="vice_container"): yield Label(f"准备就绪: [b]{self.nucleon_file.stem}[/b]\n") yield Label(f"内容源文件对象: ./nucleon/[b]{self.nucleon_file.name}[/b]") yield Label(f"元数据文件对象: ./electron/[b]{self.electron_file.name}[/b]") diff --git a/src/heurams/interface/screens/synctool.py b/src/heurams/interface/screens/synctool.py index a830394..ba6ca66 100644 --- a/src/heurams/interface/screens/synctool.py +++ b/src/heurams/interface/screens/synctool.py @@ -8,8 +8,8 @@ from textual.widgets import ( Static, ProgressBar, ) -from textual.containers import Container, Horizontal -from textual.containers import Container +from textual.containers import ScrollableContainer, Horizontal +from textual.containers import ScrollableContainer from textual.screen import Screen import pathlib @@ -28,7 +28,7 @@ class SyncScreen(Screen): def compose(self) -> ComposeResult: yield Header(show_clock=True) - with Container(id="sync_container"): + with ScrollableContainer(id="sync_container"): pass yield Footer() diff --git a/src/heurams/interface/widgets/basic_puzzle.py b/src/heurams/interface/widgets/basic_puzzle.py index c8bcac2..21a2efa 100644 --- a/src/heurams/interface/widgets/basic_puzzle.py +++ b/src/heurams/interface/widgets/basic_puzzle.py @@ -3,7 +3,7 @@ from textual.widgets import ( Static, Button, ) -from textual.containers import Container, Horizontal +from textual.containers import ScrollableContainer, Horizontal from textual.widget import Widget import heurams.kernel.particles as pt from .base_puzzle_widget import BasePuzzleWidget @@ -55,7 +55,7 @@ class BasicEvaluation(BasePuzzleWidget): yield Static("请评估你对这个内容的记忆程度:", classes="instruction") # 按钮容器 - with Container(id="button_container"): + with ScrollableContainer(id="button_container"): btn = {} btn["5"] = Button( "完美回想", variant="success", id="feedback_5", classes="choice" diff --git a/src/heurams/interface/widgets/mcq_puzzle.py b/src/heurams/interface/widgets/mcq_puzzle.py index c67728f..9d0f386 100644 --- a/src/heurams/interface/widgets/mcq_puzzle.py +++ b/src/heurams/interface/widgets/mcq_puzzle.py @@ -3,7 +3,7 @@ from textual.widgets import ( Label, Button, ) -from textual.containers import Container +from textual.containers import ScrollableContainer from textual.widget import Widget import heurams.kernel.particles as pt import heurams.kernel.puzzles as pz