示例#1
0
 def fill(self):
     """
     |FillFormat| instance for this cell, providing access to fill
     properties such as foreground color.
     """
     tcPr = self._tc.get_or_add_tcPr()
     return FillFormat.from_fill_parent(tcPr)
示例#2
0
    def fill(self):
        """|FillFormat| instance for this background.

        This |FillFormat| object is used to interrogate or specify the fill
        of the slide background.

        Note that accessing this property is potentially destructive. A slide
        background can also be specified by a background style reference and
        accessing this property will remove that reference, if present, and
        replace it with NoFill. This is frequently the case for a slide
        master background.

        This is also the case when there is no explicitly defined background
        (background is inherited); merely accessing this property will cause
        the background to be set to NoFill and the inheritance link will be
        interrupted. This is frequently the case for a slide background.

        Of course, if you are accessing this property in order to set the
        fill, then these changes are of no consequence, but the existing
        background cannot be reliably interrogated using this property unless
        you have already established it is an explicit fill.

        If the background is already a fill, then accessing this property
        makes no changes to the current background.
        """
        bgPr = self._cSld.get_or_add_bgPr()
        return FillFormat.from_fill_parent(bgPr)
示例#3
0
 def fill(self):
     """
     |FillFormat| instance for this cell, providing access to fill
     properties such as foreground color.
     """
     tcPr = self._tc.get_or_add_tcPr()
     return FillFormat.from_fill_parent(tcPr)
示例#4
0
    def solid_fixture(self, request, solid_fill_):
        cxml, expected_cxml = request.param

        fill = FillFormat.from_fill_parent(element(cxml))
        # --mock must be after FillFormat call to avoid poss. contructor call
        _SolidFill_ = class_mock(
            request, "pptx.dml.fill._SolidFill", return_value=solid_fill_, autospec=True
        )
        expected_xml = xml(expected_cxml)
        return fill, _SolidFill_, expected_xml, solid_fill_
示例#5
0
 def set_solid_fixture_(self, request, xPr_bldr):
     fill_type_str = request.param
     xFill_bldr = self._xFill_bldr(fill_type_str)
     if xFill_bldr is not None:
         xPr_bldr.with_child(xFill_bldr)
     xPr = xPr_bldr.element
     fill_format = FillFormat.from_fill_parent(xPr)
     xPr_with_solidFill_xml = (xPr_bldr.clear().with_nsdecls().with_child(
         a_solidFill()).xml())
     return fill_format, xPr_with_solidFill_xml
示例#6
0
    def background_fixture(self, request, no_fill_):
        cxml, expected_cxml = request.param

        fill = FillFormat.from_fill_parent(element(cxml))
        # --mock must be after FillFormat call to avoid poss. contructor call
        _NoFill_ = class_mock(request,
                              'pptx.dml.fill._NoFill',
                              return_value=no_fill_,
                              autospec=True)
        expected_xml = xml(expected_cxml)
        return fill, _NoFill_, expected_xml, no_fill_
示例#7
0
    def solid_fixture(self, request, solid_fill_):
        cxml, expected_cxml = request.param

        fill = FillFormat.from_fill_parent(element(cxml))
        # --mock must be after FillFormat call to avoid poss. contructor call
        _SolidFill_ = class_mock(request,
                                 "pptx.dml.fill._SolidFill",
                                 return_value=solid_fill_,
                                 autospec=True)
        expected_xml = xml(expected_cxml)
        return fill, _SolidFill_, expected_xml, solid_fill_
示例#8
0
 def fore_color_fixture_(self, request, xPr_bldr):
     mapping = {
         'solid': ColorFormat,
     }
     fill_type_str = request.param
     fore_color_type = mapping[fill_type_str]
     xFill_bldr = self._xFill_bldr(fill_type_str)
     if xFill_bldr is not None:
         xPr_bldr.with_child(xFill_bldr)
     xPr = xPr_bldr.element
     fill_format = FillFormat.from_fill_parent(xPr)
     return fill_format, fore_color_type
