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.
Files changed (175) hide show
  1. pptx2/__init__.py +152 -0
  2. pptx2/_color.py +75 -0
  3. pptx2/_slide_importer.py +597 -0
  4. pptx2/_svg.py +155 -0
  5. pptx2/_template_applier.py +292 -0
  6. pptx2/_textstyle.py +187 -0
  7. pptx2/accessibility.py +365 -0
  8. pptx2/action.py +270 -0
  9. pptx2/animation.py +2237 -0
  10. pptx2/api.py +49 -0
  11. pptx2/audit.py +258 -0
  12. pptx2/chart/__init__.py +0 -0
  13. pptx2/chart/analytics.py +381 -0
  14. pptx2/chart/axis.py +543 -0
  15. pptx2/chart/category.py +200 -0
  16. pptx2/chart/chart.py +670 -0
  17. pptx2/chart/data.py +864 -0
  18. pptx2/chart/datalabel.py +406 -0
  19. pptx2/chart/legend.py +86 -0
  20. pptx2/chart/marker.py +70 -0
  21. pptx2/chart/palettes.py +129 -0
  22. pptx2/chart/plot.py +462 -0
  23. pptx2/chart/point.py +101 -0
  24. pptx2/chart/quick_layouts.py +325 -0
  25. pptx2/chart/series.py +334 -0
  26. pptx2/chart/xlsx.py +272 -0
  27. pptx2/chart/xmlwriter.py +1845 -0
  28. pptx2/compose/__init__.py +28 -0
  29. pptx2/compose/from_spec.py +1094 -0
  30. pptx2/design/__init__.py +8 -0
  31. pptx2/design/components.py +607 -0
  32. pptx2/design/figures.py +389 -0
  33. pptx2/design/layout.py +370 -0
  34. pptx2/design/recipes.py +1967 -0
  35. pptx2/design/style.py +209 -0
  36. pptx2/design/tokens.py +915 -0
  37. pptx2/diagrams.py +754 -0
  38. pptx2/dml/__init__.py +0 -0
  39. pptx2/dml/chtfmt.py +40 -0
  40. pptx2/dml/color.py +496 -0
  41. pptx2/dml/effect.py +909 -0
  42. pptx2/dml/fill.py +691 -0
  43. pptx2/dml/line.py +287 -0
  44. pptx2/dml/picture.py +212 -0
  45. pptx2/dml/three_d.py +381 -0
  46. pptx2/enum/__init__.py +0 -0
  47. pptx2/enum/action.py +71 -0
  48. pptx2/enum/animation.py +31 -0
  49. pptx2/enum/base.py +218 -0
  50. pptx2/enum/chart.py +574 -0
  51. pptx2/enum/dml.py +740 -0
  52. pptx2/enum/lang.py +685 -0
  53. pptx2/enum/presentation.py +133 -0
  54. pptx2/enum/shapes.py +1029 -0
  55. pptx2/enum/text.py +230 -0
  56. pptx2/exc.py +42 -0
  57. pptx2/formats.py +139 -0
  58. pptx2/geometry.py +420 -0
  59. pptx2/inherit.py +109 -0
  60. pptx2/lint.py +2256 -0
  61. pptx2/math.py +177 -0
  62. pptx2/media.py +197 -0
  63. pptx2/opc/__init__.py +0 -0
  64. pptx2/opc/constants.py +332 -0
  65. pptx2/opc/oxml.py +188 -0
  66. pptx2/opc/package.py +762 -0
  67. pptx2/opc/packuri.py +109 -0
  68. pptx2/opc/serialized.py +296 -0
  69. pptx2/opc/shared.py +20 -0
  70. pptx2/opc/spec.py +45 -0
  71. pptx2/oxml/__init__.py +555 -0
  72. pptx2/oxml/action.py +53 -0
  73. pptx2/oxml/chart/__init__.py +0 -0
  74. pptx2/oxml/chart/axis.py +337 -0
  75. pptx2/oxml/chart/chart.py +481 -0
  76. pptx2/oxml/chart/datalabel.py +253 -0
  77. pptx2/oxml/chart/legend.py +72 -0
  78. pptx2/oxml/chart/marker.py +61 -0
  79. pptx2/oxml/chart/plot.py +365 -0
  80. pptx2/oxml/chart/series.py +425 -0
  81. pptx2/oxml/chart/shared.py +220 -0
  82. pptx2/oxml/coreprops.py +288 -0
  83. pptx2/oxml/dml/__init__.py +0 -0
  84. pptx2/oxml/dml/color.py +135 -0
  85. pptx2/oxml/dml/effect.py +213 -0
  86. pptx2/oxml/dml/fill.py +316 -0
  87. pptx2/oxml/dml/line.py +12 -0
  88. pptx2/oxml/dml/three_d.py +110 -0
  89. pptx2/oxml/ns.py +135 -0
  90. pptx2/oxml/presentation.py +313 -0
  91. pptx2/oxml/shapes/__init__.py +19 -0
  92. pptx2/oxml/shapes/autoshape.py +467 -0
  93. pptx2/oxml/shapes/connector.py +107 -0
  94. pptx2/oxml/shapes/graphfrm.py +347 -0
  95. pptx2/oxml/shapes/groupshape.py +329 -0
  96. pptx2/oxml/shapes/picture.py +270 -0
  97. pptx2/oxml/shapes/shared.py +577 -0
  98. pptx2/oxml/simpletypes.py +1027 -0
  99. pptx2/oxml/slide.py +563 -0
  100. pptx2/oxml/table.py +650 -0
  101. pptx2/oxml/text.py +815 -0
  102. pptx2/oxml/theme.py +36 -0
  103. pptx2/oxml/xmlchemy.py +717 -0
  104. pptx2/package.py +222 -0
  105. pptx2/parts/__init__.py +0 -0
  106. pptx2/parts/chart.py +95 -0
  107. pptx2/parts/coreprops.py +167 -0
  108. pptx2/parts/diagram.py +37 -0
  109. pptx2/parts/embeddedpackage.py +93 -0
  110. pptx2/parts/image.py +275 -0
  111. pptx2/parts/media.py +37 -0
  112. pptx2/parts/presentation.py +136 -0
  113. pptx2/parts/slide.py +371 -0
  114. pptx2/presentation.py +408 -0
  115. pptx2/py.typed +0 -0
  116. pptx2/render.py +586 -0
  117. pptx2/section.py +272 -0
  118. pptx2/shapes/__init__.py +26 -0
  119. pptx2/shapes/autoshape.py +442 -0
  120. pptx2/shapes/base.py +1078 -0
  121. pptx2/shapes/connector.py +297 -0
  122. pptx2/shapes/freeform.py +337 -0
  123. pptx2/shapes/graphfrm.py +316 -0
  124. pptx2/shapes/group.py +264 -0
  125. pptx2/shapes/picture.py +422 -0
  126. pptx2/shapes/placeholder.py +468 -0
  127. pptx2/shapes/shapetree.py +2027 -0
  128. pptx2/shared.py +82 -0
  129. pptx2/skill/SKILL.md +450 -0
  130. pptx2/skill/__init__.py +78 -0
  131. pptx2/skill/__main__.py +64 -0
  132. pptx2/skill/references/animations.md +189 -0
  133. pptx2/skill/references/basics.md +421 -0
  134. pptx2/skill/references/charts.md +254 -0
  135. pptx2/skill/references/compose.md +234 -0
  136. pptx2/skill/references/design.md +366 -0
  137. pptx2/skill/references/effects.md +249 -0
  138. pptx2/skill/references/end-to-end-deck.md +231 -0
  139. pptx2/skill/references/geometry-and-arrows.md +334 -0
  140. pptx2/skill/references/lint.md +275 -0
  141. pptx2/skill/references/math.md +86 -0
  142. pptx2/skill/references/picture-effects.md +129 -0
  143. pptx2/skill/references/render.md +151 -0
  144. pptx2/skill/references/smart-art.md +75 -0
  145. pptx2/skill/references/space-aware-authoring.md +249 -0
  146. pptx2/skill/references/tables.md +244 -0
  147. pptx2/skill/references/theme.md +127 -0
  148. pptx2/skill/references/three-d.md +109 -0
  149. pptx2/skill/references/transitions.md +100 -0
  150. pptx2/slide.py +1244 -0
  151. pptx2/smart_art.py +220 -0
  152. pptx2/spec.py +633 -0
  153. pptx2/table.py +1181 -0
  154. pptx2/table_styles.py +184 -0
  155. pptx2/templates/default.pptx +0 -0
  156. pptx2/templates/docx-icon.emf +0 -0
  157. pptx2/templates/generic-icon.emf +0 -0
  158. pptx2/templates/notes.xml +23 -0
  159. pptx2/templates/notesMaster.xml +352 -0
  160. pptx2/templates/pptx-icon.emf +0 -0
  161. pptx2/templates/theme.xml +321 -0
  162. pptx2/templates/xlsx-icon.emf +0 -0
  163. pptx2/text/__init__.py +0 -0
  164. pptx2/text/fonts.py +482 -0
  165. pptx2/text/layout.py +374 -0
  166. pptx2/text/text.py +1272 -0
  167. pptx2/theme.py +721 -0
  168. pptx2/types.py +36 -0
  169. pptx2/util.py +263 -0
  170. python_pptx2-2.13.0.dist-info/METADATA +351 -0
  171. python_pptx2-2.13.0.dist-info/RECORD +175 -0
  172. python_pptx2-2.13.0.dist-info/WHEEL +5 -0
  173. python_pptx2-2.13.0.dist-info/entry_points.txt +3 -0
  174. python_pptx2-2.13.0.dist-info/licenses/LICENSE +22 -0
  175. python_pptx2-2.13.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,337 @@
