Skip to content
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
2 changes: 1 addition & 1 deletion pptx/oxml/shapes/groupshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def add_custom_geometry(self, id_, name, left, top, width, height):
position and size.
"""
sp = CT_Shape.new_custom_geometry_sp(id_, name, left, top, width, height)
self.insert_element_before(sp, 'p:extList')
self.insert_element_before(sp, 'p:extLst')
return sp

def add_groupshape(self, id_, name, x, y, cx, cy):
Expand Down
35 changes: 35 additions & 0 deletions pptx/shapes/groupshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,23 @@ def add_textbox(self, left, top, width, height):
textbox = self._shape_factory(sp)
return textbox

def add_custom_geometry(self, left, top, width, height):
"""
Add a custom geometry shpane of specified size at specified position
on slide.
"""
sp = self._add_cust_geom_sp(left, top, width, height)
cust_geom = self._shape_factory(sp)
return cust_geom

def add_groupshape(self, left, top, width, height):
"""
Add groupshape of specified size at specified position on slide.
"""
sp = self._add_groupshape_sp(left, top, width, height)
groupshape = self._shape_factory(sp)
return groupshape

def clone_layout_placeholders(self, slide_layout):
"""
Add placeholder shapes based on those in *slide_layout*. Z-order of
Expand Down Expand Up @@ -284,6 +301,24 @@ def _add_textbox_sp(self, x, y, cx, cy):
sp = self._grpSp.add_textbox(id_, name, x, y, cx, cy)
return sp

def _add_cust_geom_sp(self, x, y, cx, cy):
"""
Return a newly-added custom geometry ``<p:sp>`` element
"""
id_ = self._next_shape_id
name = 'CustGeom %s' % id_
sp = self._grpSp.add_custom_geometry(id_, name, x, y, cx, cy)
return sp

def _add_groupshape_sp(self, x, y, cx, cy):
"""

"""
id_ = self._next_shape_id
name = 'GroupShape %d' % (id_-1)
sp = self._grpSp.add_groupshape(id_, name, x, y, cx, cy)
return sp

def _clone_layout_placeholder(self, layout_placeholder):
"""
Add a new placeholder shape based on the slide layout placeholder
Expand Down