fix: 优化 CSS 结构

This commit is contained in:
2026-04-21 00:15:57 +08:00
parent e943b1b7d7
commit c0483b87f8
13 changed files with 128 additions and 122 deletions

View File

@@ -80,3 +80,4 @@ class HeurAMSApp(App):
def panic(self, *args):
self._close_messages_no_wait()
raise self._exception

View File

@@ -2,22 +2,6 @@ NavigatorScreen {
align: center middle;
}
.infview {
width: 5fr
}
.dataview {
width: 3fr
}
.repo_listitem {
layout: grid;
grid-size: 2;
}
.repo_listitem_btn {
dock: right;
offset: -5% 0
}
#dialog {
grid-size: 2;
@@ -29,33 +13,3 @@ NavigatorScreen {
border: thick $background 80%;
background: $surface;
}
#dashboardtop {
height: 4
}
#input-container {
height: 3;
margin-top: 1;
align: center middle;
}
.container {
height: auto;
padding: 0 0 1 0;
}
#message-input {
width: 1fr;
margin-right: 1;
}
#status-bar {
height: 1;
margin-top: 1;
text-style: italic;
color: $text-muted;
}
.session-label {
color: $primary;
text-style: bold;
}

View File

@@ -3,7 +3,7 @@
}
#header {
height: 4;
height: 3;
}
.repo-list-item {

View File

@@ -0,0 +1,27 @@
.foot {
align-vertical: bottom;
}
Switch {
dock: right;
}
Label {
width: auto
}
Select {
width: 55%;
dock: right;
}
Input {
width: 55%;
dock: right;
}
Horizontal {
width: 100%;
height: 4;
padding: 0 0 1 0;
}

View File

@@ -41,6 +41,7 @@ class AboutScreen(Screen):
API 版本代号: `{version.codename.capitalize()}`
一个基于启发式算法与认知科学理论的辅助记忆调度器, 旨在帮助用户更高效地进行记忆工作与学习规划.
一个开放, 优雅, 易于扩展的间隔重复调度器实验平台, 旨在帮助研究者更高效地进行前沿记忆算法的研究.
以 AGPL-3.0 开放源代码, 这直接意味着任何个体直接基于此代码对外或内部提供的应用和服务, 无论本地或网络, 必须向所有用户公开完整修改后的源代码, 且继续沿用 AGPL-3.0 协议.

View File

@@ -35,7 +35,7 @@ class DashboardScreen(Screen):
("q", "go_back", "返回"),
]
CSS_PATH = Path(__file__).parent.parent / "css" / "screens" / "dashboard.tcss"
CSS_PATH = rootdir / 'interface' / "css" / "screens" / "dashboard.tcss"
def __init__(
self,
@@ -53,10 +53,9 @@ class DashboardScreen(Screen):
with ScrollableContainer():
yield Horizontal( # 顶部的状态
Vertical(
Label(f'欢迎使用 "潜进" 版本 {version.ver}'),
Label(f"当前 UNIX 日时间戳: {timer.get_daystamp()}"),
Label(f"当前日时间戳: {timer.get_daystamp()}"),
Label(
f"应用时区修正: UTC+{config_var.get()['services']['timer']['timezone_offset'] / 3600}"
f"应用时区修正: UTC+{str(config_var.get()['services']['timer']['timezone_offset'] / 3600).rstrip('.0')}"
),
Label(
f"默认算法设置: {config_var.get()['interface']['global']['algorithm']}"
@@ -80,7 +79,7 @@ class DashboardScreen(Screen):
yield ListView(id="repo_list", classes="repo-list") # 单元集选择
yield Label(
f'"潜进" 启发式辅助记忆调度器 版本 {version.ver} {version.stage.capitalize()}'
f'版本 {version.ver} {version.stage.capitalize()}'
) # 版本信息
yield Footer()
@@ -107,6 +106,10 @@ class DashboardScreen(Screen):
"touched": 0,
"have_activated_ever": 0,
}
repo.preview = {
"review": 0,
"new": repo.config['scheduled_num'],
}
initial_time = float("inf")
for i in range(repo.data_length):
e = pt.Electron.from_data(
@@ -118,11 +121,13 @@ class DashboardScreen(Screen):
repo.progress["have_activated_ever"] = 1
repo.progress["touched"] += 1
repo.nearest_review_time = min(repo.nearest_review_time, e.nextdate())
if (timer.get_daystamp() >= e.nextdate()):
repo.preview['review'] += 1
# initial_time = min(initial_time, e.)
repo.need_review = timer.get_daystamp() >= repo.nearest_review_time
repo.prompt = f"""{repo.manifest['title']} ({repo.config['algorithm']})
repo.prompt = f"""{repo.manifest['title']} \\[{repo.config['algorithm']}]
[d]进度: {repo.progress['touched']}/{repo.progress['total']} ({round(repo.progress['touched']/repo.progress['total']*100, 1)}%)[/d]
[d]{'需要复习' if repo.need_review else ("暂未开始" if not repo.progress['have_activated_ever'] else '无需操作')}[/d]"""
[d]{f'需要学习: {repo.preview['review']}R + {repo.preview['new']}U' if repo.need_review else (f"暂未开始: 0R + {repo.preview['new']}U" if not repo.progress['have_activated_ever'] else '无需操作')}[/d]"""
def on_mount(self) -> None:
"""挂载组件时初始化"""

View File

@@ -1,7 +1,7 @@
"""记忆准备界面"""
from textual.app import ComposeResult
from textual.containers import ScrollableContainer
from textual.containers import ScrollableContainer, Container
from textual.reactive import reactive
from textual.screen import Screen
from textual.widget import Widget
@@ -15,6 +15,7 @@ from textual.widgets import (
Rule,
Sparkline,
)
from textual.lazy import Reveal, Lazy
import heurams.kernel.particles as pt
import heurams.services.hasher as hasher
@@ -46,7 +47,7 @@ class PreparationScreen(Screen):
def compose(self) -> ComposeResult:
yield Header(show_clock=True)
with ScrollableContainer(id="vice_container"):
with Reveal(ScrollableContainer(id="vice_container")):
yield Label(f"准备就绪: [b]{self.repo.manifest['title']}[/b]\n")
yield Label(f"[b]仓库路径: {self.repo.source}[/b]")
yield Label(f"\n单元数量: {len(self.repo)}\n")

View File

@@ -44,7 +44,8 @@ class SettingScreen(Screen):
BINDINGS = [
("q", "go_back", "返回"),
]
CSS_PATH = rootdir / 'interface' / "css" / "screens" / "setting.tcss"
def __init__(
self,
name: str | None = None,
@@ -66,6 +67,7 @@ class SettingScreen(Screen):
yield Collapsible(
*a, title=i + f'\n{config_var.get().get(f"_{i}_desc", "")}'
)
yield Label("退出页面时, 所作的更改会立即保存, 但仍建议重启软件以确保新的配置得到应用", classes="foot")
yield Footer()
def _get_subcfg(self, parent_epath: str):
@@ -112,7 +114,6 @@ class SettingScreen(Screen):
prompt=f'{parent.get(f"{i}", "")}',
id=domize(f"{parent_epath}.{i}"),
),
classes="container",
)
)
elif isinstance(parent[f"_{i}_candidate"], list):
@@ -124,7 +125,6 @@ class SettingScreen(Screen):
prompt=f'{parent.get(f"{i}", "")}',
id=domize(f"{parent_epath}.{i}"),
),
classes="container",
)
)
else:
@@ -138,7 +138,6 @@ class SettingScreen(Screen):
type="number",
id=domize(f"{parent_epath}.{i}"),
),
classes="container",
)
)
elif isinstance(parent[i], str):
@@ -151,7 +150,6 @@ class SettingScreen(Screen):
type="text",
id=domize(f"{parent_epath}.{i}"),
),
classes="container",
)
)
elif isinstance(parent[i], bool):
@@ -161,7 +159,6 @@ class SettingScreen(Screen):
Switch(
value=parent[i], id=domize(f"{parent_epath}.{i}")
),
classes="container",
)
)
elif isinstance(parent[i], int):
@@ -174,7 +171,6 @@ class SettingScreen(Screen):
type="integer",
id=domize(f"{parent_epath}.{i}"),
),
classes="container",
)
)
elif isinstance(parent[i], list):

View File

@@ -1,5 +1,4 @@
from .evalizor import Evalizer
from .lict import Lict
from .refvar import RefVar
__all__ = ["Evalizer", "Lict", "RefVar"]
__all__ = ["Evalizer", "Lict"]