
    hi                        d 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
 er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          ZdS )zhObjects related to shapes.

A shape is a visual object that appears on the drawing layer of a document.
    )annotations)TYPE_CHECKING)WD_INLINE_SHAPE)nsmap)Parented)CT_Body)	CT_Inline)	StoryPart)Lengthc                  N     e Zd ZdZd fdZdd	Zd
 Zd Zed             Z	 xZ
S )InlineShapeszUSequence of |InlineShape| instances, supporting len(), iteration, and indexed access.body_elmr   parentr
   c                f    t          t          |                               |           || _        d S N)superr   __init___body)selfr   r   	__class__s      b/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/docx/shape.pyr   zInlineShapes.__init__   s,    lD!!**6222


    idxintc                    	 | j         |         }n"# t          $ r d|z  }t          |          w xY wt          |          S )z2Provide indexed access, e.g. 'inline_shapes[idx]'.z$inline shape index [%d] out of range)_inline_lst
IndexErrorInlineShape)r   r   inlinemsgs       r   __getitem__zInlineShapes.__getitem__   sW    	"%c*FF 	" 	" 	"83>CS//!	" 6"""s    /c                $    d | j         D             S )Nc              3  4   K   | ]}t          |          V  d S r   )r   ).0r   s     r   	<genexpr>z(InlineShapes.__iter__.<locals>.<genexpr>'   s*      CCF##CCCCCCr   )r   r   s    r   __iter__zInlineShapes.__iter__&   s    CC$2BCCCCr   c                *    t          | j                  S r   )lenr   r&   s    r   __len__zInlineShapes.__len__)   s    4#$$$r   c                >    | j         }d}|                    |          S )Nz//w:p/w:r/w:drawing/wp:inline)r   xpath)r   bodyr,   s      r   r   zInlineShapes._inline_lst,   s     z/zz%   r   )r   r   r   r
   )r   r   )__name__
__module____qualname____doc__r   r!   r'   r*   propertyr   __classcell__r   s   @r   r   r      s        __     # # # #D D D% % % ! ! X! ! ! ! !r   r   c                       e Zd ZdZd fdZedd            Zej        dd	            Zed
             Zed             Z	e	j        dd            Z	 xZ
S )r   zdProxy for an ``<wp:inline>`` element, representing the container for an inline
    graphical object.r   r	   c                d    t          t          |                                            || _        d S r   )r   r   r   _inline)r   r   r   s     r   r   zInlineShape.__init__7   s*    k4  ))+++r   returnr   c                $    | j         j        j        S )z[Read/write.

        The display height of this inline shape as an |Emu| instance.
        )r7   extentcyr&   s    r   heightzInlineShape.height;        |"%%r   r;   c                h    || j         j        _        || j         j        j        j        j        _        d S r   )r7   r:   r;   graphicgraphicDatapicspPr)r   r;   s     r   r<   zInlineShape.heightC   +    !#79(,1444r   c                @   | j         j        j        }|j        }|t          d         k    r0|j        j        j        }|j        t          j
        S t          j        S |t          d         k    rt          j        S |t          d         k    rt          j        S t          j        S )zThe type of this inline shape as a member of
        ``docx.enum.shape.WD_INLINE_SHAPE``, e.g. ``LINKED_PICTURE``.

        Read-only.
        rA   Ncdgm)r7   r?   r@   urir   rA   blipFillbliplinkr   LINKED_PICTUREPICTURECHART	SMART_ARTNOT_IMPLEMENTED)r   r@   rG   rI   s       r   typezInlineShape.typeH   s     l*6o%,?+0Dy$&55"**%*"((%,",,..r   c                $    | j         j        j        S )zZRead/write.

        The display width of this inline shape as an |Emu| instance.
        )r7   r:   cxr&   s    r   widthzInlineShape.width\   r=   r   rR   c                h    || j         j        _        || j         j        j        j        j        _        d S r   )r7   r:   rR   r?   r@   rA   rB   )r   rR   s     r   rS   zInlineShape.widthd   rC   r   )r   r	   )r8   r   )r;   r   )rR   r   )r.   r/   r0   r1   r   r2   r<   setterrP   rS   r3   r4   s   @r   r   r   3   s               & & & X& ]: : : ]: / / X/& & & X& \: : : \: : : : :r   r   N)r1   
__future__r   typingr   docx.enum.shaper   docx.oxml.nsr   docx.sharedr   docx.oxml.documentr   docx.oxml.shaper	   docx.parts.storyr
   r   r   r    r   r   <module>r_      s   
 # " " " " "             + + + + + +                   #******))))))******""""""! ! ! ! !8 ! ! !<4: 4: 4: 4: 4: 4: 4: 4: 4: 4:r   