File tree Expand file tree Collapse file tree 2 files changed +12
-17
lines changed Expand file tree Collapse file tree 2 files changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -58,19 +58,22 @@ def text_frame(self) -> "TextFrame":
5858 return TextFrame (self ._pptx .text_frame )
5959
6060
61- class SubShape (PptxConvertible [PptxSubshape ]):
62- def __init__ (self , pptx_shape : PptxSubshape ) -> None :
63- self ._pptx : PptxSubshape = pptx_shape
61+ _GenericPptxSubshape = TypeVar ("_GenericPptxSubshape" , bound = PptxSubshape )
62+
63+
64+ class SubShape (PptxConvertible [_GenericPptxSubshape ]):
65+ def __init__ (self , pptx_shape : _GenericPptxSubshape ) -> None :
66+ self ._pptx : _GenericPptxSubshape = pptx_shape
6467
6568 @property
6669 def part (self ) -> XmlPart :
6770 return self ._pptx .part
6871
69- def to_pptx (self ) -> PptxSubshape :
72+ def to_pptx (self ) -> _GenericPptxSubshape :
7073 return self ._pptx
7174
7275 @classmethod
73- def from_pptx (cls , pptx_obj : PptxSubshape ) -> Self :
76+ def from_pptx (cls , pptx_obj : _GenericPptxSubshape ) -> Self :
7477 return cls (pptx_obj )
7578
7679
Original file line number Diff line number Diff line change 1- from typing import Self
2-
31from pptx .enum .text import MSO_AUTO_SIZE , MSO_VERTICAL_ANCHOR
42from pptx .text .text import TextFrame as PptxTextFrame
53from pptx .util import Length as PptxLength
64
7- from tppt .pptx .converter import PptxConvertible , to_pptx_length
5+ from tppt .pptx .converter import to_pptx_length
6+ from tppt .pptx .shape import SubShape
87from tppt .pptx .text .paragraph import Paragraph
98from tppt .types ._length import EnglishMetricUnits , Length , LiteralLength , to_emu
109
1110
12- class TextFrame (PptxConvertible [PptxTextFrame ]):
11+ class TextFrame (SubShape [PptxTextFrame ]):
1312 def __init__ (self , pptx_obj : PptxTextFrame ) -> None :
14- self . _pptx = pptx_obj
13+ super (). __init__ ( pptx_obj )
1514
1615 def add_paragraph (self ) -> Paragraph :
1716 return Paragraph (self ._pptx .add_paragraph ())
@@ -96,10 +95,3 @@ def word_wrap(self) -> bool | None:
9695 @word_wrap .setter
9796 def word_wrap (self , value : bool | None ) -> None :
9897 self ._pptx .word_wrap = value
99-
100- def to_pptx (self ) -> PptxTextFrame :
101- return self ._pptx
102-
103- @classmethod
104- def from_pptx (cls , pptx_obj : PptxTextFrame ) -> Self :
105- return cls (pptx_obj )
You can’t perform that action at this time.
0 commit comments