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

Class NotesSlide

src/pptx/slide.py:101–173  ·  view source on GitHub ↗

Notes slide object. Provides access to slide notes placeholder and other shapes on the notes handout page.

Source from the content-addressed store, hash-verified

99
100
101class NotesSlide(_BaseSlide):
102 """Notes slide object.
103
104 Provides access to slide notes placeholder and other shapes on the notes handout
105 page.
106 """
107
108 element: CT_NotesSlide # pyright: ignore[reportIncompatibleMethodOverride]
109
110 def clone_master_placeholders(self, notes_master: NotesMaster) -> None:
111 """Selectively add placeholder shape elements from `notes_master`.
112
113 Selected placeholder shape elements from `notes_master` are added to the shapes
114 collection of this notes slide. Z-order of placeholders is preserved. Certain
115 placeholders (header, date, footer) are not cloned.
116 """
117
118 def iter_cloneable_placeholders() -> Iterator[MasterPlaceholder]:
119 """Generate a reference to each cloneable placeholder in `notes_master`.
120
121 These are the placeholders that should be cloned to a notes slide when the a new notes
122 slide is created.
123 """
124 cloneable = (
125 PP_PLACEHOLDER.SLIDE_IMAGE,
126 PP_PLACEHOLDER.BODY,
127 PP_PLACEHOLDER.SLIDE_NUMBER,
128 )
129 for placeholder in notes_master.placeholders:
130 if placeholder.element.ph_type in cloneable:
131 yield placeholder
132
133 shapes = self.shapes
134 for placeholder in iter_cloneable_placeholders():
135 shapes.clone_placeholder(cast("LayoutPlaceholder", placeholder))
136
137 @property
138 def notes_placeholder(self) -> NotesSlidePlaceholder | None:
139 """the notes placeholder on this notes slide, the shape that contains the actual notes text.
140
141 Return |None| if no notes placeholder is present; while this is probably uncommon, it can
142 happen if the notes master does not have a body placeholder, or if the notes placeholder
143 has been deleted from the notes slide.
144 """
145 for placeholder in self.placeholders:
146 if placeholder.placeholder_format.type == PP_PLACEHOLDER.BODY:
147 return placeholder
148 return None
149
150 @property
151 def notes_text_frame(self) -> TextFrame | None:
152 """The text frame of the notes placeholder on this notes slide.
153
154 |None| if there is no notes placeholder. This is a shortcut to accommodate the common case
155 of simply adding "notes" text to the notes "page".
156 """
157 notes_placeholder = self.notes_placeholder
158 if notes_placeholder is None:

Callers 6

notes_slideMethod · 0.90
notes_ph_fixtureMethod · 0.90
notes_tf_fixtureMethod · 0.90
placeholders_fixtureMethod · 0.90
shapes_fixtureMethod · 0.90

Calls

no outgoing calls

Tested by 5

notes_ph_fixtureMethod · 0.72
notes_tf_fixtureMethod · 0.72
placeholders_fixtureMethod · 0.72
shapes_fixtureMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…