1
+ """Axis-related oxml objects."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pptx2.enum.chart import XL_AXIS_CROSSES, XL_TICK_LABEL_POSITION, XL_TICK_MARK
6
+ from pptx2.oxml.chart.shared import CT_Title
7
+ from pptx2.oxml.simpletypes import ST_AxisUnit, ST_LblOffset, ST_LogBase, ST_Orientation
8
+ from pptx2.oxml.text import CT_TextBody
9
+ from pptx2.oxml.xmlchemy import (
10
+ BaseOxmlElement,
11
+ OneAndOnlyOne,
12
+ OptionalAttribute,
13
+ RequiredAttribute,
14
+ ZeroOrOne,
15
+ )
16
+
17
+
18
+ class BaseAxisElement(BaseOxmlElement):
19
+ """Base class for catAx, dateAx, valAx, and perhaps other axis elements."""
20
+
21
+ @property
22
+ def defRPr(self):
23
+ """
24
+ ``<a:defRPr>`` great-great-grandchild element, added with its
25
+ ancestors if not present.
26
+ """
27
+ txPr = self.get_or_add_txPr()
28
+ defRPr = txPr.defRPr
29
+ return defRPr
30
+
31
+ @property
32
+ def orientation(self):
33
+ """Value of `val` attribute of `c:scaling/c:orientation` grandchild element.
34
+
35
+ Defaults to `ST_Orientation.MIN_MAX` if attribute or any ancestors are not
36
+ present.
37
+ """
38
+ orientation = self.scaling.orientation
39
+ if orientation is None:
40
+ return ST_Orientation.MIN_MAX
41
+ return orientation.val
42
+
43
+ @orientation.setter
44
+ def orientation(self, value):
45
+ """`value` is a member of `ST_Orientation`."""
46
+ self.scaling._remove_orientation()
47
+ if value == ST_Orientation.MAX_MIN:
48
+ self.scaling.get_or_add_orientation().val = value
49
+
50
+ def _new_title(self):
51
+ return CT_Title.new_title()
52
+
53
+ def _new_txPr(self):
54
+ return CT_TextBody.new_txPr()
55
+
56
+
57
+ class CT_AxisUnit(BaseOxmlElement):
58
+ """Used for `c:majorUnit` and `c:minorUnit` elements, and others."""
59
+
60
+ val = RequiredAttribute("val", ST_AxisUnit)
61
+
62
+
63
+ class CT_CatAx(BaseAxisElement):
64
+ """`c:catAx` element, defining a category axis."""
65
+
66
+ _tag_seq = (
67
+ "c:axId",
68
+ "c:scaling",
69
+ "c:delete",
70
+ "c:axPos",
71
+ "c:majorGridlines",
72
+ "c:minorGridlines",
73
+ "c:title",
74
+ "c:numFmt",
75
+ "c:majorTickMark",
76
+ "c:minorTickMark",
77
+ "c:tickLblPos",
78
+ "c:spPr",
79
+ "c:txPr",
80
+ "c:crossAx",
81
+ "c:crosses",
82
+ "c:crossesAt",
83
+ "c:auto",
84
+ "c:lblAlgn",
85
+ "c:lblOffset",
86
+ "c:tickLblSkip",
87
+ "c:tickMarkSkip",
88
+ "c:noMultiLvlLbl",
89
+ "c:extLst",
90
+ )
91
+ scaling = OneAndOnlyOne("c:scaling")
92
+ delete_ = ZeroOrOne("c:delete", successors=_tag_seq[3:])
93
+ majorGridlines = ZeroOrOne("c:majorGridlines", successors=_tag_seq[5:])
94
+ minorGridlines = ZeroOrOne("c:minorGridlines", successors=_tag_seq[6:])
95
+ title = ZeroOrOne("c:title", successors=_tag_seq[7:])
96
+ numFmt = ZeroOrOne("c:numFmt", successors=_tag_seq[8:])
97
+ majorTickMark = ZeroOrOne("c:majorTickMark", successors=_tag_seq[9:])
98
+ minorTickMark = ZeroOrOne("c:minorTickMark", successors=_tag_seq[10:])
99
+ tickLblPos = ZeroOrOne("c:tickLblPos", successors=_tag_seq[11:])
100
+ spPr = ZeroOrOne("c:spPr", successors=_tag_seq[12:])
101
+ txPr = ZeroOrOne("c:txPr", successors=_tag_seq[13:])
102
+ crosses = ZeroOrOne("c:crosses", successors=_tag_seq[15:])
103
+ crossesAt = ZeroOrOne("c:crossesAt", successors=_tag_seq[16:])
104
+ lblOffset = ZeroOrOne("c:lblOffset", successors=_tag_seq[19:])
105
+ del _tag_seq
106
+
107
+
108
+ class CT_ChartLines(BaseOxmlElement):
109
+ """Used for `c:majorGridlines` and `c:minorGridlines`.
110
+
111
+ Specifies gridlines visual properties such as color and width.
112
+ """
113
+
114
+ spPr = ZeroOrOne("c:spPr", successors=())
115
+
116
+
117
+ class CT_Crosses(BaseOxmlElement):
118
+ """`c:crosses` element, specifying where the other axis crosses this one."""
119
+
120
+ val = RequiredAttribute("val", XL_AXIS_CROSSES)
121
+
122
+
123
+ class CT_DateAx(BaseAxisElement):
124
+ """`c:dateAx` element, defining a date (category) axis."""
125
+
126
+ _tag_seq = (
127
+ "c:axId",
128
+ "c:scaling",
129
+ "c:delete",
130
+ "c:axPos",
131
+ "c:majorGridlines",
132
+ "c:minorGridlines",
133
+ "c:title",
134
+ "c:numFmt",
135
+ "c:majorTickMark",
136
+ "c:minorTickMark",
137
+ "c:tickLblPos",
138
+ "c:spPr",
139
+ "c:txPr",
140
+ "c:crossAx",
141
+ "c:crosses",
142
+ "c:crossesAt",
143
+ "c:auto",
144
+ "c:lblOffset",
145
+ "c:baseTimeUnit",
146
+ "c:majorUnit",
147
+ "c:majorTimeUnit",
148
+ "c:minorUnit",
149
+ "c:minorTimeUnit",
150
+ "c:extLst",
151
+ )
152
+ scaling = OneAndOnlyOne("c:scaling")
153
+ delete_ = ZeroOrOne("c:delete", successors=_tag_seq[3:])
154
+ majorGridlines = ZeroOrOne("c:majorGridlines", successors=_tag_seq[5:])
155
+ minorGridlines = ZeroOrOne("c:minorGridlines", successors=_tag_seq[6:])
156
+ title = ZeroOrOne("c:title", successors=_tag_seq[7:])
157
+ numFmt = ZeroOrOne("c:numFmt", successors=_tag_seq[8:])
158
+ majorTickMark = ZeroOrOne("c:majorTickMark", successors=_tag_seq[9:])
159
+ minorTickMark = ZeroOrOne("c:minorTickMark", successors=_tag_seq[10:])
160
+ tickLblPos = ZeroOrOne("c:tickLblPos", successors=_tag_seq[11:])
161
+ spPr = ZeroOrOne("c:spPr", successors=_tag_seq[12:])
162
+ txPr = ZeroOrOne("c:txPr", successors=_tag_seq[13:])
163
+ crosses = ZeroOrOne("c:crosses", successors=_tag_seq[15:])
164
+ crossesAt = ZeroOrOne("c:crossesAt", successors=_tag_seq[16:])
165
+ lblOffset = ZeroOrOne("c:lblOffset", successors=_tag_seq[18:])
166
+ del _tag_seq
167
+
168
+
169
+ class CT_LblOffset(BaseOxmlElement):
170
+ """`c:lblOffset` custom element class."""
171
+
172
+ val = OptionalAttribute("val", ST_LblOffset, default=100)
173
+
174
+
175
+ class CT_LogBase(BaseOxmlElement):
176
+ """`c:logBase` child of `c:scaling`, specifying a logarithmic axis scale.
177
+
178
+ The `val` attribute is the base of the logarithm, a float in range 2-1000.
179
+ """
180
+
181
+ val = RequiredAttribute("val", ST_LogBase)
182
+
183
+
184
+ class CT_Orientation(BaseOxmlElement):
185
+ """`c:xAx/c:scaling/c:orientation` element, defining category order.
186
+
187
+ Used to reverse the order categories appear in on a bar chart so they start at the
188
+ top rather than the bottom. Because we read top-to-bottom, the default way looks odd
189
+ to many and perhaps most folks. Also applicable to value and date axes.
190
+ """
191
+
192
+ val = OptionalAttribute("val", ST_Orientation, default=ST_Orientation.MIN_MAX)
193
+
194
+
195
+ class CT_Scaling(BaseOxmlElement):
196
+ """`c:scaling` element.
197
+
198
+ Defines axis scale characteristics such as maximum value, log vs. linear, etc.
199
+ """
200
+
201
+ _tag_seq = ("c:logBase", "c:orientation", "c:max", "c:min", "c:extLst")
202
+ logBase = ZeroOrOne("c:logBase", successors=_tag_seq[1:])
203
+ orientation = ZeroOrOne("c:orientation", successors=_tag_seq[2:])
204
+ max = ZeroOrOne("c:max", successors=_tag_seq[3:])
205
+ min = ZeroOrOne("c:min", successors=_tag_seq[4:])
206
+ del _tag_seq
207
+
208
+ @property
209
+ def log_base(self):
210
+ """
211
+ The float value of the ``<c:logBase>`` child element, or |None| if no
212
+ logBase element is present (i.e. the axis uses a linear scale).
213
+ """
214
+ logBase = self.logBase
215
+ if logBase is None:
216
+ return None
217
+ return logBase.val
218
+
219
+ @log_base.setter
220
+ def log_base(self, value):
221
+ """
222
+ Set the value of the ``<c:logBase>`` child element to the float
223
+ *value*, or remove the logBase element if *value* is |None|.
224
+ """
225
+ self._remove_logBase()
226
+ if value is None:
227
+ return
228
+ self._add_logBase(val=value)
229
+
230
+ @property
231
+ def maximum(self):
232
+ """
233
+ The float value of the ``<c:max>`` child element, or |None| if no max
234
+ element is present.
235
+ """
236
+ max = self.max
237
+ if max is None:
238
+ return None
239
+ return max.val
240
+
241
+ @maximum.setter
242
+ def maximum(self, value):
243
+ """
244
+ Set the value of the ``<c:max>`` child element to the float *value*,
245
+ or remove the max element if *value* is |None|.
246
+ """
247
+ self._remove_max()
248
+ if value is None:
249
+ return
250
+ self._add_max(val=value)
251
+
252
+ @property
253
+ def minimum(self):
254
+ """
255
+ The float value of the ``<c:min>`` child element, or |None| if no min
256
+ element is present.
257
+ """
258
+ min = self.min
259
+ if min is None:
260
+ return None
261
+ return min.val
262
+
263
+ @minimum.setter
264
+ def minimum(self, value):
265
+ """
266
+ Set the value of the ``<c:min>`` child element to the float *value*,
267
+ or remove the min element if *value* is |None|.
268
+ """
269
+ self._remove_min()
270
+ if value is None:
271
+ return
272
+ self._add_min(val=value)
273
+
274
+
275
+ class CT_TickLblPos(BaseOxmlElement):
276
+ """`c:tickLblPos` element."""
277
+
278
+ val = OptionalAttribute("val", XL_TICK_LABEL_POSITION)
279
+
280
+
281
+ class CT_TickMark(BaseOxmlElement):
282
+ """Used for `c:minorTickMark` and `c:majorTickMark`."""
283
+
284
+ val = OptionalAttribute("val", XL_TICK_MARK, default=XL_TICK_MARK.CROSS)
285
+
286
+
287
+ class CT_ValAx(BaseAxisElement):
288
+ """`c:valAx` element, defining a value axis."""
289
+
290
+ _tag_seq = (
291
+ "c:axId",
292
+ "c:scaling",
293
+ "c:delete",
294
+ "c:axPos",
295
+ "c:majorGridlines",
296
+ "c:minorGridlines",
297
+ "c:title",
298
+ "c:numFmt",
299
+ "c:majorTickMark",
300
+ "c:minorTickMark",
301
+ "c:tickLblPos",
302
+ "c:spPr",
303
+ "c:txPr",
304
+ "c:crossAx",
305
+ "c:crosses",
306
+ "c:crossesAt",
307
+ "c:crossBetween",
308
+ "c:majorUnit",
309
+ "c:minorUnit",
310
+ "c:dispUnits",
311
+ "c:extLst",
312
+ )
313
+ scaling = OneAndOnlyOne("c:scaling")
314
+ delete_ = ZeroOrOne("c:delete", successors=_tag_seq[3:])
315
+ majorGridlines = ZeroOrOne("c:majorGridlines", successors=_tag_seq[5:])
316
+ minorGridlines = ZeroOrOne("c:minorGridlines", successors=_tag_seq[6:])
317
+ title = ZeroOrOne("c:title", successors=_tag_seq[7:])
318
+ numFmt = ZeroOrOne("c:numFmt", successors=_tag_seq[8:])
319
+ majorTickMark = ZeroOrOne("c:majorTickMark", successors=_tag_seq[9:])
320
+ minorTickMark = ZeroOrOne("c:minorTickMark", successors=_tag_seq[10:])
321
+ tickLblPos = ZeroOrOne("c:tickLblPos", successors=_tag_seq[11:])
322
+ spPr = ZeroOrOne("c:spPr", successors=_tag_seq[12:])
323
+ txPr = ZeroOrOne("c:txPr", successors=_tag_seq[13:])
324
+ crossAx = ZeroOrOne("c:crossAx", successors=_tag_seq[14:])
325
+ crosses = ZeroOrOne("c:crosses", successors=_tag_seq[15:])
326
+ crossesAt = ZeroOrOne("c:crossesAt", successors=_tag_seq[16:])
327
+ majorUnit = ZeroOrOne("c:majorUnit", successors=_tag_seq[18:])
328
+ minorUnit = ZeroOrOne("c:minorUnit", successors=_tag_seq[19:])
329
+ del _tag_seq
330
+
331
+
332
+ # -- element-class registration for `c:logBase`, which is not registered from
333
+ # -- `pptx2.oxml.__init__`. The import is local to avoid a circular import
334
+ # -- at package-initialization time.
335
+ from pptx2.oxml import register_element_cls # noqa: E402
336
+
337
+ register_element_cls("c:logBase", CT_LogBase)