48 lines
1.9 KiB
Python
48 lines
1.9 KiB
Python
"""
|
|
haewon이 v12 2장에서 맞춘 카드 기준(이름 36 · 소제목 28 · 본문 24 · 라벨 24)을 다른 장에 적용해 새 버전으로 저장한다.
|
|
|
|
- haewon이 직접 고친 장(--keep=2 등)은 건드리지 않는다
|
|
- 라이트 카드 장(3·13·15)은 카드만 지우고 같은 문구로 다시 그린다. 헤더·로고·CI·CTA 는 그대로
|
|
- 보고서 장(5~12)은 report_native 로 다시 그린다
|
|
|
|
python3 docs/reports/outbound_webforai/edit_deck_restyle.py <수정본.pptx> <새 버전.pptx> 그랜드성형외과 --keep=2
|
|
"""
|
|
import os
|
|
import sys
|
|
|
|
from pptx import Presentation
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
import build_diagnosis_report as report # noqa: E402
|
|
import edit_deck_inplace as ed # noqa: E402
|
|
import report_native # noqa: E402
|
|
import run_outbound_probe as probe # noqa: E402
|
|
|
|
|
|
def in_card_band(sh):
|
|
"""카드 3장과 강조 탭(카드 위 0.3in)만. 리드문(y<3.4)과 클로징 CI·CTA(y≥9.3)는 남긴다."""
|
|
return 3.4 <= sh.top / ed.E < 9.3
|
|
|
|
|
|
def main(src, dst, name, keep):
|
|
assert not os.path.exists(dst), f"이미 있는 파일은 덮어쓰지 않습니다: {dst}"
|
|
clinics = probe.load("pilot_clinics.json")
|
|
clinic = next(c for c in clinics if c["name"] == name)
|
|
_, plan = probe.expand(clinics, probe.load("question_template.json"))
|
|
prs = Presentation(src)
|
|
s = prs.slides
|
|
for page in (3, 13, 15):
|
|
if page in keep:
|
|
continue
|
|
ed.drop(s[page - 1], lambda sh: not in_card_band(sh))
|
|
ed.cards(s[page - 1], page)
|
|
assert not keep & set(range(5, 13)), "보고서 장을 수정하셨다면 그 장은 따로 처리해야 합니다"
|
|
report_native.build(prs, report.report_data(clinic, plan))
|
|
prs.save(dst)
|
|
print(dst)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
keep = {int(x) for a in sys.argv if a.startswith("--keep=") for x in a.split("=", 1)[1].split(",")}
|
|
main(*[a for a in sys.argv[1:] if not a.startswith("--")][:3], keep)
|