
    li                        d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ er&ddlmZmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ  G d de      Z G d de      Zy)z-Base shape-related objects such as BaseShape.    )annotations)TYPE_CHECKINGcast)ActionSetting)ShadowFormat)ElementProxy)lazyproperty)MSO_SHAPE_TYPEPP_PLACEHOLDER)ShapeElement)CT_Placeholder)BaseSlidePart)ProvidesPart)Lengthc                  J    e Zd ZdZd fdZddZddZedd       Ze	dd       Z
e	d d       Ze	d d       Ze	d d	       Ze	d!d
       Zej                  d"d       Ze	d d       Ze	d!d       Zej                  d"d       Ze	d#d       Zej                  d$d       Ze	d%d       Ze	d&d       Ze	d'd       Zej                  d(d       Zed)d       Ze	d*d       Ze	d+d       Ze	d!d       Zej                  d"d       Ze	d!d       Zej                  d"d       Z xZS ),	BaseShapezbBase class for shape objects.

    Subclasses include |Shape|, |Picture|, and |GraphicFrame|.
    c                >    t         |           || _        || _        y N)super__init___element_parent)self	shape_elmparent	__class__s      N/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/pptx/shapes/base.pyr   zBaseShape.__init__   s    !    c                T    t        |t              sy| j                  |j                  u S )z|True| if this shape object proxies the same element as *other*.

        Equality for proxy objects is defined as referring to the same XML element, whether or not
        they are the same proxy object instance.
        F
isinstancer   r   r   others     r   __eq__zBaseShape.__eq__    s$     %+}}..r   c                T    t        |t              sy| j                  |j                  uS )NTr    r"   s     r   __ne__zBaseShape.__ne__*   s"    %+}}ENN22r   c                Z    | j                   j                  j                  }t        ||       S )a  |ActionSetting| instance providing access to click behaviors.

        Click behaviors are hyperlink-like behaviors including jumping to a hyperlink (web page)
        or to another slide in the presentation. The click action is that defined on the overall
        shape, not a run of text within the shape. An |ActionSetting| object is always returned,
        even when no click behavior is defined on the shape.
        )r   _nvXxPrcNvPrr   )r   r)   s     r   click_actionzBaseShape.click_action/   s&     %%++UD))r   c                    | j                   S )z`lxml` element for this shape, e.g. a CT_Shape instance.

        Note that manipulating this element improperly can produce an invalid presentation file.
        Make sure you know what you're doing if you use this to change the underlying XML.
        )r   r   s    r   elementzBaseShape.element;   s     }}r   c                     y)z|True| if this shape is a graphic frame containing a chart object.

        |False| otherwise. When |True|, the chart object can be accessed using the ``.chart``
        property.
        F r,   s    r   	has_chartzBaseShape.has_chartD        r   c                     y)z|True| if this shape is a graphic frame containing a table object.

        |False| otherwise. When |True|, the table object can be accessed using the ``.table``
        property.
        Fr/   r,   s    r   	has_tablezBaseShape.has_tableO   r1   r   c                     y)z&|True| if this shape can contain text.Fr/   r,   s    r   has_text_framezBaseShape.has_text_frameZ   s     r   c                .    | j                   j                  S )zMRead/write. Integer distance between top and bottom extents of shape in EMUs.r   cyr,   s    r   heightzBaseShape.height`   s     }}r   c                &    || j                   _        y r   r7   r   values     r   r9   zBaseShape.heighte        r   c                .    | j                   j                  S )zkTrue if this shape is a placeholder.

        A shape is a placeholder if it has a <p:ph> element.
        )r   
has_ph_elmr,   s    r   is_placeholderzBaseShape.is_placeholderi   s     }}'''r   c                .    | j                   j                  S )zInteger distance of the left edge of this shape from the left edge of the slide.

        Read/write. Expressed in English Metric Units (EMU)
        r   xr,   s    r   leftzBaseShape.leftq        }}r   c                &    || j                   _        y r   rB   r;   s     r   rD   zBaseShape.lefty       r   c                .    | j                   j                  S )z%Name of this shape, e.g. 'Picture 7'.)r   
shape_namer,   s    r   namezBaseShape.name}   s     }}'''r   c                N    || j                   j                  j                  _        y r   )r   r(   r)   rJ   r;   s     r   rJ   zBaseShape.name   s    +0##(r   c                B    t        d| j                  j                        S )zThe package part containing this shape.

        A |BaseSlidePart| subclass in this case. Access to a slide part should only be required if
        you are extending the behavior of |pp| API objects.
        r   )r   r   partr,   s    r   rM   zBaseShape.part   s     OT\\%6%677r   c                ^    | j                   j                  }|t        d      t        |      S )zProvides access to placeholder-specific properties such as placeholder type.

        Raises |ValueError| on access if the shape is not a placeholder.
        zshape is not a placeholder)r   ph
ValueError_PlaceholderFormat)r   rO   s     r   placeholder_formatzBaseShape.placeholder_format   s/     ]]:9::!"%%r   c                .    | j                   j                  S )zDegrees of clockwise rotation.

        Read/write float. Negative values can be assigned to indicate counter-clockwise rotation,
        e.g. assigning -45.0 will change setting to 315.0.
        r   rotr,   s    r   rotationzBaseShape.rotation   s     }}   r   c                &    || j                   _        y r   rT   r;   s     r   rV   zBaseShape.rotation   s    !r   c                @    t        | j                  j                        S )z|ShadowFormat| object providing access to shadow for this shape.

        A |ShadowFormat| object is always returned, even when no shadow is
        explicitly defined on this shape (i.e. it inherits its shadow
        behavior).
        )r   r   spPrr,   s    r   shadowzBaseShape.shadow   s     DMM..//r   c                .    | j                   j                  S )z}Read-only positive integer identifying this shape.

        The id of a shape is unique among all shapes on a slide.
        )r   shape_idr,   s    r   r\   zBaseShape.shape_id   s     }}%%%r   c                D    t        t        |       j                   d      )zA member of MSO_SHAPE_TYPE classifying this shape by type.

        Like ``MSO_SHAPE_TYPE.CHART``. Must be implemented by subclasses.
        z! does not implement `.shape_type`)NotImplementedErrortype__name__r,   s    r   
shape_typezBaseShape.shape_type   s"     "T$Z%8%8$99Z"[\\r   c                .    | j                   j                  S )zDistance from the top edge of the slide to the top edge of this shape.

        Read/write. Expressed in English Metric Units (EMU)
        r   yr,   s    r   topzBaseShape.top   rE   r   c                &    || j                   _        y r   rc   r;   s     r   re   zBaseShape.top   rG   r   c                .    | j                   j                  S )z}Distance between left and right extents of this shape.

        Read/write. Expressed in English Metric Units (EMU).
        r   cxr,   s    r   widthzBaseShape.width   s     }}r   c                &    || j                   _        y r   rh   r;   s     r   rj   zBaseShape.width   r=   r   )r   r   r   r   )r#   objectreturnbool)rm   r   )rm   r   )rm   rn   )rm   r   )r<   r   )rm   str)r<   ro   )rm   r   )rm   rQ   )rm   float)r<   rp   )rm   r   rm   int)rm   r
   )r`   
