v1.5.4 Bug 修复:模板文件名修正 + 布局重设计

BUG-005: 模板文件名改为 PinMAP-Template.xlsx / PinList-Template.xlsx
BUG-006: 布局改为 Number 外侧 + Name 里侧(v1.5.4 最终版)
- 从边界往中心:第1圈=Number,第2圈=Name
- 上边角点例外处理,15种网格无冲突
- 18/18 单元测试 + 37/37 集成测试全部通过
This commit is contained in:
2026-06-09 08:27:11 +08:00
parent 91e1d93e18
commit d635ddbebe
19 changed files with 647 additions and 237 deletions

View File

@@ -33,44 +33,44 @@ def wait_for_exit():
# ── Path helpers ────────────────────────────────────────────────────
def _find_balllist_template_path() -> str | None:
"""查找根目录下的 BallList-Template.xlsx。
def _find_pinlist_template_path() -> str | None:
"""查找根目录下的 PinList-Template.xlsx。
MAP→List 输出使用 BallList 模板(而非旧 PinMAP 模板)
MAP→List 输出使用 PinList 模板。
搜索顺序:
1. 与 run.bat 同级的根目录
2. 当前工作目录
"""
src_dir = os.path.dirname(os.path.abspath(__file__))
root_dir = os.path.dirname(os.path.dirname(src_dir)) # pinmap-to-pinlist/
template_path = os.path.join(root_dir, "BallList-Template.xlsx")
template_path = os.path.join(root_dir, "PinList-Template.xlsx")
if os.path.exists(template_path):
return template_path
cwd_template = os.path.join(os.getcwd(), "BallList-Template.xlsx")
cwd_template = os.path.join(os.getcwd(), "PinList-Template.xlsx")
if os.path.exists(cwd_template):
return cwd_template
return None
def _find_ballmap_template_path() -> str | None:
"""查找根目录下的 BallMAP-Template.xlsx。
def _find_pinmap_template_path() -> str | None:
"""查找根目录下的 PinMAP-Template.xlsx。
List→MAP 输出使用 BallMAP 模板(而非旧 PinMAP 模板
List→MAP 输出使用 PinMAP 模板。
搜索顺序:
1. 与 run.bat 同级的根目录
2. 当前工作目录
"""
src_dir = os.path.dirname(os.path.abspath(__file__))
root_dir = os.path.dirname(os.path.dirname(src_dir)) # pinmap-to-pinlist/
template_path = os.path.join(root_dir, "BallMAP-Template.xlsx")
template_path = os.path.join(root_dir, "PinMAP-Template.xlsx")
if os.path.exists(template_path):
return template_path
cwd_template = os.path.join(os.getcwd(), "BallMAP-Template.xlsx")
cwd_template = os.path.join(os.getcwd(), "PinMAP-Template.xlsx")
if os.path.exists(cwd_template):
return cwd_template
@@ -171,17 +171,17 @@ def run_map_to_list(filepath: str):
data[f'A{row}'] = pin_name
data[f'B{row}'] = str(pin_num)
# 尝试读取 BallList 模板样式F009
template_path = _find_balllist_template_path()
# 尝试读取 PinList 模板样式
template_path = _find_pinlist_template_path()
template_style = None
if template_path:
template_style = read_template_styles(template_path)
if template_style:
print(f"[INFO] 已加载 BallList 模板样式: {template_path}")
print(f"[INFO] 已加载 PinList 模板样式: {template_path}")
else:
print("[WARN] BallList 模板文件存在但解析失败,使用默认样式")
print("[WARN] PinList 模板文件存在但解析失败,使用默认样式")
else:
print("[INFO] 未检测到 BallList-Template.xlsx使用默认样式")
print("[INFO] 未检测到 PinList-Template.xlsx使用默认样式")
if template_style is not None:
write_xlsx_with_style(data, output_path, template_style)
@@ -281,17 +281,17 @@ def run_list_to_map(filepath: str):
print(f"[INFO] 正在生成 PinMAP 并写入: {output_path}")
try:
# 尝试读取 BallMAP 模板样式F010
template_path = _find_ballmap_template_path()
# 尝试读取 PinMAP 模板样式
template_path = _find_pinmap_template_path()
template_style = None
if template_path:
template_style = read_template_styles(template_path)
if template_style:
print(f"[INFO] 已加载 BallMAP 模板样式: {template_path}")
print(f"[INFO] 已加载 PinMAP 模板样式: {template_path}")
else:
print("[WARN] BallMAP 模板文件存在但解析失败,使用默认样式")
print("[WARN] PinMAP 模板文件存在但解析失败,使用默认样式")
else:
print("[INFO] 未检测到 BallMAP-Template.xlsx使用默认样式")
print("[INFO] 未检测到 PinMAP-Template.xlsx使用默认样式")
generate_pinmap(
entries=entries,