Skip to content

Commit 03c07ee

Browse files
committed
feat: add type checking for Slide in Presentation class and implement slides property
1 parent 28dbf69 commit 03c07ee

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/tppt/_pptx/presentation.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Presentation wrapper implementation."""
22

33
import os
4-
from typing import IO, Any, Callable, Generic, Self, overload
4+
from typing import IO, TYPE_CHECKING, Any, Callable, Generic, Self, overload
55

66
from pptx.presentation import Presentation as PptxPresentation
77

@@ -17,6 +17,9 @@
1717
from .slide import SlideBuilder
1818
from .slide_master import SlideMaster
1919

20+
if TYPE_CHECKING:
21+
from tppt._pptx.slide import Slide
22+
2023

2124
class Presentation(PptxConvertible[PptxPresentation]):
2225
"""Presentation wrapper with type safety."""
@@ -28,6 +31,13 @@ def __init__(
2831
"""Initialize presentation."""
2932
self._pptx = presentation
3033

34+
@property
35+
def slides(self) -> "list[Slide]":
36+
"""Get the slides."""
37+
from tppt._pptx.slide import Slide
38+
39+
return [Slide.from_pptx(slide) for slide in self._pptx.slides]
40+
3141
@property
3242
def slide_master(self) -> SlideMaster:
3343
"""

0 commit comments

Comments
 (0)