fix: 滚动

This commit is contained in:
2025-12-15 16:35:07 +08:00
parent 6efd041f72
commit b6c719fb21
12 changed files with 26 additions and 53 deletions

View File

@@ -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

View File

@@ -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", "退出"),

View File

View File

@@ -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"""
# 关于 "潜进"

View File

@@ -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}'),

View File

@@ -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()

View File

@@ -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)选择框即可恢复底栏功能"

View File

@@ -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:

View File

@@ -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]")

View File

@@ -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()

View File

@@ -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"

View File

@@ -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