
    ,h}                     j    d Z ddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ ddlmZ  G d d	e      Zy
)z4Presentation part, the main part in a .pptx package.    )RELATIONSHIP_TYPE)XmlPart)PackURI)NotesMasterPart	SlidePart)Presentation)lazypropertyc                       e Zd ZdZd Zed        Zd Zed        Z	ed        Z
ed        Zd Zd	 Zd
 Zd Zd Zed        Zy)PresentationPartziTop level class in object model.

    Represents the contents of the /ppt directory of a .pptx file.
    c                     | j                   }|j                  }t        j                  || j                  |      }| j                  |t        j                        }||j                  fS )z
        Return an (rId, slide) pair of a newly created blank slide that
        inherits appearance from *slide_layout*.
        )	_next_slide_partnamepartr   newpackage	relate_toRTSLIDEslide)selfslide_layoutpartnameslide_layout_part
slide_partrIds         Y/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/parts/presentation.py	add_slidezPresentationPart.add_slide   sW    
 ,,(--]]8T\\;LM
nnZ2J$$$$    c                 .    | j                   j                  S )z|
        A |CoreProperties| object providing read/write access to the core
        properties of this presentation.
        )r   core_propertiesr   s    r   r   z PresentationPart.core_properties   s     ||+++r   c                     | j                   j                  D ]8  }|j                  |k(  s| j                  |j                        j
                  c S  y)zReturn optional related |Slide| object identified by `slide_id`.

        Returns |None| if no slide with `slide_id` is related to this presentation.
        N)_elementsldIdLstidrelated_partr   r   )r   slide_idsldIds      r   	get_slidezPresentationPart.get_slide&   sI    
 ]]++ 	:Exx8#((3999	: r   c                 .    | j                   j                  S )z
        Return the |NotesMaster| object for this presentation. If the
        presentation does not have a notes master, one is created from
        a default template. The same single instance is returned on each
        call.
        )notes_master_partnotes_masterr    s    r   r+   zPresentationPart.notes_master0   s     %%222r   c                     	 | j                  t        j                        S # t        $ rD t	        j
                  | j                        }| j                  |t        j                         |cY S w xY w)z
        Return the |NotesMasterPart| object for this presentation. If the
        presentation does not have a notes master, one is created from
        a default template. The same single instance is returned on each
        call.
        )part_related_byr   NOTES_MASTERKeyErrorr   create_defaultr   r   )r   r*   s     r   r*   z"PresentationPart.notes_master_part:   sY    	%''88 	% / > >t|| LNN,boo>$$	%s   ! A
A.-A.c                 .    t        | j                  |       S )zg
        A |Presentation| object providing access to the content of this
        presentation.
        )r   r"   r    s    r   presentationzPresentationPart.presentationI   s     DMM400r   c                 8    | j                  |      j                  S )z?Return |Slide| object for related |SlidePart| related by `rId`.)r%   r   r   r   s     r   related_slidezPresentationPart.related_slideQ   s      %+++r   c                 8    | j                  |      j                  S )zCReturn |SlideMaster| object for |SlideMasterPart| related by `rId`.)r%   slide_masterr4   s     r   related_slide_masterz%PresentationPart.related_slide_masterU   s      %222r   c                 x    t        |      D ],  \  }}| j                  |      }t        d|dz   z        |_        . y)a  Assign incrementing partnames to the slide parts identified by `rIds`.

        Partnames are like `/ppt/slides/slide9.xml` and are assigned in the order their
        id appears in the `rIds` sequence. The name portion is always ``slide``. The
        number part forms a continuous sequence starting at 1 (e.g. 1, 2, ... 10, ...).
        The extension is always ``.xml``.
        /ppt/slides/slide%d.xml   N)	enumerater%   r   r   )r   rIdsidxr   r   s        r   rename_slide_partsz#PresentationPart.rename_slide_partsY   sD     "$ 	QHC**3/J")*CsQw*O"PJ	Qr   c                 :    | j                   j                  |       y)zSave this presentation package to `path_or_stream`.

        `path_or_stream` can be either a path to a filesystem location (a string) or a
        file-like object.
        N)r   save)r   path_or_streams     r   rA   zPresentationPart.savee   s     	.)r   c                     | j                   j                  D ]-  }| j                  |j                        |u s!|j                  c S  t        d      )z1Return the slide-id associated with `slide_part`.zmatching slide_part not found)r"   r#   r%   r   r$   
ValueError)r   r   r'   s      r   r&   zPresentationPart.slide_idm   sI    ]]++ 	 E  +z9xx	  899r   c                 n    | j                   j                         }dt        |      dz   z  }t        |      S )zCReturn |PackURI| instance containing next available slide partname.r:   r;   )r"   get_or_add_sldIdLstlenr   )r   r#   partname_strs      r   r   z%PresentationPart._next_slide_partnamet   s4     ==4460CMA4EF|$$r   N)__name__
__module____qualname____doc__r   propertyr   r(   r	   r+   r*   r2   r5   r8   r?   rA   r&   r    r   r   r   r      s    
	% , , 3 3 % % 1 1,3
Q*: % %r   r   N)rL   pptx.opc.constantsr   r   pptx.opc.packager   pptx.opc.packurir   pptx.parts.slider   r   pptx.presentationr   	pptx.utilr	   r   rN   r   r   <module>rU      s*    ; 6 $ $ 7 * "l%w l%r   