|  |  |  |  |  |  | 
													
												
													
														|  |  | #  See the License for the specific language governing permissions and |  |  | #  See the License for the specific language governing permissions and | 
													
												
													
														|  |  | #  limitations under the License. |  |  | #  limitations under the License. | 
													
												
													
														|  |  | # |  |  | # | 
													
												
													
														|  |  |  |  |  |  | 
													
												
													
														|  |  |  |  |  | import logging | 
													
												
													
														|  |  | from io import BytesIO |  |  | from io import BytesIO | 
													
												
													
														|  |  | from pptx import Presentation |  |  | from pptx import Presentation | 
													
												
													
														|  |  | 
 |  |  | 
 | 
													
												
											
												
													
														|  |  |  |  |  |  | 
													
												
													
														|  |  | texts = [] |  |  | texts = [] | 
													
												
													
														|  |  | for shape in sorted( |  |  | for shape in sorted( | 
													
												
													
														|  |  | slide.shapes, key=lambda x: ((x.top if x.top is not None else 0) // 10, x.left)): |  |  | slide.shapes, key=lambda x: ((x.top if x.top is not None else 0) // 10, x.left)): | 
													
												
													
														|  |  | txt = self.__extract(shape) |  |  |  | 
													
												
													
														|  |  | if txt: |  |  |  | 
													
												
													
														|  |  | texts.append(txt) |  |  |  | 
													
												
													
														|  |  |  |  |  | try: | 
													
												
													
														|  |  |  |  |  | txt = self.__extract(shape) | 
													
												
													
														|  |  |  |  |  | if txt: | 
													
												
													
														|  |  |  |  |  | texts.append(txt) | 
													
												
													
														|  |  |  |  |  | except Exception as e: | 
													
												
													
														|  |  |  |  |  | logging.exception(e) | 
													
												
													
														|  |  | txts.append("\n".join(texts)) |  |  | txts.append("\n".join(texts)) | 
													
												
													
														|  |  | 
 |  |  | 
 | 
													
												
													
														|  |  | return txts |  |  | return txts |