%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/reportlab/graphics/widgets/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/reportlab/graphics/widgets/__pycache__/grids.cpython-312.pyc

�

��d`D�
�x�dZddlmZddlmZmZmZmZmZm	Z	m
Z
ddlmZm
Z
ddlmZmZmZmZmZmZmZddlmZd!d�Zd	�ZGd
�de�ZGd�d
e�ZGd�de�Zd�Zd�Zd�ZGd�dee�Z e!dk(r>dZ"edd�Z#e#jIe dddddd���e#jKdgdd� �yy)"z3.3.0�)�colors)�isNumber�
isColorOrNone�	isBoolean�isListOfNumbers�OneOf�isListOfColors�isNumberOrNone)�AttrMap�AttrMapValue)�Drawing�Group�Line�Rect�	LineShape�
definePath�
EmptyClipPath)�WidgetNc��|dk(r|dz}d}|dk(rd}g}||dzz
}	|t|�|zz}|dkDr||k\r	|S|dkr||kr	|S|j|��=)z6A range function, that does accept float increments...Ngg�?g-C��6?r)�len�append)�start�end�inc�L�nexts     �B/usr/lib/python3/dist-packages/reportlab/graphics/widgets/grids.py�frangers����d�{��c�k����
�d�{���
�A�

��F�
�
�C�
��s�1�v��|�#����7�t�s�{��

�H�	�1�W�����
�H�	
�����
�c�|�g}tt|dd��D]}|j||dz||z
��!|S)z}Returns a list of distances between adjacent numbers in some input list.

    E.g. [1, 1, 2, 3, 5, 7] -> [0, 1, 1, 2, 2]
    N����)�rangerr)�list�d�is   r�makeDistancesListr'#sK��	�A�
�3�t�C�R�y�>�
"�&��	����a��c��T�!�W�$�%�&�
�Hrc
���eZdZdZed-ideed���deed���deed���d	eed
���deed�d
���deed�d���deed�d���deed���deed���deed���dee	d���dee
d���dee
d���deed ���d!ee
d"���d#eed$����Zd%�Z
d&�Zd'�Zd.d(�Zd)�Zd*�Zd+�Zy,)/�Grida�This makes a rectangular grid of equidistant stripes.

    The grid contains an outer border rectangle, and stripes
    inside which can be drawn with lines and/or as solid tiles.
    The drawing order is: outer rectangle, then lines and tiles.

    The stripes' width is indicated as 'delta'. The sequence of
    stripes can have an offset named 'delta0'. Both values need
    to be positive!
    �x�!The grid's lower-left x position.��desc�y�!The grid's lower-left y position.�width�The grid's width.�height�The grid's height.�orientation��vertical�
horizontal�1Determines if stripes are vertical or horizontal.�useLines)rr"z+Determines if stripes are drawn with lines.�useRectsz6Determines if stripes are drawn with solid rectangles.�deltaz+Determines the width/height of the stripes.�delta0z3Determines the stripes initial width/height offset.�
deltaStepsz%List of deltas to be used cyclically.�stripeColorsz:Colors applied cyclically in the right or upper direction.�	fillColorz&Background color for entire rectangle.�strokeColorzColor used for lines.�strokeWidth�Width used for lines.�rectStrokeColorzColor for outer rect stroke.�rectStrokeWidthzWidth for outer rect stroke.c�Z�d|_d|_d|_d|_d|_d|_d|_d|_d|_g|_	tj|_tjtjtjg|_tj"|_d|_y)Nr�dr6r"��)r*r.r0r2r4r9r:r;r<r=r�whiter?�red�green�bluer>�blackr@rA)�selfs r�__init__z
Grid.__init__Ys�����������
����%�����
���
���
������������#�Z�Z����v�{�{�C���!�<�<�����rc�T�tdd�}t�}|j|�|S�NrF)r
r)�add�rN�D�gs   r�demoz	Grid.demojs%���C�����F��	���a���rc�.�t|d|j�}t|d|j�}|js|rY|rWt	|j
|j|j|j�}|j|_||_||_|Sy)NrCrD)	�getattrr@rAr?rr*r.r0r2)rNr@rA�rects    r�
makeOuterRectzGrid.makeOuterRectrsz���d�#4�T�5E�5E�F���d�#4�T�5E�5E�F���>�>�k�k���������
�
�D�K�K�@�D�!�^�^�D�N�*�D��*�D���K�rc���|j|j}}|r|}n|}|jrb||jzg}d}	|d||zkDr|d=ng|j	|d|j|t|j�zz�|dz}�Ot
||jz||z|j�}|j	||z�|jdk7r|jd|�|S)z1Returns a list of positions where to place lines.rr"r!)	r0r2r=r<rrrr;�insert)rNr�isX�w�h�length�rr&s        r�makeLinePosListzGrid.makeLinePosList~s����z�z�4�;�;�1����F��F��?�?�����$�%�A��A���R�5�5�6�>�)��"�������2������S����5I�1I�!J�J�K���E����u�t�{�{�*�E�F�N�D�J�J�G�A�	������ ��;�;�!��
�H�H�Q����rc��t�}|j|j}}|jdk(�r|jdk(r~|j|jd��}|D]Z}t||j||j|z�}|j|_	|j|_
|j|��\|S|jdk(r||j|jd��}|D]Z}t|j||j|z|�}|j|_	|j|_
|j|��\|S�Nr"r6)r]r7r)rr0r2r9r4rbr*rr.r@rArR)rN�groupr^r_rar*�liner.s        r�makeInnerLineszGrid.makeInnerLines�s(������z�z�4�;�;�1���=�=�A�����:�-��(�(����Q�(�7���$�A���4�6�6�1�d�f�f�q�j�9�D�'+�'7�'7�D�$�'+�'7�'7�D�$��I�I�d�O�	$����!�!�\�1��(�(����Q�(�7���$�A������4�6�6�A�:�q�9�D�'+�'7�'7�D�$�'+�'7�'7�D�$��I�I�d�O�	$��rc��t�}|j|j}}|jdk(�r|j}|j
dk(r|j
|jd��}n,|j
dk(r|j
|jd��}t�}d}tt|��D]�}|j
dk(r!||}	t|	|j|||�}
n/|j
dk(r ||}t|j||||�}
||t|�z
_
d|
_|j|
�|dz}��|Srd)rr0r2r:r>r4rbr*r.r'r#rrr?r@rR)rNrer^r_�colsra�distr&�jr*�striper.s            r�makeInnerTileszGrid.makeInnerTiles�s?������z�z�4�;�;�1���=�=�A���$�$�D����:�-��(�(����Q�(�7���!�!�\�1��(�(����Q�(�7��$�Q�'�D��A��3�t�9�%�

���#�#�z�1��!��A�!�!�T�V�V�T�!�W�a�8�F��%�%��5��!��A�!�$�&�&�!�Q��Q��8�F�#'��C��I�
�#6�� �%)��"��	�	�&�!���E��

��rc���t�}|j|j��|j|j��|j|j	�d��|S)N�
_gridLines��name)rrRrZrmrg)rNres  r�drawz	Grid.draw�sQ�����
�	�	�$�$�$�&�'�
�	�	�$�%�%�'�(�
�	�	�$�%�%�'�\�	�:��rN�)r)�__name__�
__module__�__qualname__�__doc__rrrrrr	rr
�_attrMaprOrVrZrbrgrmrrrsrrr)r)0s{��	��
���(K�L�
���(K�L�
��X�,?�@�
��h�-A�B�	
�
#�5�)C�#D�D�F�
� ��f�
�>�@�
� ��f�
�I�K�
��X�>�@�
��h�F�H�
�"�/�8�:�
�"$�N�M�O�#
�&!��9�;�'
�*#�=�(�*�+
�.#�8�(�*�/
�2'�}�;Y�Z�3
�4'�~�<Z�[�5
�H�:�"�
��6�2�Brr)c��eZdZdZeeed��eed��eed��eed��edd��edd	���
�Zd�Zd�Z	d
�Z
y)�
DoubleGridzFThis combines two ordinary Grid objects orthogonal to each other.
    r+r,r/r1r3NzThe first grid component.zThe second grid component.)r*r.r0r2�grid0�grid1c���d|_d|_d|_d|_t	�}|j|_|j|_|j|_|j|_d|_d|_d|_d|_d|_	g|_
tj|_
tjtjtj g|_tj$|_d|_t	�}|j|_|j|_|j|_|j|_d|_d|_d|_d|_d|_	g|_
tj|_
tjtjtj g|_tj$|_d|_||_||_y)NrrFr6r"rGr7)r*r.r0r2r)r4r9r:r;r<r=rrIr?rJrKrLr>rMr@rAr{r|)rN�g0�g1s   rrOzDoubleGrid.__init__�sT����������
����
�V���v�v����v�v����:�:����K�K��	�#��������������	���
��|�|���!�:�:�v�|�|�V�[�[�A�����������
�V���v�v����v�v����:�:����K�K��	�%��������������	���
��|�|���!�:�:�v�|�|�V�[�[�A�������������
���
rc�T�tdd�}t�}|j|�|SrQ)r
rzrRrSs   rrVzDoubleGrid.demos%���C�����L��	���a���rc�|�t�}|j|j}}|jdk(xr|jdk(xr||fxs||f}|D]!}|j	|j���#|D]B}|j	|j
��|j	|j�d���D|S)Nr"rrorp)rr{r|r:rRrZrmrg)rNrer~r�GrUs      rrrzDoubleGrid.draw$s���������T�Z�Z�B��
�K�K�1��=�����!1�=�r�"�g�H�"�R����	)�A��I�I�a�o�o�'�(�	)��	<�A��I�I�a�&�&�(�)��I�I�a�&�&�(�l�I�;�	<��r)rtrurvrwrrrrxrOrVrrrsrrrzrz�se������(K�L���(K�L��X�,?�@��h�-A�B��T�(C�D��T�(D�E�

�H�'�d�
rrzc�
�eZdZdZeeed��eed��eed��eed��eed�d��eed	��eed
��eed��eed��eed
��ee	d����Z
d�Zd�Zd�Z
d�Zy)�
ShadedRectaThis makes a rectangle with shaded colors between two colors.

    Colors are interpolated linearly between 'fillColorStart'
    and 'fillColorEnd', both of which appear at the margins.
    If 'numShades' is set to one, though, only 'fillColorStart'
    is used.
    r+r,r/r1r3r5r8�#The number of interpolating colors.zStart value of the color shade.zEnd value of the color shade.zColor used for border line.rB�#True if shading reverses in middle.)r*r.r0r2r4�	numShades�fillColorStart�fillColorEndr@rA�cylinderModec��d|_d|_d|_d|_d|_d|_tj|_tj|_
tj|_d|_d|_
|j|�y)NrrFr6rGrH)r*r.r0r2r4r�r�pinkr�rMr�r@rAr��
setProperties�rN�kws  rrOzShadedRect.__init__Kso����������
����%������$�k�k���"�L�L���!�<�<������������2�rc�T�tdd�}t�}|j|�|SrQ)r
r�rRrSs   rrVzShadedRect.demoYs%���C�����L��	���a���rc�t�|j|j|j|j|j|j
f\}}}}}}|dkr!|dkDr||z}|}|jdk(rE||}}n@|dkr!|dkDr||z}|}|jdk(r||}}n|dkr|dkr||z}|}||z}|}||||||fS)z8Flip rectangle's corners if width or height is negative.rr6r7)r*r.r0r2r�r�r4)rNr*r.r0r2r�r�s       r�_flipRectCornerszShadedRect._flipRectCorners`s���<@�F�F�D�F�F�D�J�J�X\�Xc�Xc�ei�ex�ex�z~�{L�{L�=L�9��1�e�V�^�\��1�9��!���E�	�A��F�E�����+�L�Zh�\�^�
�A�X�%��'��F�
�A��W�F�����-�l�\j�|�~�
�a�Z�F�Q�J��E�	�A��F�E��F�
�A��W�F��!�U�F�N�L�@�@rc���t�}|j�\}}}}}}|j}|jr|dzs|dz}t	|dz
dz�dz}	t|�}
|jdk(}|r|dk(r|g}n0t|||z||
z�}n|dk(r|g}nt|||z||
z�}|D]�}
|xrt|
|||
z|�xst||
|||
z�}|jrT|j|
�	k\r tj||||	|d|
�}n?tj|||d||	|
�}ntj|||d|d|
�}||_||_
d|_|j|���|jrW|jdk\rHt||||�}|j|_
|j|_d|_|j|�|S)NrHr"r6r!r)rr�r�r��int�floatr4rr�indexr�linearlyInterpolatedColorr?r@rArR)rNrer*r.r^r_�c0�c1r��
halfNumShades�numr6�V�vrl�colrYs                 rrrzShadedRect.drawrs������!�2�2�4���1�a��B���N�N�	�����Q�;�I�a�K�	���1��a��0�1�4�M��I����#�#�z�1����A�~��C���1�a�!�e�Q�s�U�+���A�~��C���1�a�!�e�Q�s�U�+���	�A��6�$�q�!�Q�s�U�A�"6�N�$�q�!�Q��#��:N�F�� � ��7�7�1�:�}�,� �:�:�2�b��=�AQ�RS�TV�RW�YZ�[�C� �:�:�2�b��1��a�
�FV�XY�Z�C��6�6�r�"�Q�q�T�!�B�%��K��"�F��!$�F��!"�F���I�I�f��	����� 0� 0�!� 3���1�a��#�D�#�/�/�D��#�/�/�D��!�D�N��I�I�d�O��rN)rtrurvrwrrrrrrrxrOrVr�rrrsrrr�r�4s�������(K�L���(K�L��X�,?�@��h�-A�B�"�5�)C�#D�K~�� ��0U�V�%�m�:[�\�#�M�8W�X�"�=�7T�U�"�8�2I�J�#�I�4Y�Z�
�H���A�$(rr�c
��|dk(r|gSg}|dkDr=|dz
}t|�D]*}|jtj||d||���,|S)z7Return a range of intermediate colors between c0 and c1r"r)r#rrr�)r�r��n�C�limr&s      r�
colorRanger��s]���!�t�R�D�[�
�A���s���c���q��	G�A�
�H�H�V�5�5�b��A�c�1�E�F�	G��Hrc�n�d}d}|D]\}}||z
}||z
}�tt|��}||z||zfS)z(compute average point of a set of pointsr)r�r)�P�cx�cyr*r.r�s      r�centroidr��sR��	
�B�	
�B�����!�
�A���
�A����	�c�!�f�
�A�
�a�4��A��:�rc���ddlm}m}m}t	|�\}}|dz|z}||�||�}
}	|	|
||fd�}|	|
||fd�}tt
||��}
|
j�|
d|
d}}tt
||��}
|
j�|
d|
d}}|||z
c|_|_	|||z
c|_
|_t|
|	|	|
||f��}|j|�|S)aU
    given P a sequence P of x,y coordinate pairs and an angle in degrees
    find the centroid of P and the axis at angle theta through it
    find the extreme points of P wrt axis parallel distance and axis
    orthogonal distance. Then compute the least rectangle that will still
    enclose P when rotated by angle.

    The class R
    r)�pi�cos�sing�f@c�.�|\}}|||z
