Commit Graph
3 Commits
Author SHA1 Message Date
CodexandClaude Opus 4.7 053ffa3469 refactor(gui): 拆出 mapping_table.py 5 个 UI 辅助子函数(659→482,-177 行)
mapping_table.create_mapping_tab 是单个 632 行的 tkinter 闭包巨型函数,
把其中相对独立的 5 个块抽到 mapping_table_helpers:
- open_entry_detail_window:弹出条目详情(原代码出现 2 次)
- compute_card_layout:根据画布宽度计算列数和卡片宽度
- set_card_bg:批量切换 widget + 子 widget 背景色
- make_card_event_handlers:单卡片的 click/dbl/enter/leave 处理器工厂
- render_card_labels:渲染单卡片内的 title + meta + body label

逻辑保持等价,只是提取闭包消除重复嵌套。新增 8 个单元测试覆盖
compute_card_layout / API 表面,1026 → 1034 用例全过。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 01:51:52 +08:00
CodexandClaude Opus 4.7 71f3653354 补回上次合并丢失的关键路径修复 + .gitignore 补强 + 依赖版本对齐
上次冲突解决时跳过了 982f57e (P0 清理) 和 b6ae970 (路径修复) 两个 commit,
本提交补回其中影响运行时正确性和文档一致性的 7 处。

E. 路径错位修复
  - douyin/core/douyin_fudai.py: _reservations_state_path 与 room_pos_map
    状态目录改为优先调用 path_config.get_reservations_path()
  - douyin/core/path_config.py: get_reservations_path 注释明确"实际位置 + 写入方"
  - gui/components/mapping_utils.py: 删除错误兜底 douyin/state/reservations.json
  - gui/components/mapping_table.py: 同步删除 douyin/state/room_pos_map.json 错误兜底
  - gui/web_gui.py: get_reservations() 内的兜底由 douyin/state/ 修正为 douyin/core/state/
  - bin/run_cli.py: 移除对已删空文件 douyin_reservation_ops.py 的 shim 加载
  - douyin/reservation/douyin_reservation_ops.py: 删除 0 字节空文件

F. .gitignore 补强
  - 新增 *.bak_* 拦截带日期后缀的备份命名(修复 *.bak 命中失败的场景)

G. 依赖版本对齐
  - requirements-minimal.txt: paddleocr/paddlepaddle 改为 >=3.0.0,与 requirements.txt 一致
  - README.md: 安装指引中 paddlepaddle==2.5.2 改为 >=3.0.0

回归:全量 .py compileall 通过;7 项断言(path_config 路径、douyin_fudai 切换、
3 处兜底已清、shim 已移除、空文件已删、.gitignore 补强、版本对齐)全部 PASS;
test_filter_logging / check_web_gui_config_sync 通过。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 10:18:17 +08:00
Your Name 4903e50ff2 优化:调整代码格式,增强可读性 2026-01-23 15:29:09 +08:00