o
    &T
                     @   sd   d Z ddlmZmZmZmZ ddlmZ ddlm	Z	 ddl
mZ G dd deZG d	d
 d
eZdS )z[
Objects related to shapes, visual objects that appear on the drawing layer of
a document.
    )absolute_importdivisionprint_functionunicode_literals   )WD_INLINE_SHAPE)nsmap)Parentedc                       sD   e Zd ZdZ fddZdd Zdd Zdd	 Zed
d Z	  Z
S )InlineShapeszc
    Sequence of |InlineShape| instances, supporting len(), iteration, and
    indexed access.
    c                    s   t t| | || _d S N)superr
   __init___body)selfZbody_elmparent	__class__ :D:\Projects\ConvertPro\env\Lib\site-packages\docx\shape.pyr      s   
zInlineShapes.__init__c                 C   s4   z
| j | }W t|S  ty   d| }t|w )zC
        Provide indexed access, e.g. 'inline_shapes[idx]'
        z$inline shape index [%d] out of range)_inline_lst
IndexErrorInlineShape)r   idxinlinemsgr   r   r   __getitem__   s   zInlineShapes.__getitem__c                 C   s   dd | j D S )Nc                 s   s    | ]}t |V  qd S r   )r   ).0r   r   r   r   	<genexpr>&   s    z(InlineShapes.__iter__.<locals>.<genexpr>)r   r   r   r   r   __iter__%   s   zInlineShapes.__iter__c                 C   s
   t | jS r   )lenr   r   r   r   r   __len__(   s   
zInlineShapes.__len__c                 C   s   | j }d}||S )Nz//w:p/w:r/w:drawing/wp:inline)r   xpath)r   bodyr"   r   r   r   r   +   s   
zInlineShapes._inline_lst)__name__
__module____qualname____doc__r   r   r   r!   propertyr   __classcell__r   r   r   r   r
      s    r
   c                       s`   e Zd ZdZ f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	  Z
S )r   zn
    Proxy for an ``<wp:inline>`` element, representing the container for an
    inline graphical object.
    c                    s   t t|   || _d S r   )r   r   r   _inline)r   r   r   r   r   r   7   s   
zInlineShape.__init__c                 C   
   | j jjS )zc
        Read/write. The display height of this inline shape as an |Emu|
        instance.
        )r*   extentcyr   r   r   r   height;      
zInlineShape.heightc                 C      || j j_|| j jjjj_d S r   )r*   r,   r-   graphicgraphicDatapicspPr)r   r-   r   r   r   r.   C      
c                 C   sf   | j jj}|j}|td kr|jjj}|jdurt	j
S t	jS |td kr't	jS |td kr0t	jS t	jS )z
        The type of this inline shape as a member of
        ``docx.enum.shape.WD_INLINE_SHAPE``, e.g. ``LINKED_PICTURE``.
        Read-only.
        r3   NcZdgm)r*   r1   r2   urir   r3   ZblipFillbliplinkr   ZLINKED_PICTUREZPICTUREZCHARTZ	SMART_ARTZNOT_IMPLEMENTED)r   r2   r7   r8   r   r   r   typeH   s   


zInlineShape.typec                 C   r+   )zb
        Read/write. The display width of this inline shape as an |Emu|
        instance.
        )r*   r,   cxr   r   r   r   width\   r/   zInlineShape.widthc                 C   r0   r   )r*   r,   r;   r1   r2   r3   r4   )r   r;   r   r   r   r<   d   r5   )r$   r%   r&   r'   r   r(   r.   setterr:   r<   r)   r   r   r   r   r   2   s    



r   N)r'   Z
__future__r   r   r   r   Z
enum.shaper   Zoxml.nsr   sharedr	   r
   objectr   r   r   r   r   <module>   s   !