
    Pqhb
                     V    d 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y	)
zhObjects related to shapes.

A shape is a visual object that appears on the drawing layer of a document.
    )WD_INLINE_SHAPE)nsmap)Parentedc                   D     e Zd ZdZ fdZd Zd Zd Zed        Z	 xZ
S )InlineShapeszYSequence of |InlineShape| instances, supporting len(), iteration, and indexed
    access.c                 :    t         t        |   |       || _        y N)superr   __init___body)selfbody_elmparent	__class__s      K/srv/www/ollama/chat-ollama/venv/lib/python3.12/site-packages/docx/shape.pyr   zInlineShapes.__init__   s    lD*62
    c                 r    	 | j                   |   }t        |      S # t        $ r d|z  }t        |      w xY w)z2Provide indexed access, e.g. 'inline_shapes[idx]'.z$inline shape index [%d] out of range)_inline_lst
IndexErrorInlineShape)r   idxinlinemsgs       r   __getitem__zInlineShapes.__getitem__   sI    	"%%c*F 6""  	"83>CS/!	"s    6c                 (    d | j                   D        S )Nc              3   2   K   | ]  }t        |        y wr	   )r   ).0r   s     r   	<genexpr>z(InlineShapes.__iter__.<locals>.<genexpr>   s     CF#Cs   )r   r   s    r   __iter__zInlineShapes.__iter__   s    C$2B2BCCr   c                 ,    t        | j                        S r	   )lenr   r   s    r   __len__zInlineShapes.__len__   s    4##$$r   c                 @    | j                   }d}|j                  |      S )Nz//w:p/w:r/w:drawing/wp:inline)r   xpath)r   bodyr%   s      r   r   zInlineShapes._inline_lst"   s    zz/zz%  r   )__name__
__module____qualname____doc__r   r   r    r#   propertyr   __classcell__r   s   @r   r   r      s1    #D% ! !r   r   c                        e Zd ZdZ fdZed        Zej                  d        Zed        Zed        Z	e	j                  d        Z	 xZ
S )r   zdProxy for an ``<wp:inline>`` element, representing the container for an inline
    graphical object.c                 8    t         t        |           || _        y r	   )r
   r   r   _inline)r   r   r   s     r   r   zInlineShape.__init__-   s    k4)+r   c                 B    | j                   j                  j                  S )z[Read/write.

        The display height of this inline shape as an |Emu| instance.
        )r0   extentcyr   s    r   heightzInlineShape.height1        ||""%%%r   c                     || j                   j                  _        || j                   j                  j                  j
                  j                  _        y r	   )r0   r2   r3   graphicgraphicDatapicspPr)r   r3   s     r   r4   zInlineShape.height9   8    !#79((,,114r   c                    | j                   j                  j                  }|j                  }|t        d   k(  rL|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.
        r9   cdgm)r0   r7   r8   urir   r9   blipFillbliplinkr   LINKED_PICTUREPICTURECHART	SMART_ARTNOT_IMPLEMENTED)r   r8   r?   rA   s       r   typezInlineShape.type>   s     ll**66oo%,??++00Dyy$&555"***%*"(((%,",,,...r   c                 B    | j                   j                  j                  S )zZRead/write.

        The display width of this inline shape as an |Emu| instance.
        )r0   r2   cxr   s    r   widthzInlineShape.widthR   r5   r   c                     || j                   j                  _        || j                   j                  j                  j
                  j                  _        y r	   )r0   r2   rJ   r7   r8   r9   r:   )r   rJ   s     r   rK   zInlineShape.widthZ   r;   r   )r'   r(   r)   r*   r   r+   r4   setterrH   rK   r,   r-   s   @r   r   r   )   sy     & & ]]: : / /& & & \\: :r   r   N)	r*   docx.enum.shaper   docx.oxml.nsr   docx.sharedr   r   r    r   r   <module>rR      s+   
 ,   !8 !<4: 4:r   