Find the an element in a slide. Args: slide (SlidePage): The slide element_id (int): The ID of the element. Returns: ShapeElement: The shape corresponding to the element ID. Raises: IndexError: If the element is not found.
(slide: SlidePage, element_id: int)
| 157 | |
| 158 | # supporting functions |
| 159 | def element_index(slide: SlidePage, element_id: int) -> ShapeElement: |
| 160 | """ |
| 161 | Find the an element in a slide. |
| 162 | |
| 163 | Args: |
| 164 | slide (SlidePage): The slide |
| 165 | element_id (int): The ID of the element. |
| 166 | |
| 167 | Returns: |
| 168 | ShapeElement: The shape corresponding to the element ID. |
| 169 | |
| 170 | Raises: |
| 171 | IndexError: If the element is not found. |
| 172 | """ |
| 173 | for shape in slide: |
| 174 | if shape.shape_idx == element_id: |
| 175 | return shape |
| 176 | raise IndexError(f"Cannot find element {element_id}, is it deleted or not exist?") |
| 177 | |
| 178 | |
| 179 | def replace_para(paragraph_id: int, new_text: str, shape: BaseShape): |
no outgoing calls
no test coverage detected