z|||z
zzS�Nrs��xy�s�c�x0�y0r*r.s       r�parallelAxisDistz.rotatedEnclosingRect.<locals>.parallelAxisDist��&�����!��1�R�4���A�b�D��!�"rc�.�|\}}|||z
z|||z
zzSr�rsr�s       r�orthogonalAxisDistz0rotatedEnclosingRect.<locals>.orthogonalAxisDist�r�rr!)�	transform)�mathr�r�r�r�r$�map�sortr*r0r.r2rrR)r��anglerYr�r�r�r�r��thetar�r�r�r�r�a0�a1�b0�b1rUs                   r�rotatedEnclosingRectr��s���"�!�
�a�[�F�B��
�4�Z��O�E��E�
�3�u�:�a�A��!�r�R�#�!"�A��r�#�	
�S�!�!�
$�%�A��F�F�H�
�q�T�1�R�5��B��S�#�A�
&�'�A��F�F�H�
�q�T�1�R�5��B��R��U��D�F�D�J��b��e��D�F�D�K�
��1�a�R��"�R�(�)�A��E�E�$�K��Hrc��eZdZeeeed��ee�ee�eed��eed��ee	���Z
d�Zd�Zy)	�
ShadedPolygonz
Shading angler,r�r�)�BASEr�r�r�r�r��pointsc��d|_tj|_tj|_d|_d|_gd�|_tj||�y)N�Zr�2)r!r!rHrH�r!)r�rrJr�rKr�r�r�r�rrOr�s  rrOzShadedPolygon.__init__�sG����
�$�j�j���"�L�L���������&������4��#rc��|j}tt|fd�tdt	|�d���}td|dzg|ddD�cgc]}d|z��	c}zdgzdd��}d|_t�}|j|�|j}d	}|d
k(rd}n|dvrd}d}tdd|�
�}dD]}t||t||���|jt|||��|jt�|j�}d|_|j |_|j"|_|j|�|Scc}w)Nc��||||dzfS)Nr"rs)r&r�s  r�<lambda>z$ShadedPolygon.draw.<locals>.<lambda>�s��A�a�D��1�Q�3��=�rrrH)�moveTor")�lineTo�	closePath)r?r@r6�)r�ir7)rAr@r4)r�r�r�r�)r�r$r�r#rr�
isClipPathrrRr�r��setattrrXr�r�copyr@rA)	rNr�r*�pathrUr�r4rY�ks	         rrrzShadedPolygon.draw�sD���K�K�����0��q��Q���1B�C�D���;�q��t�+�,�Q�q�r�U�-K��k�!�m�-K�K�[�M�Y���.������G��	���d���
�
�� ���#�:��E�
�h�
�%�K��E��a�D�[�Q��N�	,�A��D��7�4��?�+�	,�	���"�1�e�T�2�3�	���m���y�y�{������+�+����+�+���	���d�����-.Ls�
E
N)
rtrurvrrrrrrrrxrOrrrsrrr�r��sP���I��X�?�;�%�m�4�#�M�2� ��0U�V�#�I�4Y�Z��o�.�

�H�$�rr��__main__�-�x)�
r��<r��nr�r"r�r�)r�r@rAr�r�r��gif�shobjz/tmp)�formats�fnRoot�outDir)NN)&�__version__�
reportlab.libr�reportlab.lib.validatorsrrrrrr	r
�reportlab.lib.attrmaprr�reportlab.graphics.shapesr
rrrrrr�reportlab.graphics.widgetbaserrr'r)rzr�r�r�r�r�rtr�rTrR�saversrr�<module>r�s���
�� ����7�f�f�f�0�
�.

�k�6�k�\S��S�lf��f�R	
��
�@,�F�9�,�\�Z��
�E���C��A��E�E�-�3��QR�Y[�fh�vw�
x�y��F�F�E�7�'��F�8�	r

Zerion Mini Shell 1.0