Skip to content

Commit 0087e2d

Browse files
author
Steve Canny
committed
oxml: convert CT_GraphicalObjectData to xmlchemy
1 parent b821d1d commit 0087e2d

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

docx/oxml/shape.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
from . import OxmlElement
88
from ..shared import Emu
99
from .ns import nsmap, nspfxmap, qn
10-
from .simpletypes import ST_RelationshipId
10+
from .simpletypes import ST_RelationshipId, XsdToken
1111
from .xmlchemy import (
12-
BaseOxmlElement, OneAndOnlyOne, OptionalAttribute, ZeroOrOne
12+
BaseOxmlElement, OneAndOnlyOne, OptionalAttribute, RequiredAttribute,
13+
ZeroOrOne
1314
)
1415

1516

@@ -61,21 +62,16 @@ class CT_GraphicalObjectData(BaseOxmlElement):
6162
"""
6263
``<a:graphicData>`` element, container for the XML of a DrawingML object
6364
"""
65+
pic = ZeroOrOne('pic:pic')
66+
uri = RequiredAttribute('uri', XsdToken)
67+
6468
@classmethod
6569
def new(cls, uri, pic):
6670
graphicData = OxmlElement('a:graphicData')
67-
graphicData.set('uri', uri)
68-
graphicData.append(pic)
71+
graphicData.uri = uri
72+
graphicData._insert_pic(pic)
6973
return graphicData
7074

71-
@property
72-
def pic(self):
73-
return self.find(qn('pic:pic'))
74-
75-
@property
76-
def uri(self):
77-
return self.get('uri')
78-
7975

8076
class CT_Inline(BaseOxmlElement):
8177
"""

0 commit comments

Comments
 (0)