docs: 修改文档

This commit is contained in:
2026-05-07 13:26:22 +08:00
parent cd6bac3d00
commit 7a1c1c6093
16 changed files with 464 additions and 57 deletions

View File

@@ -85,7 +85,7 @@ class FavoriteManagerScreen(Screen):
def _encode_favorite_key(self, repo_path: str, ident: str) -> str:
"""编码仓库路径和标识符为安全的按钮 ID 部分"""
# 使用 \x00 分隔两部分然后进行 base64 编码
# 使用 \x00 分隔两部分, 然后进行 base64 编码
combined = f"{repo_path}\x00{ident}"
encoded = base64.urlsafe_b64encode(combined.encode()).decode()
# 去掉填充的等号
@@ -114,7 +114,7 @@ class FavoriteManagerScreen(Screen):
# 创建安全的按钮 ID
button_key = self._encode_favorite_key(fav.repo_path, fav.ident)
# 创建列表项包含移除按钮
# 创建列表项, 包含移除按钮
container = Horizontal(
Label(display_text, classes="favorite-content"),
Button("移除", id=f"remove-{button_key}", variant="error", flat=True, classes="favorite-item-btn"),

View File

@@ -237,14 +237,14 @@ class MemScreen(Screen):
"""获取仓库相对路径(相对于 data/repo"""
if self.repo is None:
return ""
# self.repo.source 是 Path 对象指向仓库目录
# self.repo.source 是 Path 对象, 指向仓库目录
repo_full_path = self.repo.source
data_repo_path = Path(config_var.get()["global"]["paths"]["data"]) / "repo"
try:
rel_path = repo_full_path.relative_to(data_repo_path)
return str(rel_path)
except ValueError:
# 如果不在 data/repo 下则返回完整路径(字符串形式)
# 如果不在 data/repo 下, 则返回完整路径(字符串形式)
return str(repo_full_path)
def _is_current_atom_favorited(self) -> bool:

View File

@@ -14,7 +14,7 @@ import heurams.kernel.particles as pt
import heurams.services.hasher as hasher
from heurams.context import *
# 兼容性缓存路径:优先使用 paths.cache否则使用 data/cache
# 兼容性缓存路径:优先使用 paths.cache, 否则使用 data/cache
paths = config_var.get()["global"]["paths"]
cache_dir = pathlib.Path(paths.get("cache", paths["data"] + "/cache")) / "voice"
@@ -55,7 +55,7 @@ class PrecachingScreen(Screen):
self.precache_worker = None
self.cancel_flag = 0
self.desc = desc
# 不再需要缓存配置保留配置读取以兼容
# 不再需要缓存配置, 保留配置读取以兼容
self.cache_stats = {
"total_size": 0,
"file_count": 0,

View File

@@ -130,7 +130,7 @@ class SyncScreen(Screen):
log_widget = self.query_one("#log_output")
log_widget.update("\n".join(self.log_messages)) # type: ignore
except Exception:
pass # 如果组件未就绪忽略错误
pass # 如果组件未就绪, 忽略错误
def on_button_pressed(self, event: Button.Pressed) -> None:
"""处理按钮点击事件"""
@@ -150,7 +150,7 @@ class SyncScreen(Screen):
def test_connection(self):
"""测试 WebDAV 服务器连接"""
if not self.sync_service:
self.log_message("同步服务未初始化请检查配置", is_error=True)
self.log_message("同步服务未初始化, 请检查配置", is_error=True)
self.update_status("❌ 同步服务未初始化")
return
@@ -172,7 +172,7 @@ class SyncScreen(Screen):
def start_sync(self):
"""开始同步"""
if not self.sync_service:
self.log_message("同步服务未初始化无法开始同步", is_error=True)
self.log_message("同步服务未初始化, 无法开始同步", is_error=True)
return
if self.is_syncing: