-
Notifications
You must be signed in to change notification settings - Fork 695
Expand file tree
/
Copy path__init__.py
More file actions
82 lines (72 loc) · 2.05 KB
/
__init__.py
File metadata and controls
82 lines (72 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""Initialization module for python-pptx package."""
from __future__ import annotations
import sys
from typing import TYPE_CHECKING
import pptx.exc as exceptions
from pptx.api import Presentation
from pptx.opc.constants import CONTENT_TYPE as CT
from pptx.opc.package import PartFactory
from pptx.parts.chart import ChartPart
from pptx.parts.coreprops import CorePropertiesPart
from pptx.parts.image import ImagePart
from pptx.parts.media import MediaPart
from pptx.parts.presentation import PresentationPart
from pptx.parts.slide import (
NotesMasterPart,
NotesSlidePart,
SlideLayoutPart,
SlideMasterPart,
SlidePart,
)
if TYPE_CHECKING:
from pptx.opc.package import Part
__version__ = "1.0.2"
sys.modules["pptx.exceptions"] = exceptions
del sys
__all__ = ["Presentation"]
content_type_to_part_class_map: dict[str, type[Part]] = {
CT.PML_PRESENTATION_MAIN: PresentationPart,
CT.PML_PRES_MACRO_MAIN: PresentationPart,
CT.PML_TEMPLATE_MAIN: PresentationPart,
CT.PML_SLIDESHOW_MAIN: PresentationPart,
CT.OPC_CORE_PROPERTIES: CorePropertiesPart,
CT.PML_NOTES_MASTER: NotesMasterPart,
CT.PML_NOTES_SLIDE: NotesSlidePart,
CT.PML_SLIDE: SlidePart,
CT.PML_SLIDE_LAYOUT: SlideLayoutPart,
CT.PML_SLIDE_MASTER: SlideMasterPart,
CT.DML_CHART: ChartPart,
CT.BMP: ImagePart,
CT.GIF: ImagePart,
CT.JPEG: ImagePart,
CT.MS_PHOTO: ImagePart,
CT.PNG: ImagePart,
CT.TIFF: ImagePart,
CT.X_EMF: ImagePart,
CT.X_WMF: ImagePart,
CT.ASF: MediaPart,
CT.AVI: MediaPart,
CT.MOV: MediaPart,
CT.MP4: MediaPart,
CT.MPG: MediaPart,
CT.MS_VIDEO: MediaPart,
CT.SWF: MediaPart,
CT.VIDEO: MediaPart,
CT.WMV: MediaPart,
CT.X_MS_VIDEO: MediaPart,
# -- accommodate "image/jpg" as an alias for "image/jpeg" --
"image/jpg": ImagePart,
}
PartFactory.part_type_for.update(content_type_to_part_class_map)
del (
ChartPart,
CorePropertiesPart,
ImagePart,
MediaPart,
SlidePart,
SlideLayoutPart,
SlideMasterPart,
PresentationPart,
CT,
PartFactory,
)