Ejemplo n.º 1
0
 def _add_sldIdLst(self):
     """
     Return a newly created <p:sldIdLst> child element.
     """
     sldIdLst = Element('p:sldIdLst')
     # insert new sldIdLst element in right sequence
     sldSz = child(self, 'p:sldSz')
     if sldSz is not None:
         sldSz.addprevious(sldIdLst)
     else:
         notesSz = child(self, 'p:notesSz')
         notesSz.addprevious(sldIdLst)
     return sldIdLst
Ejemplo n.º 2
0
 def prst(self):
     """
     Value of ``prst`` attribute of ``<a:prstGeom>`` element or |None| if
     not present.
     """
     prstGeom = child(self.spPr, 'a:prstGeom')
     if prstGeom is None:
         return None
     return prstGeom.get('prst')
Ejemplo n.º 3
0
 def get_or_add_sldIdLst(self):
     """
     Return the <p:sldIdLst> child element, creating one first if
     necessary.
     """
     sldIdLst = child(self, 'p:sldIdLst')
     if sldIdLst is None:
         sldIdLst = self._add_sldIdLst()
     return sldIdLst
Ejemplo n.º 4
0
 def textframe(self):
     """
     |TextFrame| instance for this shape. Raises |ValueError| if shape has
     no text frame. Use :attr:`has_textframe` to check whether a shape has
     a text frame.
     """
     txBody = child(self._element, 'p:txBody')
     if txBody is None:
         raise ValueError('shape has no text frame')
     return TextFrame(txBody, self)
Ejemplo n.º 5
0
 def _is_title(self):
     """
     True if this shape is a title placeholder.
     """
     ph = child(self._nvXxPr.nvPr, 'p:ph')
     if ph is None:
         return False
     # idx defaults to 0 when idx attr is absent
     ph_idx = ph.get('idx', '0')
     # title placeholder is identified by idx of 0
     return ph_idx == '0'
Ejemplo n.º 6
0
 def is_autoshape(self):
     """
     True if this shape is an auto shape. A shape is an auto shape if it
     has a ``<a:prstGeom>`` element and does not have a txBox="1" attribute
     on cNvSpPr.
     """
     prstGeom = child(self.spPr, 'a:prstGeom')
     if prstGeom is None:
         return False
     txBox = self.nvSpPr.cNvSpPr.get('txBox')
     if txBox in ('true', '1'):
         return False
     return True
Ejemplo n.º 7
0
 def it_returns_none_if_no_matching_child_is_present(self, parent_elm):
     child_elm = child(parent_elm, 'p:baz')
     assert child_elm is None
Ejemplo n.º 8
0
 def it_returns_a_matching_child_if_present(
         self, parent_elm, known_child_nsptag_str, known_child_elm):
     child_elm = child(parent_elm, known_child_nsptag_str)
     assert child_elm is known_child_elm
Ejemplo n.º 9
0
 def is_placeholder(self):
     """
     True if this shape is a placeholder. A shape is a placeholder if it
     has a <p:ph> element.
     """
     return child(self._nvXxPr.nvPr, 'p:ph') is not None
Ejemplo n.º 10
0
 def has_textframe(self):
     """
     True if this shape has a txBody element and can contain text.
     """
     return child(self._element, 'p:txBody') is not None
Ejemplo n.º 11
0
 def prstGeom(self):
     """
     Reference to ``<a:prstGeom>`` child element or |None| if this shape
     doesn't have one, for example, if it's a placeholder shape.
     """
     return child(self.spPr, 'a:prstGeom')