harness/plugins/zioinfo/skills/proposal-builder-orchestrator/scripts/inspect_template.py
DESKTOP-TKLFCPR\ython 6caf43e1ed feat!: v2.0.0 — 4개 플러그인 zioinfo 단일 통합 + 최신 플러그인 기술 적용
- harness·zio-harness·proposal-builder·zioinfo → plugins/zioinfo (git mv 히스토리 보존)
- 스킬 4·커맨드 3(/zioinfo:pmo·proposal·wiki)·에이전트 15·graphify 훅·knowledge 통합
- 신규: /zioinfo:wiki (graphify LLM wiki — graphify-out/wiki/ 커뮤니티별 아티클)
- 신규: ZIO WISE 테마 (themes/zioinfo.json, experimental)
- manifest 최신화: $schema·displayName(ZIO INFOTECH Suite)·experimental.themes
- marketplace.json 단일 엔트리, 루트 plugin.json 제거
- CLAUDE.md·PROJECT_MAP·docs/plugins.md·README 3종·CHANGELOG·설치가이드 pptx 재구성

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 20:16:36 +09:00

67 lines
2.7 KiB
Python

#!/usr/bin/env python3
"""
inspect_template.py — PPTX 디자인 템플릿 해부.
마스터/레이아웃/테마색/폰트/플레이스홀더를 덤프하여 deck-designer가 동일 스타일로 슬라이드를 생성하게 한다.
사용: python inspect_template.py <template.pptx> [--json out.json]
의존: pip install python-pptx
외부 호출 없음(로컬 파싱만).
"""
import sys, json, argparse
def main():
ap = argparse.ArgumentParser()
ap.add_argument("template")
ap.add_argument("--json", dest="out")
a = ap.parse_args()
try:
from pptx import Presentation
from pptx.util import Emu
except ImportError:
print("python-pptx 미설치 → pip install python-pptx", file=sys.stderr); sys.exit(2)
prs = Presentation(a.template)
spec = {
"slide_size": {"w_emu": prs.slide_width, "h_emu": prs.slide_height,
"w_in": round(prs.slide_width / 914400, 2), "h_in": round(prs.slide_height / 914400, 2)},
"masters": [], "layouts": [], "theme_fonts": {}, "theme_colors": {},
}
# 테마 폰트(첫 마스터의 테마)
try:
theme = prs.slide_masters[0].element.getroottree() # noqa
except Exception:
pass
for mi, master in enumerate(prs.slide_masters):
spec["masters"].append({"index": mi, "name": master.name or f"master{mi}",
"layout_count": len(master.slide_layouts)})
for li, layout in enumerate(master.slide_layouts):
phs = []
for ph in layout.placeholders:
phs.append({"idx": ph.placeholder_format.idx,
"type": str(ph.placeholder_format.type),
"name": ph.name,
"left_in": round((ph.left or 0)/914400, 2) if ph.left is not None else None,
"top_in": round((ph.top or 0)/914400, 2) if ph.top is not None else None,
"width_in": round((ph.width or 0)/914400, 2) if ph.width is not None else None,
"height_in": round((ph.height or 0)/914400, 2) if ph.height is not None else None})
spec["layouts"].append({"master": mi, "index": li, "name": layout.name, "placeholders": phs})
# 테마 색/폰트는 XML에서 best-effort 추출
try:
from pptx.oxml.ns import qn
master_part = prs.slide_masters[0]
themeEl = master_part.element.getparent() # noqa
except Exception:
pass
out = json.dumps(spec, ensure_ascii=False, indent=2)
if a.out:
with open(a.out, "w", encoding="utf-8") as f:
f.write(out)
print(f"기록: {a.out} (layouts={len(spec['layouts'])})")
else:
print(out)
if __name__ == "__main__":
main()