(
cls,
slide_idx: int,
shape_idx: int,
shape: SlidePlaceholder,
style: dict,
text_frame: TextFrame,
config: Config,
slide_area: float,
level: int,
)
| 686 | class Placeholder(ShapeElement): |
| 687 | @classmethod |
| 688 | def from_shape( |
| 689 | cls, |
| 690 | slide_idx: int, |
| 691 | shape_idx: int, |
| 692 | shape: SlidePlaceholder, |
| 693 | style: dict, |
| 694 | text_frame: TextFrame, |
| 695 | config: Config, |
| 696 | slide_area: float, |
| 697 | level: int, |
| 698 | ): |
| 699 | assert ( |
| 700 | sum( |
| 701 | [ |
| 702 | shape.has_text_frame, |
| 703 | shape.has_chart, |
| 704 | shape.has_table, |
| 705 | isinstance(shape, PlaceholderPicture), |
| 706 | ] |
| 707 | ) |
| 708 | == 1 |
| 709 | ), "placeholder should have only one type" |
| 710 | if isinstance(shape, PlaceholderPicture): |
| 711 | data = Picture.from_shape( |
| 712 | slide_idx, |
| 713 | shape_idx, |
| 714 | shape, |
| 715 | style, |
| 716 | text_frame, |
| 717 | config, |
| 718 | slide_area, |
| 719 | level, |
| 720 | ) |
| 721 | elif shape.has_text_frame: |
| 722 | data = TextBox.from_shape( |
| 723 | slide_idx, |
| 724 | shape_idx, |
| 725 | shape, |
| 726 | style, |
| 727 | text_frame, |
| 728 | config, |
| 729 | slide_area, |
| 730 | level, |
| 731 | ) |
| 732 | else: |
| 733 | raise ValueError(f"unsupported placeholder {shape.placeholder_type}") |
| 734 | return data |
| 735 | |
| 736 | |
| 737 | class GroupShape(ShapeElement): |
nothing calls this directly
no test coverage detected