MCPcopy Create free account
hub / github.com/scanny/python-pptx / SlideLayout

Class SlideLayout

src/pptx/slide.py:296–341  ·  view source on GitHub ↗

Slide layout object. Provides access to placeholders, regular shapes, and slide layout-level properties.

Source from the content-addressed store, hash-verified

294
295
296class SlideLayout(_BaseSlide):
297 """Slide layout object.
298
299 Provides access to placeholders, regular shapes, and slide layout-level properties.
300 """
301
302 part: SlideLayoutPart # pyright: ignore[reportIncompatibleMethodOverride]
303
304 def iter_cloneable_placeholders(self) -> Iterator[LayoutPlaceholder]:
305 """Generate layout-placeholders on this slide-layout that should be cloned to a new slide.
306
307 Used when creating a new slide from this slide-layout.
308 """
309 latent_ph_types = (
310 PP_PLACEHOLDER.DATE,
311 PP_PLACEHOLDER.FOOTER,
312 PP_PLACEHOLDER.SLIDE_NUMBER,
313 )
314 for ph in self.placeholders:
315 if ph.element.ph_type not in latent_ph_types:
316 yield ph
317
318 @lazyproperty
319 def placeholders(self) -> LayoutPlaceholders:
320 """Sequence of placeholder shapes in this slide layout.
321
322 Placeholders appear in `idx` order.
323 """
324 return LayoutPlaceholders(self._element.spTree, self)
325
326 @lazyproperty
327 def shapes(self) -> LayoutShapes:
328 """Sequence of shapes appearing on this slide layout."""
329 return LayoutShapes(self._element.spTree, self)
330
331 @property
332 def slide_master(self) -> SlideMaster:
333 """Slide master from which this slide-layout inherits properties."""
334 return self.part.slide_master
335
336 @property
337 def used_by_slides(self):
338 """Tuple of slide objects based on this slide layout."""
339 # ---getting Slides collection requires going around the horn a bit---
340 slides = self.part.package.presentation_part.presentation.slides
341 return tuple(s for s in slides if s.slide_layout == self)
342
343
344class SlideLayouts(ParentedElementProxy):

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…