forked from scanny/python-pptx
-
Notifications
You must be signed in to change notification settings - Fork 0
[Epic] Slide Masters, Layouts & .potx Templates #19
Copy link
Copy link
Open
Labels
area:mastersFeature area: mastersFeature area: mastersepicMulti-feature roadmap epicMulti-feature roadmap epicprior-art:forkActive community fork has shipped thisActive community fork has shipped thisprior-art:upstream-prOpen PR on scanny/python-pptx is candidate cherry-pickOpen PR on scanny/python-pptx is candidate cherry-pickpriority:P1Important but not urgentImportant but not urgent
Milestone
Metadata
Metadata
Assignees
Labels
area:mastersFeature area: mastersFeature area: mastersepicMulti-feature roadmap epicMulti-feature roadmap epicprior-art:forkActive community fork has shipped thisActive community fork has shipped thisprior-art:upstream-prOpen PR on scanny/python-pptx is candidate cherry-pickOpen PR on scanny/python-pptx is candidate cherry-pickpriority:P1Important but not urgentImportant but not urgent
Problem
Slide masters and layouts are visible-but-frozen. Users can read the master/layout shape lists but cannot programmatically add new layouts (scanny/python-pptx#1091, #413), apply layouts from one master to another (#1028), or read
.potxtemplate files (#1070, #1095) —Presentation()raises on.potxbecause the content-type allowlist doesn't include.template. Adding shapes/pictures to a Slide Master is impossible (#575, 11c). Content placeholders are partial (#333, 12c).Sub-features
Presentation()accepts.potxfiles (one-line content-type allowlist fix)Presentation.save_as_potx(path)— write a template by changing the content-typeSlideMasters.add_layout(name, copy_from=None)— add a new<p:sldLayout>part with relsSlideLayouts.copy_from(other_layout)— duplicate a layout including placeholders and shapesSlideMaster.shapes.add_*— author shapes/pictures directly on a master (not inherited via layout)SlideLayout.placeholders.add(idx, type, ...)— programmatically add placeholdersmaster_ato a slide that's inheriting frommaster_b(cross-master rel resolution)SlideMaster.get_layout(slide_layout_id, default=None)(scanny/python-pptx#269)Prior art
add_slide_layout(wkpark — clean, ~111 LOC). scanny/python-pptx#1071 POTX read (9021007 — one-line allowlist fix). scanny/python-pptx#1044 textbox-to-layout. scanny/python-pptx#604 object placeholder (WIP). scanny/python-pptx#292 layout-names refactor (21k LOC — review carefully, may be too sweeping).wkpark/python-pptxslidelayoutbranch.<p:sldLayout>, §19.3.1.44<p:sldMaster>, content-typeapplication/vnd.openxmlformats-officedocument.presentationml.template.main+xml(POTX).src/pptx/parts/slidemaster.py,src/pptx/parts/slidelayout.py,src/pptx/slides.py(SlideMasters/SlideLayouts),src/pptx/__init__.py(content-type registration),src/pptx/oxml/presentation.py.Acceptance criteria
Presentation("template.potx")opens without error.pres.save_as_potx("out.potx")produces a file PowerPoint recognizes as a template.master.add_layout("Three Columns")creates a new layout that's selectable in PowerPoint's layout pane.Effort: M