python-pptx2 2.13.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pptx2/__init__.py +152 -0
- pptx2/_color.py +75 -0
- pptx2/_slide_importer.py +597 -0
- pptx2/_svg.py +155 -0
- pptx2/_template_applier.py +292 -0
- pptx2/_textstyle.py +187 -0
- pptx2/accessibility.py +365 -0
- pptx2/action.py +270 -0
- pptx2/animation.py +2237 -0
- pptx2/api.py +49 -0
- pptx2/audit.py +258 -0
- pptx2/chart/__init__.py +0 -0
- pptx2/chart/analytics.py +381 -0
- pptx2/chart/axis.py +543 -0
- pptx2/chart/category.py +200 -0
- pptx2/chart/chart.py +670 -0
- pptx2/chart/data.py +864 -0
- pptx2/chart/datalabel.py +406 -0
- pptx2/chart/legend.py +86 -0
- pptx2/chart/marker.py +70 -0
- pptx2/chart/palettes.py +129 -0
- pptx2/chart/plot.py +462 -0
- pptx2/chart/point.py +101 -0
- pptx2/chart/quick_layouts.py +325 -0
- pptx2/chart/series.py +334 -0
- pptx2/chart/xlsx.py +272 -0
- pptx2/chart/xmlwriter.py +1845 -0
- pptx2/compose/__init__.py +28 -0
- pptx2/compose/from_spec.py +1094 -0
- pptx2/design/__init__.py +8 -0
- pptx2/design/components.py +607 -0
- pptx2/design/figures.py +389 -0
- pptx2/design/layout.py +370 -0
- pptx2/design/recipes.py +1967 -0
- pptx2/design/style.py +209 -0
- pptx2/design/tokens.py +915 -0
- pptx2/diagrams.py +754 -0
- pptx2/dml/__init__.py +0 -0
- pptx2/dml/chtfmt.py +40 -0
- pptx2/dml/color.py +496 -0
- pptx2/dml/effect.py +909 -0
- pptx2/dml/fill.py +691 -0
- pptx2/dml/line.py +287 -0
- pptx2/dml/picture.py +212 -0
- pptx2/dml/three_d.py +381 -0
- pptx2/enum/__init__.py +0 -0
- pptx2/enum/action.py +71 -0
- pptx2/enum/animation.py +31 -0
- pptx2/enum/base.py +218 -0
- pptx2/enum/chart.py +574 -0
- pptx2/enum/dml.py +740 -0
- pptx2/enum/lang.py +685 -0
- pptx2/enum/presentation.py +133 -0
- pptx2/enum/shapes.py +1029 -0
- pptx2/enum/text.py +230 -0
- pptx2/exc.py +42 -0
- pptx2/formats.py +139 -0
- pptx2/geometry.py +420 -0
- pptx2/inherit.py +109 -0
- pptx2/lint.py +2256 -0
- pptx2/math.py +177 -0
- pptx2/media.py +197 -0
- pptx2/opc/__init__.py +0 -0
- pptx2/opc/constants.py +332 -0
- pptx2/opc/oxml.py +188 -0
- pptx2/opc/package.py +762 -0
- pptx2/opc/packuri.py +109 -0
- pptx2/opc/serialized.py +296 -0
- pptx2/opc/shared.py +20 -0
- pptx2/opc/spec.py +45 -0
- pptx2/oxml/__init__.py +555 -0
- pptx2/oxml/action.py +53 -0
- pptx2/oxml/chart/__init__.py +0 -0
- pptx2/oxml/chart/axis.py +337 -0
- pptx2/oxml/chart/chart.py +481 -0
- pptx2/oxml/chart/datalabel.py +253 -0
- pptx2/oxml/chart/legend.py +72 -0
- pptx2/oxml/chart/marker.py +61 -0
- pptx2/oxml/chart/plot.py +365 -0
- pptx2/oxml/chart/series.py +425 -0
- pptx2/oxml/chart/shared.py +220 -0
- pptx2/oxml/coreprops.py +288 -0
- pptx2/oxml/dml/__init__.py +0 -0
- pptx2/oxml/dml/color.py +135 -0
- pptx2/oxml/dml/effect.py +213 -0
- pptx2/oxml/dml/fill.py +316 -0
- pptx2/oxml/dml/line.py +12 -0
- pptx2/oxml/dml/three_d.py +110 -0
- pptx2/oxml/ns.py +135 -0
- pptx2/oxml/presentation.py +313 -0
- pptx2/oxml/shapes/__init__.py +19 -0
- pptx2/oxml/shapes/autoshape.py +467 -0
- pptx2/oxml/shapes/connector.py +107 -0
- pptx2/oxml/shapes/graphfrm.py +347 -0
- pptx2/oxml/shapes/groupshape.py +329 -0
- pptx2/oxml/shapes/picture.py +270 -0
- pptx2/oxml/shapes/shared.py +577 -0
- pptx2/oxml/simpletypes.py +1027 -0
- pptx2/oxml/slide.py +563 -0
- pptx2/oxml/table.py +650 -0
- pptx2/oxml/text.py +815 -0
- pptx2/oxml/theme.py +36 -0
- pptx2/oxml/xmlchemy.py +717 -0
- pptx2/package.py +222 -0
- pptx2/parts/__init__.py +0 -0
- pptx2/parts/chart.py +95 -0
- pptx2/parts/coreprops.py +167 -0
- pptx2/parts/diagram.py +37 -0
- pptx2/parts/embeddedpackage.py +93 -0
- pptx2/parts/image.py +275 -0
- pptx2/parts/media.py +37 -0
- pptx2/parts/presentation.py +136 -0
- pptx2/parts/slide.py +371 -0
- pptx2/presentation.py +408 -0
- pptx2/py.typed +0 -0
- pptx2/render.py +586 -0
- pptx2/section.py +272 -0
- pptx2/shapes/__init__.py +26 -0
- pptx2/shapes/autoshape.py +442 -0
- pptx2/shapes/base.py +1078 -0
- pptx2/shapes/connector.py +297 -0
- pptx2/shapes/freeform.py +337 -0
- pptx2/shapes/graphfrm.py +316 -0
- pptx2/shapes/group.py +264 -0
- pptx2/shapes/picture.py +422 -0
- pptx2/shapes/placeholder.py +468 -0
- pptx2/shapes/shapetree.py +2027 -0
- pptx2/shared.py +82 -0
- pptx2/skill/SKILL.md +450 -0
- pptx2/skill/__init__.py +78 -0
- pptx2/skill/__main__.py +64 -0
- pptx2/skill/references/animations.md +189 -0
- pptx2/skill/references/basics.md +421 -0
- pptx2/skill/references/charts.md +254 -0
- pptx2/skill/references/compose.md +234 -0
- pptx2/skill/references/design.md +366 -0
- pptx2/skill/references/effects.md +249 -0
- pptx2/skill/references/end-to-end-deck.md +231 -0
- pptx2/skill/references/geometry-and-arrows.md +334 -0
- pptx2/skill/references/lint.md +275 -0
- pptx2/skill/references/math.md +86 -0
- pptx2/skill/references/picture-effects.md +129 -0
- pptx2/skill/references/render.md +151 -0
- pptx2/skill/references/smart-art.md +75 -0
- pptx2/skill/references/space-aware-authoring.md +249 -0
- pptx2/skill/references/tables.md +244 -0
- pptx2/skill/references/theme.md +127 -0
- pptx2/skill/references/three-d.md +109 -0
- pptx2/skill/references/transitions.md +100 -0
- pptx2/slide.py +1244 -0
- pptx2/smart_art.py +220 -0
- pptx2/spec.py +633 -0
- pptx2/table.py +1181 -0
- pptx2/table_styles.py +184 -0
- pptx2/templates/default.pptx +0 -0
- pptx2/templates/docx-icon.emf +0 -0
- pptx2/templates/generic-icon.emf +0 -0
- pptx2/templates/notes.xml +23 -0
- pptx2/templates/notesMaster.xml +352 -0
- pptx2/templates/pptx-icon.emf +0 -0
- pptx2/templates/theme.xml +321 -0
- pptx2/templates/xlsx-icon.emf +0 -0
- pptx2/text/__init__.py +0 -0
- pptx2/text/fonts.py +482 -0
- pptx2/text/layout.py +374 -0
- pptx2/text/text.py +1272 -0
- pptx2/theme.py +721 -0
- pptx2/types.py +36 -0
- pptx2/util.py +263 -0
- python_pptx2-2.13.0.dist-info/METADATA +351 -0
- python_pptx2-2.13.0.dist-info/RECORD +175 -0
- python_pptx2-2.13.0.dist-info/WHEEL +5 -0
- python_pptx2-2.13.0.dist-info/entry_points.txt +3 -0
- python_pptx2-2.13.0.dist-info/licenses/LICENSE +22 -0
- python_pptx2-2.13.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# 3D primitives (Phase 8)
|
|
2
|
+
|
|
3
|
+
`shape.three_d` exposes bevels (`<a:bevelT>` / `<a:bevelB>`) and
|
|
4
|
+
extrusion (`<a:sp3d>`), backed by `CT_Shape3D` and `CT_Scene3D` element
|
|
5
|
+
classes in `pptx2.oxml.dml.three_d`.
|
|
6
|
+
|
|
7
|
+
## Bevels
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from pptx2.util import Pt
|
|
11
|
+
from pptx2.enum.dml import BevelPreset
|
|
12
|
+
|
|
13
|
+
three_d = card.three_d
|
|
14
|
+
|
|
15
|
+
# Top bevel
|
|
16
|
+
three_d.bevel_top.preset = BevelPreset.SOFT_ROUND
|
|
17
|
+
three_d.bevel_top.width = Pt(6)
|
|
18
|
+
three_d.bevel_top.height = Pt(3)
|
|
19
|
+
|
|
20
|
+
# Bottom bevel (less common)
|
|
21
|
+
three_d.bevel_bottom.preset = BevelPreset.ANGLE
|
|
22
|
+
three_d.bevel_bottom.width = Pt(2)
|
|
23
|
+
three_d.bevel_bottom.height = Pt(1)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`BevelPreset` covers the standard PowerPoint set: `RELAXED_INSET`,
|
|
27
|
+
`CIRCLE`, `SLOPE`, `CROSS`, `ANGLE`, `SOFT_ROUND`, `CONVEX`, `COOL_SLANT`,
|
|
28
|
+
`DIVOT`, `RIBLET`, `HARD_EDGE`, `ART_DECO`.
|
|
29
|
+
|
|
30
|
+
To turn a bevel back off, assign `BevelPreset.NONE` — it removes the
|
|
31
|
+
bevel entirely (`three_d.bevel_top.preset = BevelPreset.NONE`). Don't
|
|
32
|
+
worry about it emitting an invalid `"none"` token; the setter maps it to
|
|
33
|
+
element removal, so the deck stays schema-clean.
|
|
34
|
+
|
|
35
|
+
## Extrusion
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from pptx2.dml.color import RGBColor
|
|
39
|
+
|
|
40
|
+
three_d.extrusion_height = Pt(20)
|
|
41
|
+
three_d.extrusion_color = RGBColor(0x12, 0x1E, 0x4D)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Contour
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
three_d.contour_width = Pt(1)
|
|
48
|
+
three_d.contour_color = RGBColor(0xFF, 0xFF, 0xFF)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Material preset
|
|
52
|
+
|
|
53
|
+
Material affects how the surface reacts to scene lighting:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from pptx2.enum.dml import PresetMaterial
|
|
57
|
+
|
|
58
|
+
three_d.preset_material = PresetMaterial.METAL
|
|
59
|
+
# Other options: MATTE, PLASTIC, METAL, WARM_MATTE, TRANSLUCENT_POWDER,
|
|
60
|
+
# POWDER, DK_EDGE, SOFT_EDGE, CLEAR, FLAT, SOFT_METAL
|
|
61
|
+
# (also LEGACY_MATTE / LEGACY_METAL / LEGACY_PLASTIC / LEGACY_WIREFRAME)
|
|
62
|
+
# Note it is DK_EDGE, not DARK_EDGE.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`PresetMaterial.NONE` clears the material (leaves it unset, reads back as
|
|
66
|
+
`None`); use `PresetMaterial.FLAT` for an explicit non-reflective flat
|
|
67
|
+
surface.
|
|
68
|
+
|
|
69
|
+
## End-to-end: a beveled badge
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from pptx2 import Presentation
|
|
73
|
+
from pptx2.util import Inches, Pt
|
|
74
|
+
from pptx2.enum.shapes import MSO_SHAPE
|
|
75
|
+
from pptx2.enum.dml import BevelPreset, PresetMaterial
|
|
76
|
+
from pptx2.dml.color import RGBColor
|
|
77
|
+
|
|
78
|
+
prs = Presentation()
|
|
79
|
+
slide = prs.slides.add_slide(prs.slide_layouts[6])
|
|
80
|
+
|
|
81
|
+
badge = slide.shapes.add_shape(
|
|
82
|
+
MSO_SHAPE.OVAL,
|
|
83
|
+
Inches(5.5), Inches(3.0), Inches(2.0), Inches(2.0),
|
|
84
|
+
)
|
|
85
|
+
badge.fill.solid()
|
|
86
|
+
badge.fill.fore_color.rgb = RGBColor(0xFF, 0xC1, 0x07)
|
|
87
|
+
badge.line.fill.background()
|
|
88
|
+
|
|
89
|
+
td = badge.three_d
|
|
90
|
+
td.bevel_top.preset = BevelPreset.SOFT_ROUND
|
|
91
|
+
td.bevel_top.width = Pt(8)
|
|
92
|
+
td.bevel_top.height = Pt(4)
|
|
93
|
+
td.preset_material = PresetMaterial.METAL
|
|
94
|
+
|
|
95
|
+
# Combine with a soft shadow for depth
|
|
96
|
+
badge.shadow.blur_radius = Pt(12)
|
|
97
|
+
badge.shadow.distance = Pt(4)
|
|
98
|
+
badge.shadow.direction = 90.0
|
|
99
|
+
badge.shadow.color.alpha = 0.3
|
|
100
|
+
|
|
101
|
+
prs.save("badge.pptx")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Round-trip
|
|
105
|
+
|
|
106
|
+
The `<a:scene3d>` and `<a:sp3d>` slots were already reserved in the
|
|
107
|
+
upstream `oxml/shapes/shared.py`; this proxy just gives them a public
|
|
108
|
+
read/write face. PowerPoint-authored 3D round-trips cleanly even if
|
|
109
|
+
you don't touch the proxy.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Slide transitions (Phase 4)
|
|
2
|
+
|
|
3
|
+
Each slide exposes a `transition` proxy backed by `<p:transition>`.
|
|
4
|
+
Reads on an unset transition return `None` and never mutate XML,
|
|
5
|
+
keeping theme inheritance intact.
|
|
6
|
+
|
|
7
|
+
## Per-slide
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from pptx2.enum.presentation import MSO_TRANSITION_TYPE
|
|
11
|
+
|
|
12
|
+
slide.transition.kind = MSO_TRANSITION_TYPE.MORPH
|
|
13
|
+
slide.transition.duration = 1500 # milliseconds
|
|
14
|
+
slide.transition.advance_on_click = True
|
|
15
|
+
slide.transition.advance_after = 5000 # 5-second auto-advance
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
To remove a transition entirely:
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
slide.transition.clear()
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Reads without explicit settings:
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
if slide.transition.kind is None:
|
|
28
|
+
print("inherits from theme")
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Supported kinds
|
|
32
|
+
|
|
33
|
+
`MSO_TRANSITION_TYPE` covers 25+ kinds including Office 2010+
|
|
34
|
+
extension transitions on the `p14:` namespace:
|
|
35
|
+
|
|
36
|
+
- Classics: `FADE`, `PUSH`, `WIPE`, `SPLIT`, `REVEAL`, `RANDOM_BARS`,
|
|
37
|
+
`SHAPE`, `UNCOVER`, `COVER`, `CUT`, `DISSOLVE`, `ZOOM`
|
|
38
|
+
- Office 2010+ (p14): `MORPH`, `VORTEX`, `CONVEYOR`, `SWITCH`,
|
|
39
|
+
`GALLERY`, `FLY_THROUGH`, `RIPPLE`, `HONEYCOMB`, `GLITTER`, `ORBIT`,
|
|
40
|
+
`PAN`, `WARP`, `WIND`
|
|
41
|
+
|
|
42
|
+
Direction modifiers (`fromLeft`, `fromTop`, etc.) are not yet
|
|
43
|
+
exposed by the high-level API — they round-trip but you have to set
|
|
44
|
+
them through the underlying element.
|
|
45
|
+
|
|
46
|
+
## Deck-wide helper
|
|
47
|
+
|
|
48
|
+
`Presentation.set_transition(...)` applies the same transition (or a
|
|
49
|
+
partial update) to every slide in one call. Unspecified kwargs leave
|
|
50
|
+
each slide's existing setting untouched:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
prs.set_transition(kind=MSO_TRANSITION_TYPE.FADE, duration=750)
|
|
54
|
+
|
|
55
|
+
# Bump the duration on every slide without changing the kind
|
|
56
|
+
prs.set_transition(duration=1200)
|
|
57
|
+
|
|
58
|
+
# Turn on auto-advance everywhere without disturbing kind or duration
|
|
59
|
+
prs.set_transition(advance_on_click=True, advance_after=8000)
|
|
60
|
+
|
|
61
|
+
# Remove the transition element on every slide
|
|
62
|
+
prs.set_transition(kind=None)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## End-to-end example
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from pptx2 import Presentation
|
|
69
|
+
from pptx2.enum.presentation import MSO_TRANSITION_TYPE
|
|
70
|
+
from pptx2.util import Inches
|
|
71
|
+
|
|
72
|
+
prs = Presentation()
|
|
73
|
+
|
|
74
|
+
# Slide 1 — title
|
|
75
|
+
slide1 = prs.slides.add_slide(prs.slide_layouts[0])
|
|
76
|
+
slide1.shapes.title.text = "Q4 Review"
|
|
77
|
+
slide1.placeholders[1].text = "April 2026"
|
|
78
|
+
|
|
79
|
+
# Slide 2 — content
|
|
80
|
+
slide2 = prs.slides.add_slide(prs.slide_layouts[5])
|
|
81
|
+
slide2.shapes.title.text = "Run-rate metrics"
|
|
82
|
+
|
|
83
|
+
# Use Morph between the two title slides
|
|
84
|
+
slide1.transition.kind = MSO_TRANSITION_TYPE.MORPH
|
|
85
|
+
slide1.transition.duration = 1500
|
|
86
|
+
|
|
87
|
+
# Default everything else to a quick fade
|
|
88
|
+
prs.set_transition(kind=MSO_TRANSITION_TYPE.FADE, duration=400)
|
|
89
|
+
# (set_transition won't overwrite slide1's already-set kind unless the
|
|
90
|
+
# kind kwarg is provided — but we passed kind here, so for slide1 it
|
|
91
|
+
# WILL be overwritten. To preserve slide1, set it AFTER the deck-wide
|
|
92
|
+
# call instead.)
|
|
93
|
+
|
|
94
|
+
# Correct order:
|
|
95
|
+
prs.set_transition(kind=MSO_TRANSITION_TYPE.FADE, duration=400)
|
|
96
|
+
slide1.transition.kind = MSO_TRANSITION_TYPE.MORPH
|
|
97
|
+
slide1.transition.duration = 1500
|
|
98
|
+
|
|
99
|
+
prs.save("with-transitions.pptx")
|
|
100
|
+
```
|