Skip to content

Commit e492e37

Browse files
author
Steve Canny
committed
enum: convert WD_UNDERLINE to XmlEnumeration
1 parent 06de6c9 commit e492e37

1 file changed

Lines changed: 72 additions & 21 deletions

File tree

docx/enum/text.py

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from __future__ import absolute_import, print_function, unicode_literals
88

9+
from .base import XmlEnumeration, XmlMappedEnumMember
10+
911

1012
class WD_BREAK_TYPE(object):
1113
"""
@@ -27,26 +29,75 @@ class WD_BREAK_TYPE(object):
2729
WD_BREAK = WD_BREAK_TYPE
2830

2931

30-
class WD_UNDERLINE(object):
32+
class WD_UNDERLINE(XmlEnumeration):
3133
"""
32-
Corresponds to WdUnderline enumeration
33-
http://msdn.microsoft.com/en-us/library/office/ff822388.aspx
34+
Specifies the style of underline applied to a run of characters.
3435
"""
35-
NONE = 0
36-
SINGLE = 1
37-
WORDS = 2
38-
DOUBLE = 3
39-
DOTTED = 4
40-
THICK = 6
41-
DASH = 7
42-
DOT_DASH = 9
43-
DOT_DOT_DASH = 10
44-
WAVY = 11
45-
DOTTED_HEAVY = 20
46-
DASH_HEAVY = 23
47-
DOT_DASH_HEAVY = 25
48-
DOT_DOT_DASH_HEAVY = 26
49-
WAVY_HEAVY = 27
50-
DASH_LONG = 39
51-
WAVY_DOUBLE = 43
52-
DASH_LONG_HEAVY = 55
36+
37+
__ms_name__ = 'WdUnderline'
38+
39+
__url__ = 'http://msdn.microsoft.com/en-us/library/office/ff822388.aspx'
40+
41+
__members__ = (
42+
XmlMappedEnumMember(
43+
'NONE', 0, 'none', 'No underline. This setting overrides any inh'
44+
'erited underline value, so can be used to remove underline from'
45+
' a run that inherits underlining from its containing paragraph.'
46+
),
47+
XmlMappedEnumMember(
48+
'SINGLE', 1, 'single', 'A single line (default). Note that this '
49+
'setting is write-only in the sense that |True| (rather than 1) '
50+
'is returned for a run having this setting.'
51+
),
52+
XmlMappedEnumMember(
53+
'WORDS', 2, 'words', 'Underline individual words only.'
54+
),
55+
XmlMappedEnumMember(
56+
'DOUBLE', 3, 'double', 'A double line.'
57+
),
58+
XmlMappedEnumMember(
59+
'DOTTED', 4, 'dotted', 'Dots.'
60+
),
61+
XmlMappedEnumMember(
62+
'THICK', 6, 'thick', 'A single thick line.'
63+
),
64+
XmlMappedEnumMember(
65+
'DASH', 7, 'dash', 'Dashes.'
66+
),
67+
XmlMappedEnumMember(
68+
'DOT_DASH', 9, 'dotDash', 'Alternating dots and dashes.'
69+
),
70+
XmlMappedEnumMember(
71+
'DOT_DOT_DASH', 10, 'dotDotDash', 'An alternating dot-dot-dash p'
72+
'attern.'
73+
),
74+
XmlMappedEnumMember(
75+
'WAVY', 11, 'wave', 'A single wavy line.'
76+
),
77+
XmlMappedEnumMember(
78+
'DOTTED_HEAVY', 20, 'dottedHeavy', 'Heavy dots.'
79+
),
80+
XmlMappedEnumMember(
81+
'DASH_HEAVY', 23, 'dashedHeavy', 'Heavy dashes.'
82+
),
83+
XmlMappedEnumMember(
84+
'DOT_DASH_HEAVY', 25, 'dashDotHeavy', 'Alternating heavy dots an'
85+
'd heavy dashes.'
86+
),
87+
XmlMappedEnumMember(
88+
'DOT_DOT_DASH_HEAVY', 26, 'dashDotDotHeavy', 'An alternating hea'
89+
'vy dot-dot-dash pattern.'
90+
),
91+
XmlMappedEnumMember(
92+
'WAVY_HEAVY', 27, 'wavyHeavy', 'A heavy wavy line.'
93+
),
94+
XmlMappedEnumMember(
95+
'DASH_LONG', 39, 'dashLong', 'Long dashes.'
96+
),
97+
XmlMappedEnumMember(
98+
'WAVY_DOUBLE', 43, 'wavyDouble', 'A double wavy line.'
99+
),
100+
XmlMappedEnumMember(
101+
'DASH_LONG_HEAVY', 55, 'dashLongHeavy', 'Long heavy dashes.'
102+
),
103+
)

0 commit comments

Comments
 (0)