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

Class SlideMasters

src/pptx/slide.py:429–456  ·  view source on GitHub ↗

Sequence of |SlideMaster| objects belonging to a presentation. Has list access semantics, supporting indexed access, len(), and iteration.

Source from the content-addressed store, hash-verified

427
428
429class SlideMasters(ParentedElementProxy):
430 """Sequence of |SlideMaster| objects belonging to a presentation.
431
432 Has list access semantics, supporting indexed access, len(), and iteration.
433 """
434
435 part: PresentationPart # pyright: ignore[reportIncompatibleMethodOverride]
436
437 def __init__(self, sldMasterIdLst: CT_SlideMasterIdList, parent: Presentation):
438 super(SlideMasters, self).__init__(sldMasterIdLst, parent)
439 self._sldMasterIdLst = sldMasterIdLst
440
441 def __getitem__(self, idx: int) -> SlideMaster:
442 """Provides indexed access, e.g. `slide_masters[2]`."""
443 try:
444 sldMasterId = self._sldMasterIdLst.sldMasterId_lst[idx]
445 except IndexError:
446 raise IndexError("slide master index out of range")
447 return self.part.related_slide_master(sldMasterId.rId)
448
449 def __iter__(self):
450 """Generate each |SlideMaster| instance in the collection, in sequence."""
451 for smi in self._sldMasterIdLst.sldMasterId_lst:
452 yield self.part.related_slide_master(smi.rId)
453
454 def __len__(self):
455 """Support len() built-in function, e.g. `len(slide_masters) == 4`."""
456 return len(self._sldMasterIdLst)
457
458
459class _Background(ElementProxy):

Callers 5

slide_mastersMethod · 0.90
getitem_fixtureMethod · 0.90
iter_fixtureMethod · 0.90
len_fixtureMethod · 0.90

Calls

no outgoing calls

Tested by 4

getitem_fixtureMethod · 0.72
iter_fixtureMethod · 0.72
len_fixtureMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…