feat: add move_slide, duplicate_slide, and SlideShapes.add_copy_of()#1141
Open
ska-sleepy wants to merge 4 commits into
Open
feat: add move_slide, duplicate_slide, and SlideShapes.add_copy_of()#1141ska-sleepy wants to merge 4 commits into
ska-sleepy wants to merge 4 commits into
Conversation
feat: add move_slide, duplicate_slide, and SlideShapes.add_copy_of()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three slide/shape operations that have no native equivalent in the current API:
Slides.move_slide(slide, position)— reorder a slide to any 0-based position in the sequenceSlides.duplicate_slide(slide, position=None)— clone a slide; new slide lands after the source by default; related OPC parts (images, charts) are shared, not deep-copiedSlideShapes.add_copy_of(source_shape)— append a deep copy of a shape from any slide onto this slide's shape tree; shapes with embedded parts share those parts with the sourceInternals
SlidePart.clone(source, package)— creates a newSlidePartfrom a deep copy of the source element, reproducing relationships in ascending rId order so XML rId references remain validPresentationPart.duplicate_slide(source_slide_part)— delegates toSlidePart.cloneand registers the new partLimitations
duplicate_slide: Notes slides attached to the source are not duplicatedadd_copy_of: For picture/chart shapes the underlying OPC parts are shared; editing the image or chart data affects both the original and the copyTest plan
tests/test_slide.py::DescribeSlides::it_can_move_a_slidetests/test_slide.py::DescribeSlides::it_does_nothing_when_move_slide_target_equals_current_positiontests/test_slide.py::DescribeSlides::it_can_duplicate_a_slidetests/shapes/test_shapetree.py::DescribeSlideShapes::it_can_add_a_copy_of_a_shape_from_another_slide