Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(enum): replace read-only enum values #1003

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
---------------

1.0.2 (2024-08-07)
++++++++++++++++++

- fix: #1003 restore read-only enum members

1.0.1 (2024-08-05)
++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion src/pptx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
if TYPE_CHECKING:
from pptx.opc.package import Part

__version__ = "1.0.1"
__version__ = "1.0.2"

sys.modules["pptx.exceptions"] = exceptions
del sys
Expand Down
7 changes: 5 additions & 2 deletions src/pptx/enum/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ class XL_DATA_LABEL_POSITION(BaseXmlEnum):
LEFT = (-4131, "l", "The data label is positioned to the left of the data point.")
"""The data label is positioned to the left of the data point."""

MIXED = (6, "", "Data labels are in multiple positions (read-only).")
"""Data labels are in multiple positions (read-only)."""

OUTSIDE_END = (
2,
"outEnd",
Expand Down Expand Up @@ -370,8 +373,8 @@ class XL_LEGEND_POSITION(BaseXmlEnum):
CORNER = (2, "tr", "In the upper-right corner of the chart border.")
"""In the upper-right corner of the chart border."""

CUSTOM = (-4161, "", "A custom position.")
"""A custom position."""
CUSTOM = (-4161, "", "A custom position (read-only).")
"""A custom position (read-only)."""

LEFT = (-4131, "l", "Left of the chart.")
"""Left of the chart."""
Expand Down
12 changes: 8 additions & 4 deletions src/pptx/enum/dml.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ class MSO_PATTERN_TYPE(BaseXmlEnum):
ZIG_ZAG = (38, "zigZag", "Zig Zag")
"""Zig Zag"""

MIXED = (-2, "", "Mixed pattern")
"""Mixed pattern"""
MIXED = (-2, "", "Mixed pattern (read-only).")
"""Mixed pattern (read-only)."""


MSO_PATTERN = MSO_PATTERN_TYPE
Expand Down Expand Up @@ -394,8 +394,12 @@ class MSO_THEME_COLOR_INDEX(BaseXmlEnum):
TEXT_2 = (15, "tx2", "Specifies the Text 2 theme color.")
"""Specifies the Text 2 theme color."""

MIXED = (-2, "", "Indicates multiple theme colors are used, such as in a group shape.")
"""Indicates multiple theme colors are used, such as in a group shape."""
MIXED = (
-2,
"",
"Indicates multiple theme colors are used, such as in a group shape (read-only).",
)
"""Indicates multiple theme colors are used, such as in a group shape (read-only)."""


MSO_THEME_COLOR = MSO_THEME_COLOR_INDEX
3 changes: 3 additions & 0 deletions src/pptx/enum/lang.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,3 +680,6 @@ class MSO_LANGUAGE_ID(BaseXmlEnum):

ZULU = (1077, "zu-ZA", "The Zulu language.")
"""The Zulu language."""

MIXED = (-2, "", "More than one language in specified range (read-only).")
"""More than one language in specified range (read-only)."""
28 changes: 22 additions & 6 deletions src/pptx/enum/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,9 @@ class MSO_CONNECTOR_TYPE(BaseXmlEnum):
STRAIGHT = (1, "line", "Straight line connector.")
"""Straight line connector."""

MIXED = (-2, "", "Return value only; indicates a combination of other states.")
"""Return value only; indicates a combination of other states."""


MSO_CONNECTOR = MSO_CONNECTOR_TYPE

Expand Down Expand Up @@ -843,6 +846,9 @@ class MSO_SHAPE_TYPE(BaseEnum):
WEB_VIDEO = (26, "Web video")
"""Web video"""

MIXED = (-2, "Multiple shape types (read-only).")
"""Multiple shape types (read-only)."""


MSO = MSO_SHAPE_TYPE

Expand Down Expand Up @@ -871,6 +877,16 @@ class PP_MEDIA_TYPE(BaseEnum):
SOUND = (1, "Audio media such as MP3.")
"""Audio media such as MP3."""

MIXED = (
-2,
"Return value only; indicates multiple media types, typically for a collection of shapes."
" May not be applicable in python-pptx.",
)
"""Return value only; indicates multiple media types.

Typically for a collection of shapes. May not be applicable in python-pptx.
"""


class PP_PLACEHOLDER_TYPE(BaseXmlEnum):
"""Specifies one of the 18 distinct types of placeholder.
Expand Down Expand Up @@ -937,14 +953,14 @@ class PP_PLACEHOLDER_TYPE(BaseXmlEnum):
TITLE = (1, "title", "Title")
"""Title"""

VERTICAL_BODY = (6, "", "Vertical Body")
"""Vertical Body"""
VERTICAL_BODY = (6, "", "Vertical Body (read-only).")
"""Vertical Body (read-only)."""

VERTICAL_OBJECT = (17, "", "Vertical Object")
"""Vertical Object"""
VERTICAL_OBJECT = (17, "", "Vertical Object (read-only).")
"""Vertical Object (read-only)."""

VERTICAL_TITLE = (5, "", "Vertical Title")
"""Vertical Title"""
VERTICAL_TITLE = (5, "", "Vertical Title (read-only).")
"""Vertical Title (read-only)."""

MIXED = (-2, "", "Return value only; multiple placeholders of differing types.")
"""Return value only; multiple placeholders of differing types."""
Expand Down
12 changes: 12 additions & 0 deletions src/pptx/enum/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class MSO_AUTO_SIZE(BaseEnum):
)
"""The font size is reduced as necessary to fit the text within the shape."""

MIXED = (-2, "Return value only; indicates a combination of automatic sizing schemes are used.")
"""Return value only; indicates a combination of automatic sizing schemes are used."""


class MSO_TEXT_UNDERLINE_TYPE(BaseXmlEnum):
"""
Expand Down Expand Up @@ -134,6 +137,9 @@ class MSO_TEXT_UNDERLINE_TYPE(BaseXmlEnum):
WORDS = (1, "words", "Specifies underlining words.")
"""Specifies underlining words."""

MIXED = (-2, "", "Specifies a mix of underline types (read-only).")
"""Specifies a mix of underline types (read-only)."""


MSO_UNDERLINE = MSO_TEXT_UNDERLINE_TYPE

Expand Down Expand Up @@ -161,6 +167,9 @@ class MSO_VERTICAL_ANCHOR(BaseXmlEnum):
BOTTOM = (4, "b", "Aligns text to bottom of text frame")
"""Aligns text to bottom of text frame"""

MIXED = (-2, "", "Return value only; indicates a combination of the other states.")
"""Return value only; indicates a combination of the other states."""


MSO_ANCHOR = MSO_VERTICAL_ANCHOR

Expand Down Expand Up @@ -214,5 +223,8 @@ class PP_PARAGRAPH_ALIGNMENT(BaseXmlEnum):
THAI_DISTRIBUTE = (6, "thaiDist", "Thai distributed")
"""Thai distributed"""

MIXED = (-2, "", "Multiple alignments are present in a set of paragraphs (read-only).")
"""Multiple alignments are present in a set of paragraphs (read-only)."""


PP_ALIGN = PP_PARAGRAPH_ALIGNMENT