
    Q?h'                     x    S r SrSrSSKr\R                  " S5      rSrSSKJr  \R                  r	 " S S	5      r
g)
z3.5.14z.A frame is a container for content on a page.
)Frame    Nzreportlab.platypus)x1y1widthheightleftPaddingbottomPaddingrightPadding
topPadding)	rl_configc                       \ rS rSrSr   SS jrS rS rS rS r	S	 r
S
 rS rSS jr\rS rSS jrS rS rS rSrg)r      a   
A Frame is a piece of space in a document that is filled by the
"flowables" in the story.  For example in a book like document most
pages have the text paragraphs in one or two frames.  For generality
a page might have several frames (for example for 3 column text or
for text that wraps around a graphic).

After creation a Frame is not usually manipulated directly by the
applications program -- it is used internally by the platypus modules.

Here is a diagramatid abstraction for the definitional part of a Frame::

            width                    x2,y2
    +---------------------------------+
    | l  top padding                r | h
    | e +-------------------------+ i | e
    | f |                         | g | i
    | t |                         | h | g
    |   |                         | t | h
    | p |                         |   | t
    | a |                         | p |
    | d |                         | a |
    |   |                         | d |
    |   +-------------------------+   |
    |    bottom padding               |
    +---------------------------------+
    (x1,y1) <-- lower left corner

NOTE!! Frames are stateful objects.  No single frame should be used in
two documents at the same time (especially in the presence of multithreading.
Nc                 z   Xl         Xl        XR                  S'   X R                  S'   X0R                  S'   X@R                  S'   XPR                  S'   X`R                  S'   XpR                  S'   XR                  S'   Xl        Uc  [        R
                  nXl        U R                  5         U R                  5         g )	N_x1_y1_width_height_leftPadding_bottomPadding_rightPadding_topPadding)	id_debug__dict__showBoundaryr   overlapAttachedSpace_oASpace_geom_reset)selfr   r   r   r   r   r	   r
   r   r   r   r   r   s                K/var/www/html/env/lib/python3.13/site-packages/reportlab/platypus/frames.py__init__Frame.__init__5   s       "e!e"'h#)i  )4n%*7&')5o&'1m$ )'	@^@^)=,

    c                 P    U[         ;   a  U R                  SU-      $ [        U5      eN_)	_geomAttrr   AttributeError)r    as     r!   __getattr__Frame.__getattr__O   s&    	>$--A"66Qr$   c                 x    U[         ;   a"  X R                  SU-   '   U R                  5         g X R                  U'   g r&   )r(   r   r   )r    r*   vs      r!   __setattr__Frame.__setattr__S   s.    	>#$MM#a% JJL MM!r$   c                     U R                   R                  S0 5      (       d1  [         H'  nSU-   nU R                   U   U R                   S   U'   M)     UR                  5        H  u  p4[	        XU5        M     g N
