File: dml.py

package info (click to toggle)
python-docx 0.8.11%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,640 kB
  • sloc: xml: 25,311; python: 21,911; makefile: 168
file content (124 lines) | stat: -rw-r--r-- 3,533 bytes parent folder | download
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# encoding: utf-8

"""
Enumerations used by DrawingML objects
"""

from __future__ import absolute_import

from .base import (
    alias, Enumeration, EnumMember, XmlEnumeration, XmlMappedEnumMember
)


class MSO_COLOR_TYPE(Enumeration):
    """
    Specifies the color specification scheme

    Example::

        from docx.enum.dml import MSO_COLOR_TYPE

        assert font.color.type == MSO_COLOR_TYPE.SCHEME
    """

    __ms_name__ = 'MsoColorType'

    __url__ = (
        'http://msdn.microsoft.com/en-us/library/office/ff864912(v=office.15'
        ').aspx'
    )

    __members__ = (
        EnumMember(
            'RGB', 1, 'Color is specified by an |RGBColor| value.'
        ),
        EnumMember(
            'THEME', 2, 'Color is one of the preset theme colors.'
        ),
        EnumMember(
            'AUTO', 101, 'Color is determined automatically by the '
            'application.'
        ),
    )


@alias('MSO_THEME_COLOR')
class MSO_THEME_COLOR_INDEX(XmlEnumeration):
    """
    Indicates the Office theme color, one of those shown in the color gallery
    on the formatting ribbon.

    Alias: ``MSO_THEME_COLOR``

    Example::

        from docx.enum.dml import MSO_THEME_COLOR

        font.color.theme_color = MSO_THEME_COLOR.ACCENT_1
    """

    __ms_name__ = 'MsoThemeColorIndex'

    __url__ = (
        'http://msdn.microsoft.com/en-us/library/office/ff860782(v=office.15'
        ').aspx'
    )

    __members__ = (
        EnumMember(
            'NOT_THEME_COLOR', 0, 'Indicates the color is not a theme color.'
        ),
        XmlMappedEnumMember(
            'ACCENT_1', 5, 'accent1', 'Specifies the Accent 1 theme color.'
        ),
        XmlMappedEnumMember(
            'ACCENT_2', 6, 'accent2', 'Specifies the Accent 2 theme color.'
        ),
        XmlMappedEnumMember(
            'ACCENT_3', 7, 'accent3', 'Specifies the Accent 3 theme color.'
        ),
        XmlMappedEnumMember(
            'ACCENT_4', 8, 'accent4', 'Specifies the Accent 4 theme color.'
        ),
        XmlMappedEnumMember(
            'ACCENT_5', 9, 'accent5', 'Specifies the Accent 5 theme color.'
        ),
        XmlMappedEnumMember(
            'ACCENT_6', 10, 'accent6', 'Specifies the Accent 6 theme color.'
        ),
        XmlMappedEnumMember(
            'BACKGROUND_1', 14, 'background1', 'Specifies the Background 1 '
            'theme color.'
        ),
        XmlMappedEnumMember(
            'BACKGROUND_2', 16, 'background2', 'Specifies the Background 2 '
            'theme color.'
        ),
        XmlMappedEnumMember(
            'DARK_1', 1, 'dark1', 'Specifies the Dark 1 theme color.'
        ),
        XmlMappedEnumMember(
            'DARK_2', 3, 'dark2', 'Specifies the Dark 2 theme color.'
        ),
        XmlMappedEnumMember(
            'FOLLOWED_HYPERLINK', 12, 'followedHyperlink', 'Specifies the '
            'theme color for a clicked hyperlink.'
        ),
        XmlMappedEnumMember(
            'HYPERLINK', 11, 'hyperlink', 'Specifies the theme color for a '
            'hyperlink.'
        ),
        XmlMappedEnumMember(
            'LIGHT_1', 2, 'light1', 'Specifies the Light 1 theme color.'
        ),
        XmlMappedEnumMember(
            'LIGHT_2', 4, 'light2', 'Specifies the Light 2 theme color.'
        ),
        XmlMappedEnumMember(
            'TEXT_1', 13, 'text1', 'Specifies the Text 1 theme color.'
        ),
        XmlMappedEnumMember(
            'TEXT_2', 15, 'text2', 'Specifies the Text 2 theme color.'
        ),
    )