Ejemplo n.º 1
0
 def crop_set_fixture(self, request):
     pic_cxml, side, value, expected_cxml = request.param
     pic = element(pic_cxml)
     picture = Picture(pic, None)
     prop_name = 'crop_%s' % side
     expected_xml = xml(expected_cxml)
     return picture, prop_name, value, expected_xml
Ejemplo n.º 2
0
def BaseShapeFactory(shape_elm, parent):
    """
    Return an instance of the appropriate shape proxy class for *shape_elm*.
    """
    tag = shape_elm.tag

    if tag == qn('p:pic'):
        videoFiles = shape_elm.xpath('./p:nvPicPr/p:nvPr/a:videoFile')
        if videoFiles:
            return Movie(shape_elm, parent)
        return Picture(shape_elm, parent)

    shape_cls = {
        qn('p:cxnSp'): Connector,
        qn('p:sp'): Shape,
        qn('p:graphicFrame'): GraphicFrame,
    }.get(tag, BaseShape)

    return shape_cls(shape_elm, parent)
Ejemplo n.º 3
0
 def crop_get_fixture(self, request):
     pic_cxml, side, expected_value = request.param
     picture = Picture(element(pic_cxml), None)
     prop_name = 'crop_%s' % side
     return picture, prop_name, expected_value
Ejemplo n.º 4
0
 def shape_type_fixture(self):
     return Picture(None, None)
Ejemplo n.º 5
0
 def image_fixture(self, part_prop_, slide_part_, image_):
     pic_cxml, rId = 'p:pic/p:blipFill/a:blip{r:embed=rId42}', 'rId42'
     picture = Picture(element(pic_cxml), None)
     slide_part_.get_image.return_value = image_
     return picture, slide_part_, rId, image_
Ejemplo n.º 6
0
 def autoshape_set_fixture(self, request):
     pic_cxml, new_value, expected_cxml = request.param
     picture = Picture(element(pic_cxml), None)
     expected_xml = xml(expected_cxml)
     return picture, new_value, expected_xml
Ejemplo n.º 7
0
 def autoshape_get_fixture(self, request):
     prstGeom_cxml, expected_value = request.param
     pic_cxml = 'p:pic/p:spPr%s' % prstGeom_cxml
     picture = Picture(element(pic_cxml), None)
     return picture, expected_value
Ejemplo n.º 8
0
 def picture(self):
     pic_cxml = 'p:pic/p:spPr'
     return Picture(element(pic_cxml), None)
Ejemplo n.º 9
0
 def picture(self):
     pic = a_pic().with_nsdecls().with_child(an_spPr()).element
     return Picture(pic, None)