_savedGeomr'   )r   
setdefaultr(   itemssetattr)r    kwdsgakr.   s        r!   	_saveGeomFrame._saveGeomZ   sf    }}''R88V26--2Cl+B/   ::<CAD1  r$   c                     U R                   R                  SS 5      (       aO  [         H4  nSU-   nU R                   U   S   U R                   U'   U R                   S	 M6     U R                  5         g g r2   )r   getr(   r   )r    r8   s     r!   _restoreGeomFrame._restoreGeomb   sd    ==\$//V$(MM"$5l$Cb!MM,/   JJL 0r$   c                 ~   U R                   U R                  -   U l        U R                  U R                  -   U l        U R                  U R                  -   U l        U R                  U R                   -
  U R                  -
  U R                  -
  U l
        U R
                  U R                  -
  U R                  -
  U l        g N)r   r   _x2r   r   _y2r   _y1pr   r   _aWr   _aHr    s    r!   r   Frame._geomj   s    88dkk)88dll*HHt222	88dhh&):)::T=O=OO88dii'$*:*::r$   c                     U R                  5         U R                  U R                  -   U l        U R                  U R
                  -
  U l        SU l        SU l        SU l	        SU l
        g )N   r   g        )r>   r   r   _xrC   r   _y_atTop_prevASpace_leftExtraIndent_rightExtraIndentrG   s    r!   r   Frame._resets   s[    ((T...((T---
 !$!$r$   c                 N    U R                   U R                  -
  U R                  -
  $ rA   )rE   rO   rP   rG   s    r!   _getAvailableWidthFrame._getAvailableWidth   s"    xx$///$2H2HHHr$   c                    Xl         X!l         [        USS5      (       a9  UR                  U 5         S H   n[	        X5      (       d  M  [        X5        M"     gU R                  nU R                  nSnU R                  5       n[        USS5      n	U R                  (       d^  UR                  5       nU R                  (       a=  [        USS5      (       d  U	(       a  U R                  n[        XpR                  -
  S5      nXV-
  U-
  n
U
S:  d  U	(       a  UR                  X5      u  pO( S H   n[	        X5      (       d  M  [        X5        M"     gX-  n
XZ-  nXV[        -
  :  a  [         R"                  (       dR  XR$                  :  d  X:  a>  U(       d7  SS	KJn  U" S
UR*                  < SU< SU
< SU< SU R$                  < S35      e S H   n[	        X5      (       d  M  [        X5        M"     gUR-                  5       n[        U SS5      nU(       GaA  US   R.                  (       Ga,  US   nUR0                  nUR2                  nUR4                  nU R6                  U-
  U-
  nU R8                  U-   nU(       d%  XZ-   U-   n[        XeU-
  5      n[        SUU-
  5      nOXZ-   U-
  nUU R:                  U R<                  -
  :  nUS:X  d  US:X  d  U(       aO  US:X  aI  [        SU(       a  U R:                  OUU R>                  -
  5      nU R>                  nUS:X  a
  SUS   l        OS=n=nnURA                  X UUUU5        US:X  a  URC                  5         URE                  X RF                  U RH                  -   XXU-
  S9  X!l        U RJ                  (       a&  [L        RO                  SURQ                  5       -  5        X]-  nU R                  (       a$  [        USS5      (       a  U R                  nXl        XPR                  :w  a  SU l	        XPl         S H   n[	        X5      (       d  M  [        X5        M"     g! S H   n[	        X5      (       d  M  [        X5        M"     f = f)zDraws the flowable at the current position.
Returns 1 if successful, 0 if it would not fit.
Raises a LayoutError if the object is too wide,
or if it is too high for a totally empty frame,
to avoid infinite loopsframeActionNcanv_framerJ   r   	_ZEROSIZEF_SPACETRANSFER)LayoutErrorz	Flowable z (xz points) too large for frame (z	 points).	_frameBGsframezframe-permanentzframe-permanent-1)_sWzdrew %s))rY   rX   getattrrV   hasattrdelattrrL   rD   rS   rM   getSpaceBeforer   rN   maxwrap_FUZZr   allowTableBoundsErrorsrF   reportlab.platypus.doctemplater\   	__class__getSpaceAfteractiveleftrightstartr   r   rC   r   r   renderpopdrawOnrK   rO   r   loggerdebugidentity)r    flowablerX   trySplitr*   ypsaWzeroSizehwr\   safbgbgfbglfbgrbgmfbwfbxfbhfbyatts                           r!   _add
Frame._add   s    L	(xd33$$T*N (8&&H' (K A		AA((*BxE:H;;**,==x(8??8 ,,A...q1A	Ash}}R+1l (8&&H' (i FAFAU7{ 77ajADZbJ% **AaDHH'> ? ?X (8&&H' (S ++-d;t43r7>>>RB77D88D((C++d*4/C((4-Cebj!!bDk!!CGneai!488d.>.>#>><30A+AccSfNf"%aSc488(K"LC"&((C"$550CB.//C/#IIdCC8G|	gg0E0E&EqQRdS";;Y9J9J9L-L M==x(8??!--')$gg:Qt{ (8&&H' ('8&&H' (s&   #P< CP< A;P< 2H"P< <Q$Q$c                    U R                   nU R                  nSnU R                  (       d9  UR                  5       nU R                  (       a  [        XPR                  -
  S5      nX4-
  U-
  nUS::  a  [        USS5      (       d  / $ Xl        X!l	         UR                  U R                  U5      nS H   n[        X5      (       d  M  [        X5        M"     U$ ! S H   n[        X5      (       d  M  [        X5        M"     f = f)z7Ask the flowable to split using up the available space.r   rZ   FrW   )rL   rD   rM   re   r   rf   rN   rb   rY   rX   splitrE   rc   rd   )	r    rw   rX   ry   rz   r{   r~   rr*   s	            r!   r   Frame.split   s    GGII{{'')A}}***1-CEa4U;;I	(txx+A (8&&H' (  (8&&H' (s   C C?/C?c                     UR                  U=(       d    U R                  U R                  U R                  U R                  U R                  -
  U R
                  U R                  -
  5        g rA   )drawBoundaryr   r   r   rB   rC   )r    rX   __boundary__s      r!   r   Frame.drawBoundary   sI    ,;$*;*;TXXtxx $488 3TXX5H	Jr$   c                 .   U R                   (       a"  [        R                  SU R                  -  5        U R                  (       a  U R                  U5        [        U5      S:  a1  US   nU R                  X2SS9(       a  US	 Og[        U5      S:  a  M0  gg)zwConsumes objects from the front of the list until the
frame is full.  If it cannot fit one object, raises
an exception.z&enter Frame.addFromlist() for frame %sr   )rx   N)r   rt   ru   r   r   r   lenadd)r    drawlistrX   heads       r!   addFromListFrame.addFromList   sy    
 ;;%MPTPWPW%WXd#(maA;Dxx1x-QK  (mar$   c                 Z    U R                   R                  S/ 5      R                  U5        g )N_generated_content)r   r4   extend)r    Cs     r!   add_generated_contentFrame.add_generated_content  s"      !5b9@@Cr$   c                     SU R                  5       < SU R                  < U R                  =(       a    S=(       d    S< S3$ )N(z x * ))rS   rF   rM   rG   s    r!   _aSpaceStringFrame._aSpaceString  s/     $ 7 7 9$((4;;CVSVC\Z\C\]]r$   )rF   rE   rM   r   rO   r   rN   rP   rK   rB   rL   rD   rC   r   r   )   r   r   r   Nr   NN)r   rA   )__name__
__module____qualname____firstlineno____doc__r"   r+   r/   r:   r>   r   r   rS   r   r   r   r   r   r   r   __static_attributes__ r$   r!   r   r      sg    > KL@A-14 !;%IT(l C.J"D^r$   r   )__version__r   __all__logging	getLoggerrt   r(   	reportlabr   rh   r   r   r$   r!   <module>r      sO   
 	 			/	0
g	 oow^ w^r$   