__module____qualname____doc__r   r$   r&   r	   r*   propertyr-   r0   r3   r5   r9   setterr@   rD   rJ   rM   rR   rV   rZ   r\   ra   re   rj   __classcell__r   s   @r   r   r      s   

/3
 	* 	*        
     ]]! ! ( (   
[[    ( ( 
[[1 1 8 8 & & ! ! __" " 0 0 & & ] ]   	ZZ        \\! !r   r   c                  Z     e Zd ZdZd fdZedd       Zedd       Zed	d       Z xZ	S )
rQ   zProvides properties specific to placeholders, such as the placeholder type.

    Accessed via the :attr:`~.BaseShape.placeholder_format` property of a placeholder shape,
    c                2    t         |   |       || _        y r   )r   r   _ph)r   r-   r   s     r   r   z_PlaceholderFormat.__init__   s    !r   c                    | j                   S )z*The `p:ph` element proxied by this object.)r|   r,   s    r   r-   z_PlaceholderFormat.element   s     xxr   c                .    | j                   j                  S )z$Integer placeholder 'idx' attribute.)r|   idxr,   s    r   r   z_PlaceholderFormat.idx   s     xx||r   c                .    | j                   j                  S )zsPlaceholder type.

        A member of the :ref:`PpPlaceholderType` enumeration, e.g. PP_PLACEHOLDER.CHART
        )r|   r_   r,   s    r   r_   z_PlaceholderFormat.type   s     xx}}r   )r-   r   )rm   r   rq   )rm   r   )
r`   rs   rt   ru   r   rv   r-   r   r_   rx   ry   s   @r   rQ   rQ      sI    
      r   rQ   N)ru   
__future__r   typingr   r   pptx.actionr   pptx.dml.effectr   pptx.sharedr   	pptx.utilr	   pptx.enum.shapesr
   r   pptx.oxml.shapesr   pptx.oxml.shapes.sharedr   pptx.parts.slider   
pptx.typesr   r   rl   r   rQ   r/   r   r   <module>r      sJ    3 " & % ( $ "?-6.' B! B!J r   