fix: 滚动
This commit is contained in:
28
AGENTS.md
28
AGENTS.md
@@ -58,17 +58,6 @@ python -m heurams.interface
|
|||||||
heurams # (if console scripts are configured)
|
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
|
### Linting and Formatting
|
||||||
No specific linting or formatting configuration observed. Use standard Python conventions.
|
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)
|
- Service abstraction with provider pattern (audio, TTS, LLM)
|
||||||
- Configuration-driven behavior with fallback defaults
|
- 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
|
## Important Gotchas
|
||||||
|
|
||||||
### Configuration Loading
|
### Configuration Loading
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ logger = get_logger(__name__)
|
|||||||
|
|
||||||
class HeurAMSApp(App):
|
class HeurAMSApp(App):
|
||||||
TITLE = "潜进"
|
TITLE = "潜进"
|
||||||
# CSS_PATH = str(cxt.rootdir / "interface" / "css" / "main.css")
|
CSS_PATH = "css/main.tcss"
|
||||||
SUB_TITLE = "启发式先进记忆调度器"
|
SUB_TITLE = "启发式先进记忆调度器"
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
("q", "quit", "退出"),
|
("q", "quit", "退出"),
|
||||||
|
|||||||
0
src/heurams/interface/css/main.tcss
Normal file
0
src/heurams/interface/css/main.tcss
Normal file
@@ -8,7 +8,7 @@ from textual.widgets import (
|
|||||||
Button,
|
Button,
|
||||||
Markdown,
|
Markdown,
|
||||||
)
|
)
|
||||||
from textual.containers import Container
|
from textual.containers import ScrollableContainer, ScrollableContainer
|
||||||
from textual.screen import Screen
|
from textual.screen import Screen
|
||||||
|
|
||||||
import heurams.services.version as version
|
import heurams.services.version as version
|
||||||
@@ -19,7 +19,7 @@ class AboutScreen(Screen):
|
|||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
yield Header(show_clock=True)
|
yield Header(show_clock=True)
|
||||||
with Container(id="about_container"):
|
with ScrollableContainer(id="about_container"):
|
||||||
yield Label("[b]关于与版本信息[/b]")
|
yield Label("[b]关于与版本信息[/b]")
|
||||||
about_text = f"""
|
about_text = f"""
|
||||||
# 关于 "潜进"
|
# 关于 "潜进"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from textual.widgets import (
|
|||||||
Button,
|
Button,
|
||||||
Static,
|
Static,
|
||||||
)
|
)
|
||||||
from textual.containers import Container
|
from textual.containers import ScrollableContainer
|
||||||
from textual.screen import Screen
|
from textual.screen import Screen
|
||||||
|
|
||||||
from heurams.kernel.particles import *
|
from heurams.kernel.particles import *
|
||||||
@@ -26,7 +26,7 @@ class DashboardScreen(Screen):
|
|||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
yield Header(show_clock=True)
|
yield Header(show_clock=True)
|
||||||
yield Container(
|
yield ScrollableContainer(
|
||||||
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}'),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from textual.app import ComposeResult
|
from textual.app import ComposeResult
|
||||||
from textual.widgets import Header, Footer, Label, Static, Button
|
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.screen import Screen
|
||||||
from textual.reactive import reactive
|
from textual.reactive import reactive
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
@@ -70,12 +70,13 @@ class MemScreen(Screen):
|
|||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
yield Header(show_clock=True)
|
yield Header(show_clock=True)
|
||||||
|
with ScrollableContainer():
|
||||||
with Center():
|
with Center():
|
||||||
yield Static(
|
yield Static(
|
||||||
f"当前进度: {self.procession.process()}/{self.procession.total_length()}"
|
f"当前进度: {self.procession.process()}/{self.procession.total_length()}"
|
||||||
)
|
)
|
||||||
# self.mount(self.current_widget()) # type: ignore
|
# self.mount(self.current_widget()) # type: ignore
|
||||||
yield Container(id="puzzle-container")
|
yield ScrollableContainer(id="puzzle-container")
|
||||||
# yield Button("重新学习此单元", id="re-recognize", variant="warning")
|
# yield Button("重新学习此单元", id="re-recognize", variant="warning")
|
||||||
yield Footer()
|
yield Footer()
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from textual.widgets import (
|
|||||||
Button,
|
Button,
|
||||||
Markdown,
|
Markdown,
|
||||||
)
|
)
|
||||||
from textual.containers import Container
|
from textual.containers import ScrollableContainer
|
||||||
from textual.screen import Screen
|
from textual.screen import Screen
|
||||||
|
|
||||||
from heurams.services.version import ver
|
from heurams.services.version import ver
|
||||||
@@ -44,7 +44,7 @@ class NucleonCreatorScreen(Screen):
|
|||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
yield Header(show_clock=True)
|
yield Header(show_clock=True)
|
||||||
with Container(id="vice_container"):
|
with ScrollableContainer(id="vice_container"):
|
||||||
yield Label(f"[b]空白单元集创建向导\n")
|
yield Label(f"[b]空白单元集创建向导\n")
|
||||||
yield Markdown(
|
yield Markdown(
|
||||||
"> 提示: 你可能注意到当选中文本框时底栏和操作按键绑定将被覆盖 \n只需选中(使用鼠标或 Tab)选择框即可恢复底栏功能"
|
"> 提示: 你可能注意到当选中文本框时底栏和操作按键绑定将被覆盖 \n只需选中(使用鼠标或 Tab)选择框即可恢复底栏功能"
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ from textual.widgets import (
|
|||||||
Static,
|
Static,
|
||||||
ProgressBar,
|
ProgressBar,
|
||||||
)
|
)
|
||||||
from textual.containers import Container, Horizontal
|
from textual.containers import ScrollableContainer, Horizontal
|
||||||
from textual.containers import Container
|
from textual.containers import ScrollableContainer
|
||||||
from textual.screen import Screen
|
from textual.screen import Screen
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ class PrecachingScreen(Screen):
|
|||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
yield Header(show_clock=True)
|
yield Header(show_clock=True)
|
||||||
with Container(id="precache_container"):
|
with ScrollableContainer(id="precache_container"):
|
||||||
yield Label("[b]音频预缓存[/b]", classes="title-label")
|
yield Label("[b]音频预缓存[/b]", classes="title-label")
|
||||||
|
|
||||||
if self.nucleons:
|
if self.nucleons:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from textual.widgets import (
|
|||||||
Button,
|
Button,
|
||||||
Markdown,
|
Markdown,
|
||||||
)
|
)
|
||||||
from textual.containers import Container
|
from textual.containers import ScrollableContainer
|
||||||
from textual.screen import Screen
|
from textual.screen import Screen
|
||||||
|
|
||||||
import heurams.kernel.particles as pt
|
import heurams.kernel.particles as pt
|
||||||
@@ -28,7 +28,7 @@ class PreparationScreen(Screen):
|
|||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
yield Header(show_clock=True)
|
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"准备就绪: [b]{self.nucleon_file.stem}[/b]\n")
|
||||||
yield Label(f"内容源文件对象: ./nucleon/[b]{self.nucleon_file.name}[/b]")
|
yield Label(f"内容源文件对象: ./nucleon/[b]{self.nucleon_file.name}[/b]")
|
||||||
yield Label(f"元数据文件对象: ./electron/[b]{self.electron_file.name}[/b]")
|
yield Label(f"元数据文件对象: ./electron/[b]{self.electron_file.name}[/b]")
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ from textual.widgets import (
|
|||||||
Static,
|
Static,
|
||||||
ProgressBar,
|
ProgressBar,
|
||||||
)
|
)
|
||||||
from textual.containers import Container, Horizontal
|
from textual.containers import ScrollableContainer, Horizontal
|
||||||
from textual.containers import Container
|
from textual.containers import ScrollableContainer
|
||||||
from textual.screen import Screen
|
from textual.screen import Screen
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ class SyncScreen(Screen):
|
|||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
yield Header(show_clock=True)
|
yield Header(show_clock=True)
|
||||||
with Container(id="sync_container"):
|
with ScrollableContainer(id="sync_container"):
|
||||||
pass
|
pass
|
||||||
yield Footer()
|
yield Footer()
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from textual.widgets import (
|
|||||||
Static,
|
Static,
|
||||||
Button,
|
Button,
|
||||||
)
|
)
|
||||||
from textual.containers import Container, Horizontal
|
from textual.containers import ScrollableContainer, Horizontal
|
||||||
from textual.widget import Widget
|
from textual.widget import Widget
|
||||||
import heurams.kernel.particles as pt
|
import heurams.kernel.particles as pt
|
||||||
from .base_puzzle_widget import BasePuzzleWidget
|
from .base_puzzle_widget import BasePuzzleWidget
|
||||||
@@ -55,7 +55,7 @@ class BasicEvaluation(BasePuzzleWidget):
|
|||||||
yield Static("请评估你对这个内容的记忆程度:", classes="instruction")
|
yield Static("请评估你对这个内容的记忆程度:", classes="instruction")
|
||||||
|
|
||||||
# 按钮容器
|
# 按钮容器
|
||||||
with Container(id="button_container"):
|
with ScrollableContainer(id="button_container"):
|
||||||
btn = {}
|
btn = {}
|
||||||
btn["5"] = Button(
|
btn["5"] = Button(
|
||||||
"完美回想", variant="success", id="feedback_5", classes="choice"
|
"完美回想", variant="success", id="feedback_5", classes="choice"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from textual.widgets import (
|
|||||||
Label,
|
Label,
|
||||||
Button,
|
Button,
|
||||||
)
|
)
|
||||||
from textual.containers import Container
|
from textual.containers import ScrollableContainer
|
||||||
from textual.widget import Widget
|
from textual.widget import Widget
|
||||||
import heurams.kernel.particles as pt
|
import heurams.kernel.particles as pt
|
||||||
import heurams.kernel.puzzles as pz
|
import heurams.kernel.puzzles as pz
|
||||||
|
|||||||
Reference in New Issue
Block a user