示例#9
0
 def set_solid_fixture_(self, request, xPr_bldr):
     fill_type_str = request.param
     xFill_bldr = self._xFill_bldr(fill_type_str)
     if xFill_bldr is not None:
         xPr_bldr.with_child(xFill_bldr)
     xPr = xPr_bldr.element
     fill_format = FillFormat.from_fill_parent(xPr)
     xPr_with_solidFill_xml = (
         xPr_bldr.clear()
                 .with_nsdecls()
                 .with_child(a_solidFill())
                 .xml()
     )
     return fill_format, xPr_with_solidFill_xml
示例#10
0
    def gradient_fixture(self, request, grad_fill_):
        cxml, expected_cxml = request.param

        fill = FillFormat.from_fill_parent(element(cxml))
        # --mock must be after FillFormat call to avoid poss. contructor call
        _GradFill_ = class_mock(request,
                                "pptx.dml.fill._GradFill",
                                return_value=grad_fill_,
                                autospec=True)
        expected_xml = xml(
            expected_cxml + "{rotWithShape=1}/(a:gsLst/(a:gs{pos=0}/a:scheme"
            "Clr{val=accent1}/(a:tint{val=100000},a:shade{val=100000},a:satM"
            "od{val=130000}),a:gs{pos=100000}/a:schemeClr{val=accent1}/(a:ti"
            "nt{val=50000},a:shade{val=100000},a:satMod{val=350000})),a:lin{"
            "scaled=0})")
        return fill, _GradFill_, expected_xml, grad_fill_
示例#11
0
    def gradient_fixture(self, request, grad_fill_):
        cxml, expected_cxml = request.param

        fill = FillFormat.from_fill_parent(element(cxml))
        # --mock must be after FillFormat call to avoid poss. contructor call
        _GradFill_ = class_mock(
            request, "pptx.dml.fill._GradFill", return_value=grad_fill_, autospec=True
        )
        expected_xml = xml(
            expected_cxml + "{rotWithShape=1}/(a:gsLst/(a:gs{pos=0}/a:scheme"
            "Clr{val=accent1}/(a:tint{val=100000},a:shade{val=100000},a:satM"
            "od{val=130000}),a:gs{pos=100000}/a:schemeClr{val=accent1}/(a:ti"
            "nt{val=50000},a:shade{val=100000},a:satMod{val=350000})),a:lin{"
            "scaled=0})"
        )
        return fill, _GradFill_, expected_xml, grad_fill_
示例#12
0
 def fore_color_raise_fixture_(self, request, xPr_bldr):
     mapping = {
         'none':  TypeError,
         'blip':  TypeError,
         'grad':  NotImplementedError,
         'grp':   TypeError,
         'no':    TypeError,
         'patt':  NotImplementedError,
     }
     fill_type_str = request.param
     exception_type = mapping[fill_type_str]
     xFill_bldr = self._xFill_bldr(fill_type_str)
     if xFill_bldr is not None:
         xPr_bldr.with_child(xFill_bldr)
     xPr = xPr_bldr.element
     fill_format = FillFormat.from_fill_parent(xPr)
     return fill_format, exception_type
示例#13
0
 def fill_type_fixture_(self, request, xPr_bldr):
     mapping = {
         'none':  None,
         'blip':  MSO_FILL.PICTURE,
         'grad':  MSO_FILL.GRADIENT,
         'grp':   MSO_FILL.GROUP,
         'no':    MSO_FILL.BACKGROUND,
         'patt':  MSO_FILL.PATTERNED,
         'solid': MSO_FILL.SOLID,
     }
     fill_type_str = request.param
     fill_type = mapping[fill_type_str]
     xFill_bldr = self._xFill_bldr(fill_type_str)
     if xFill_bldr is not None:
         xPr_bldr.with_child(xFill_bldr)
     xPr = xPr_bldr.element
     fill_format = FillFormat.from_fill_parent(xPr)
     return fill_format, fill_type
示例#14
0
 def fill(self):
     """
     |FillFormat| instance for this font, providing access to fill
     properties such as fill color.
     """
     return FillFormat.from_fill_parent(self._rPr)
示例#15
0
 def fill(self):
     """
     |FillFormat| instance for this shape, providing access to fill
     properties such as fill color.
     """
     return FillFormat.from_fill_parent(self._sp.spPr)