Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pyrect/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pyrect/__pycache__/__init__.cpython-312.pyc

�

%ٜg����l�ddlZddlZdZdZdZdZdZdZdZd	Z	d
Z
dZdZd
Z
dZdZdZdZdZdZdZdZdZdZej0dd�Zej0dd�Zej0dd�ZGd�de�Zd �Zd!�Zd"�Z d#�Z!d$�Z"d%�Z#		Gd&�d'e$�Z%e&d(k(re'ejP��yy))�Nz0.2.0�top�bottom�left�right�topleft�topright�
bottomleft�bottomright�midtop�midright�midleft�	midbottom�center�centerx�centery�width�height�size�box�area�	perimeter�Boxzleft top width height�Pointzx y�Sizezwidth heightc��eZdZdZy)�PyRectExceptionz�
    This class exists for PyRect exceptions. If the PyRect module raises any
    non-PyRectException exceptions, this indicates there's a bug in PyRect.
    N)�__name__�
__module__�__qualname__�__doc__���:/usr/local/lib/python3.12/site-packages/pyrect/__init__.pyrr's���
	r"rc�t�t|ttf�s"td|jj
z��y)zGRaises an exception if arg is not an int or float. Always returns None.�%argument must be int or float, not %sN)�
isinstance�int�floatr�	__class__r��args r#�_checkForIntOrFloatr,0s4���c�C��<�(��3�s�}�}�7M�7M�N�
�	
�)r"c�h�t|t�s"td|jjz��y)z>Raises an exception if arg is not an int. Always returns None.r%N)r&r'rr)rr*s r#�_checkForIntr.8s0���c�3���3�s�}�}�7M�7M�N�
�	
� r"c��	t|dttf�rt|dttf�std��y#td��xYw)Nr�z@argument must be a two-item tuple containing int or float values�r&r'r(rr*s r#�_checkForTwoIntOrFloatTupler2@sX��
��#�a�&�3��,�/�z�#�a�&�3�PU�,�7W�!�R��
�8X��
��N�
�	
�s�=A�
A
c��	t|dttf�rKt|dttf�r2t|dttf�rt|dttf�std��y#td��xYw)Nrr0��zAargument must be a four-item tuple containing int or float valuesr1r*s r#�_checkForFourIntOrFloatTupler6Ls{��

��3�q�6�C��<�0��c�!�f�s�E�l�3��c�!�f�s�E�l�3��c�!�f�s�E�l�3�!�S��
�4��

��O�
�	
�s�A/A2�2
A?c��y)zFReturns True if rectOrPoint1 and rectOrPoint2 collide with each other.Nr!)�rectOrPoint1�rectOrPoint2s  r#�	_collidesr:]s�r"c���g}g}|D]}	t|�|j|��!||fS#t$r1	t|�n#td��xYw|j|�Y�_wxYw)Nz'argument is not a point or a rect tuple)r2�appendrr6)�
rectsOrPoints�points�rects�rectOrPoints    r#�_getRectsAndPointsrAasz��
�F��E�$��	&�'��4��M�M�+�&�%�
�6�?���
�	&�
Q�,�[�9��
Q�%�&O�P�P���L�L��%�	&�s&�-�	A'�A�A'�
A�A'�&A'c���eZdZ								d=d�Zd�Zd�Zd�Zed��Zejd��Zed��Z
e
jd	��Z
e
Zed
��Zejd��ZeZ
ed��Zejd
��Zed��Zejd��Zed��Zejd��Zed��Zejd��Zed��Zejd��Zed��Zejd��Zed��Zejd��Zed��Zejd��Zed��Zejd��Zed��Zejd��Zed ��Zejd!��Zed"��Zejd#��Zed$��Zejd%��Zed&��Zejd'��Zed(��Zejd)��ZeZed*��Zejd+��ZeZed,��Z ed-��Z!ed.��Z"e"jd/��Z"d0�Z#d1�Z$d2�Z%d3�Z&d>d4�Z'd5�Z(	d6�Z)d7�Z*	d8�Z+d9�Z,d:�Z-			d;�Z.d<�Z/y)?�RectNc	��t|�t|�t|�t|�t|�|_t|�|_|�t	|�std��||_|�t	|�std��||_|rAt|�|_	t|�|_
t|�|_t|�|_yt|�|_	t|�|_
t|�|_t|�|_y)NzConChange argument must be None or callable (function, method, etc.)zAonRead argument must be None or callable (function, method, etc.))r,�bool�_enableFloat�	_readOnly�callabler�onChange�onReadr(�_width�_height�_left�_topr')	�selfrrrr�enableFloat�readOnlyrIrJs	         r#�__init__z
Rect.__init__�s���	�E�"��F�#��D�!��C� � ��-����h��������(:�!�U��
�!��
���h�v�&6�!�S��
�������,�D�K� ��=�D�L��t��D�J��c�
�D�I��e�*�D�K��v�;�D�L��T��D�J��C��D�Ir"c
��|jj�d|j�d|j�d|j�d|j
�d�
S)zLReturn a string of the constructor function call to create this Rect object.z(left=z, top=z, width=z	, height=�))r)rrMrNrKrL�rOs r#�__repr__z
Rect.__repr__�s7��
�N�N�#�#��J�J��I�I��K�K��L�L�
�	
r"c	�p�d|j�d|j�d|j�d|j�d�	S)z3Return a string representation of this Rect object.z(x=z, y=z, w=z, h=rT)rMrNrKrLrUs r#�__str__zRect.__str__�s*��
�J�J��I�I��K�K��L�L�	
�	
r"c	���|j�S|jt||||�t|j|j|j|j
��yy)N)rIrrMrNrKrL)rO�oldLeft�oldTop�oldWidth�	oldHeights     r#�callOnChangezRect.callOnChange�sK���=�=�$��M�M��G�V�X�y�9��D�J�J��	�	�4�;�;����E�
�%r"c��|jS)ag
        A Boolean attribute that determines if this rectangle uses floating point
        numbers for its position and size. False, by default.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.enableFloat
        False
        >>> r.enableFloat = True
        >>> r.top = 3.14
        >>> r
        Rect(left=0.0, top=3.14, width=10.0, height=20.0)
        )rFrUs r#rPzRect.enableFloat�s��� � � r"c��t|t�std��||_|jrit	|j
�|_t	|j�|_t	|j�|_t	|j�|_yt|j
�|_t|j�|_t|j�|_t|j�|_y)Nz'enableFloat must be set to a bool value)
r&rErrFr(rMrNrKrLr')rO�values  r#rPzRect.enableFloat	s����%��&�!�"K�L�L�!�������t�z�z�*�D�J��d�i�i�(�D�I�����,�D�K� ����.�D�L��T�Z�Z��D�J��D�I�I��D�I��d�k�k�*�D�K��t�|�|�,�D�Lr"c�\�|j�|jt�|jS)z�
        The x coordinate for the left edge of the rectangle. `x` is an alias for `left`.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.left
        0
        >>> r.left = 50
        >>> r
        Rect(left=50, top=0, width=10, height=20)
        )rJ�LEFTrMrUs r#rz	Rect.lefts$���;�;�"��K�K����z�z�r"c�,�|jrtd��t|�||jk7rc|j}|jr||_nt|�|_|j
||j|j|j�yy�N�Rect object is read-only)
rGrr,rMrFr'r^rNrKrL)rO�newLeft�originalLefts   r#rz	Rect.left+sr���>�>�!�"<�=�=��G�$��t�z�z�!��:�:�L�� � �$��
� ��\��
����l�D�I�I�t�{�{�D�L�L�Q�
"r"c�\�|j�|jt�|jS)z�
        The y coordinate for the top edge of the rectangle. `y` is an alias for `top`.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.top
        0
        >>> r.top = 50
        >>> r
        Rect(left=0, top=50, width=10, height=20)
        )rJ�TOPrNrUs r#rzRect.top>s$���;�;�"��K�K����y�y�r"c�,�|jrtd��t|�||jk7rc|j}|jr||_nt|�|_|j
|j||j|j�yyre)
rGrr,rNrFr'r^rMrKrL)rO�newTop�originalTops   r#rzRect.topNsr���>�>�!�"<�=�=��F�#��T�Y�Y���)�)�K�� � �"��	���K��	����d�j�j�+�t�{�{�D�L�L�Q�
r"c�v�|j�|jt�|j|jzS)z�
        The x coordinate for the right edge of the rectangle.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.right
        10
        >>> r.right = 50
        >>> r
        Rect(left=40, top=0, width=10, height=20)
        )rJ�RIGHTrMrKrUs r#rz
Rect.right_s-���;�;�"��K�K����z�z�D�K�K�'�'r"c�z�|jrtd��t|�||j|jzk7r}|j}|j
r||jz
|_nt
|�|jz
|_|j||j|j|j�yyre)
rGrr,rMrKrFr'r^rNrL)rO�newRightrhs   r#rz
Rect.rightos����>�>�!�"<�=�=��H�%���
�
�T�[�[�0�0��:�:�L�� � �%����3��
� ��]�T�[�[�8��
����l�D�I�I�t�{�{�D�L�L�Q�
1r"c�v�|j�|jt�|j|jzS)z�The y coordinate for the bottom edge of the rectangle.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.bottom
        20
        >>> r.bottom = 30
        >>> r
        Rect(left=0, top=10, width=10, height=20)
        )rJ�BOTTOMrNrLrUs r#rzRect.bottom�s-���;�;�"��K�K����y�y�4�<�<�'�'r"c�z�|jrtd��t|�||j|jzk7r}|j}|j
r||jz
|_nt
|�|jz
|_|j|j||j|j�yyre)
rGrr,rNrLrFr'r^rMrK)rO�	newBottomrms   r#rzRect.bottom�s����>�>�!�"<�=�=��I�&�����T�\�\�1�1��)�)�K�� � �%����4��	��	�N�T�\�\�9��	����d�j�j�+�t�{�{�D�L�L�Q�
2r"c��|j�|jt�t|j|j��S)a
        The x and y coordinates for the top right corner of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.topleft
        (0, 0)
        >>> r.topleft = (30, 30)
        >>> r
        Rect(left=30, top=30, width=10, height=20)
        ��x�y)rJ�TOPLEFTrrMrNrUs r#rzRect.topleft�s/���;�;�"��K�K�� ��t�z�z�T�Y�Y�/�/r"c��|jrtd��t|�|\}}||jk7s||jk7r||j}|j}|j
r||_||_n t
|�|_t
|�|_|j|||j|j�yyre)
rGrr2rMrNrFr'r^rKrL)rOrargrlrhrms      r#rzRect.topleft�s����>�>�!�"<�=�=�#�E�*������t�z�z�!��d�i�i���:�:�L��)�)�K�� � �$��
�"��	� ��\��
���K��	����l�K����d�l�l�S�
 r"c��|j�|jt�t|j|j|j
z��S)a
        The x and y coordinates for the bottom right corner of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.bottomleft
        (0, 20)
        >>> r.bottomleft = (30, 30)
        >>> r
        Rect(left=30, top=10, width=10, height=20)
        rw)rJ�
BOTTOMLEFTrrMrNrLrUs r#r	zRect.bottomleft�s8���;�;�"��K�K�
�#��t�z�z�T�Y�Y����%=�>�>r"c���|jrtd��t|�|\}}||jk7s||j|j
zk7r�|j}|j}|jr||_||j
z
|_n-t|�|_t|�|j
z
|_|j|||j|j
�yyre)
rGrr2rMrNrLrFr'r^rK)rOrargrurhrms      r#r	zRect.bottomleft�s����>�>�!�"<�=�=�#�E�*�"�����t�z�z�!�����T�\�\�1�1��:�:�L��)�)�K�� � �$��
�%����4��	� ��\��
��	�N�T�\�\�9��	����l�K����d�l�l�S�
2r"c��|j�|jt�t|j|jz|j
��S)a
        The x and y coordinates for the top right corner of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.topright
        (10, 0)
        >>> r.topright = (30, 30)
        >>> r
        Rect(left=20, top=30, width=10, height=20)
        rw)rJ�TOPRIGHTrrMrKrNrUs r#rz
Rect.topright�s8���;�;�"��K�K��!��t�z�z�D�K�K�/�4�9�9�=�=r"c���|jrtd��t|�|\}}||j|jzk7s||j
k7r�|j}|j
}|jr||jz
|_||_n-t|�|jz
|_t|�|_|j|||j|j�yyre)
rGrr2rMrKrNrFr'r^rL)rOrarqrlrhrms      r#rz
Rect.topright�s����>�>�!�"<�=�=�#�E�*� ���&���
�
�T�[�[�0�0��d�i�i���:�:�L��)�)�K�� � �%����3��
�"��	� ��]�T�[�[�8��
���K��	����l�K����d�l�l�S�
 r"c��|j�|jt�t|j|jz|j
|jz��S)a
        The x and y coordinates for the bottom right corner of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.bottomright
        (10, 20)
        >>> r.bottomright = (30, 30)
        >>> r
        Rect(left=20, top=10, width=10, height=20)
        rw)rJ�BOTTOMRIGHTrrMrKrNrLrUs r#r
zRect.bottomrightsA���;�;�"��K�K��$��t�z�z�D�K�K�/�4�9�9�t�|�|�3K�L�Lr"c�"�|jrtd��t|�|\}}||j|jzk7s||j
|jzk7r�|j
}|j}|jr)||jz
|_||jz
|_n:t|�|jz
|_t|�|jz
|_|j|||j|j�yyre)
rGrr2rNrLrMrKrFr'r^)rOrarqrurhrms      r#r
zRect.bottomrights����>�>�!�"<�=�=�#�E�*�#���)�����T�\�\�1�1���
�
�T�[�[�0�0��:�:�L��)�)�K�� � �%����3��
�%����4��	� ��]�T�[�[�8��
��	�N�T�\�\�9��	����l�K����d�l�l�S�
1r"c� �|j�|jt�|jr1t|j|j
dzz|j��St|j|j
dzz|j��S)a
        The x and y coordinates for the midpoint of the top edge of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.midtop
        (5, 0)
        >>> r.midtop = (40, 50)
        >>> r
        Rect(left=35, top=50, width=10, height=20)
        �@rwr4)rJ�MIDTOPrFrrMrKrNrUs r#rzRect.midtop4si���;�;�"��K�K�������4�:�:����s�):�;�t�y�y�I�I��4�:�:�����)9�:�d�i�i�H�Hr"c��|jrtd��t|�|\}}|j}|j}|j
rv||j|jdzzk7s||jk7rG||jdzz
|_||_|j|||j|j�yy||j|jdzzk7s||jk7rYt|�|jdzz
|_t|�|_|j|||j|j�yy�Nrfr�r4)
rGrr2rMrNrFrKr^rLr')rOra�	newMidToprlrhrms      r#rzRect.midtopGs���>�>�!�"<�=�=�#�E�*�!��	�6��z�z���i�i������T�Z�Z�$�+�+��*;�;�;��$�)�)�#�&�$�+�+��*;�<��
�"��	��!�!�,��T�[�[�$�,�,�W�	$��T�Z�Z�$�+�+��*:�:�:��$�)�)�#� ��^�t�{�{�a�/?�@��
���K��	��!�!�,��T�[�[�$�,�,�W�	$r"c�T�|j�|jt�|jr>t|j|j
dzz|j|jz��St|j|j
dzz|j|jz��S)a
        The x and y coordinates for the midpoint of the bottom edge of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.midbottom
        (5, 20)
        >>> r.midbottom = (40, 50)
        >>> r
        Rect(left=35, top=30, width=10, height=20)
        r�rwr4)rJ�	MIDBOTTOMrFrrMrKrNrLrUs r#rzRect.midbottom`s{���;�;�"��K�K�	�"�����4�:�:����s�):�;�t�y�y�4�<�<�?W�X�X��4�:�:�����)9�:�d�i�i�$�,�,�>V�W�Wr"c��|jrtd��t|�|\}}|j}|j}|j
r�||j|jdzzk7s||j|jzk7rT||jdzz
|_||jz
|_|j|||j|j�yy||j|jdzzk7s||j|jzk7rft|�|jdzz
|_t|�|jz
|_|j|||j|j�yyr��
rGrr2rMrNrFrKrLr^r')rOra�newMidBottomrurhrms      r#rzRect.midbottomss7���>�>�!�"<�=�=�#�E�*�"'���i��z�z���i�i�������
�
�T�[�[�3�->� >�>��T�Y�Y����5�5�)�T�[�[�3�->�?��
�%����4��	��!�!�,��T�[�[�$�,�,�W�	6���
�
�T�[�[�A�-=� =�=��T�Y�Y����5�5� ��.�$�+�+��2B�C��
��	�N�T�\�\�9��	��!�!�,��T�[�[�$�,�,�W�	6r"c� �|j�|jt�|jr1t|j|j
|jdzz��St|j|j
|jdzz��S)a
        The x and y coordinates for the midpoint of the left edge of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.midleft
        (0, 10)
        >>> r.midleft = (40, 50)
        >>> r
        Rect(left=40, top=40, width=10, height=20)
        r�rwr4)rJ�MIDLEFTrFrrMrNrLrUs r#r
zRect.midleft�si���;�;�"��K�K�� �����4�:�:����d�l�l�S�6H�)I�J�J��4�:�:����d�l�l�a�6G�)H�I�Ir"c��|jrtd��t|�|\}}|j}|j}|j
rv||jk7s||j|jdzzk7rG||_||jdzz
|_|j|||j|j�yy||jk7s||j|jdzzk7rYt|�|_t|�|jdzz
|_|j|||j|j�yyr�)
rGrr2rMrNrFrLr^rKr')rOrarg�
newMidLeftrhrms      r#r
zRect.midleft�s���>�>�!�"<�=�=�#�E�*�#�����z�z���i�i������4�:�:�%��d�i�i�4�<�<�#�+=�>�>�$��
�&�$�,�,��*<�=��	��!�!�,��T�[�[�$�,�,�W�	?��4�:�:�%��d�i�i�4�<�<�1�+<�=�=� ��\��
��
�O�t�|�|�q�/@�A��	��!�!�,��T�[�[�$�,�,�W�	>r"c�T�|j�|jt�|jr>t|j|j
z|j|jdzz��St|j|j
z|j|jdzz��S)a
        The x and y coordinates for the midpoint of the right edge of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.midright
        (10, 10)
        >>> r.midright = (40, 50)
        >>> r
        Rect(left=30, top=40, width=10, height=20)
        r�rwr4)rJ�MIDRIGHTrFrrMrKrNrLrUs r#rz
Rect.midright�s}���;�;�"��K�K��!�����4�:�:����3�t�y�y�D�L�L�SV�DV�7W�X�X��4�:�:����3�t�y�y�D�L�L�TU�DU�7V�W�Wr"c��|jrtd��t|�|\}}|j}|j}|j
r�||j|jzk7s||j|jdzzk7rT||jz
|_||jdzz
|_|j|||j|j�yy||j|jzk7s||j|jdzzk7rft|�|jz
|_t|�|jdzz
|_|j|||j|j�yyr�r�)rOrarq�newMidRightrhrms      r#rz
Rect.midright�s7���>�>�!�"<�=�=�#�E�*� %���+��z�z���i�i������D�J�J����4�4��t�y�y�4�<�<�#�+=�=�=�%����3��
�'�4�<�<�#�+=�>��	��!�!�,��T�[�[�$�,�,�W�	>��D�J�J����4�4��t�y�y�4�<�<�1�+<�<�<� ��]�T�[�[�8��
���,�����0A�B��	��!�!�,��T�[�[�$�,�,�W�	=r"c�`�|j�|jt�|jrAt|j|j
dzz|j|jdzz��St|j|j
dzz|j|jdzz��S)a
        The x and y coordinates for the center of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.center
        (5, 10)
        >>> r.center = (40, 50)
        >>> r
        Rect(left=35, top=40, width=10, height=20)
        r�rwr4)rJ�CENTERrFrrMrKrNrLrUs r#rzRect.center�s����;�;�"��K�K��������*�*����c� 1�2�d�i�i�4�<�<�RU�CU�6V��
���*�*����q� 0�1�T�Y�Y�$�,�,�RS�BS�5T��
r"c��|jrtd��t|�|\}}|j}|j}|j
r�||j|jdzzk7s||j|jdzzk7rW||jdzz
|_||jdzz
|_|j|||j|j�yy||j|jdzzk7s||j|jdzzk7rit|�|jdzz
|_t|�|jdzz
|_|j|||j|j�yyr�r�)rOra�
newCenterx�
newCenteryrhrms      r#rzRect.center�sJ���>�>�!�"<�=�=�#�E�*�!&��
�J��z�z���i�i������d�j�j�4�;�;��+<�<�<��d�i�i�$�,�,��*<�<�<�'�4�;�;��+<�=��
�&�$�,�,��*<�=��	��!�!�,��T�[�[�$�,�,�W�	=��d�j�j�4�;�;�!�+;�;�;��d�i�i�$�,�,�!�*;�;�;� ��_����q�0@�A��
��
�O�t�|�|�q�/@�A��	��!�!�,��T�[�[�$�,�,�W�	<r"c���|j�|jt�|jr|j|jdzzS|j|jdzzS)z�
        The x coordinate for the center of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.centerx
        5
        >>> r.centerx = 50
        >>> r
        Rect(left=45, top=0, width=10, height=20)
        r�r4)rJ�CENTERXrFrMrKrUs r#rzRect.centerxsS���;�;�"��K�K�� �����:�:����s�!2�3�3��:�:�����!1�2�2r"c�0�|jrtd��t|�|j}|jrj||j|j
dzzk7rJ||j
dzz
|_|j
||j|j
|j�yy||j|j
dzzk7rSt|�|j
dzz
|_|j
||j|j
|j�yyr�)
rGrr,rMrFrKr^rNrLr')rOr�rhs   r#rzRect.centerx's����>�>�!�"<�=�=��J�'��z�z������d�j�j�4�;�;��+<�<�<�'�4�;�;��+<�=��
��!�!�,��	�	�4�;�;����U�=��d�j�j�4�;�;�!�+;�;�;� ��_����q�0@�A��
��!�!�,��	�	�4�;�;����U�<r"c���|j�|jt�|jr|j|jdzzS|j|jdzzS)z�
        The y coordinate for the center of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.centery
        10
        >>> r.centery = 50
        >>> r
        Rect(left=0, top=40, width=10, height=20)
        r�r4)rJ�CENTERYrFrNrLrUs r#rzRect.centery<sS���;�;�"��K�K�� �����9�9����s� 2�3�3��9�9����� 1�2�2r"c�0�|jrtd��t|�|j}|jrj||j|j
dzzk7rJ||j
dzz
|_|j
|j||j|j
�yy||j|j
dzzk7rSt|�|j
dzz
|_|j
|j||j|j
�yyr�)
rGrr,rNrFrLr^rMrKr')rOr�rms   r#rzRect.centeryOs����>�>�!�"<�=�=��J�'��i�i������d�i�i�$�,�,��*<�<�<�&�$�,�,��*<�=��	��!�!�$�*�*�k�4�;�;����U�=��d�i�i�$�,�,�!�*;�;�;��
�O�t�|�|�q�/@�A��	��!�!�$�*�*�k�4�;�;����U�<r"c��|j�|jt�t|j|j��S)z�
        The width and height of the rectangle, as a tuple.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.size
        (10, 20)
        >>> r.size = (40, 50)
        >>> r
        Rect(left=0, top=0, width=40, height=50)
        )rr)rJ�SIZErrKrLrUs r#rz	Rect.sizeds/���;�;�"��K�K����$�+�+�d�l�l�;�;r"c��|jrtd��t|�|\}}||jk7s||jk7r||j}|j}|j
r||_||_n t
|�|_t
|�|_|j|j|j||�yyre)
rGrr2rKrLrFr'r^rMrN)rOra�newWidth�	newHeight�
originalWidth�originalHeights      r#rz	Rect.sizets����>�>�!�"<�=�=�#�E�*�#���)��t�{�{�"�i�4�<�<�&?� �K�K�M�!�\�\�N�� � �&���(���!�(�m���"�9�~������d�j�j�$�)�)�]�N�S�'@r"c�\�|j�|jt�|jS)z�
        The width of the rectangle. `w` is an alias for `width`.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.width
        10
        >>> r.width = 50
        >>> r
        Rect(left=0, top=0, width=50, height=20)
        )rJ�WIDTHrKrUs r#rz
Rect.width�s$���;�;�"��K�K����{�{�r"c�,�|jrtd��t|�||jk7rc|j}|jr||_nt|�|_|j
|j|j||j�yyre)
rGrr,rKrFr'r^rMrNrL)rOr�r�s   r#rz
Rect.width�sr���>�>�!�"<�=�=��H�%�����#� �K�K�M�� � �&���!�(�m������d�j�j�$�)�)�]�D�L�L�Q�
$r"c�\�|j�|jt�|jS)z�
        The height of the rectangle. `h` is an alias for `height`

        >>> r = Rect(0, 0, 10, 20)
        >>> r.height
        20
        >>> r.height = 50
        >>> r
        Rect(left=0, top=0, width=10, height=50)
        )rJ�HEIGHTrLrUs r#rzRect.height�s$���;�;�"��K�K����|�|�r"c�,�|jrtd��t|�||jk7rc|j}|jr||_nt|�|_|j
|j|j|j|�yyre)
rGrr,rLrFr'r^rMrNrK)rOr�r�s   r#rzRect.height�sr���>�>�!�"<�=�=��I�&�����%�!�\�\�N�� � �(���"�9�~������d�j�j�$�)�)�T�[�[�.�Q�
&r"c�v�|j�|jt�|j|jzS)z�The area of the `Rect`, which is simply the width times the height.
        This is a read-only attribute.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.area
        200
        �rJ�AREArKrLrUs r#rz	Rect.area�s-���;�;�"��K�K����{�{�T�\�\�)�)r"c�|�|j�|jt�|j|jzdzS)z�The perimeter of the `Rect`, which is simply the (width + height) * 2.
        This is a read-only attribute.

        >>> r = Rect(0, 0, 10, 20)
        >>> r.area
        200
        r4r�rUs r#rzRect.perimeter�s2���;�;�"��K�K������d�l�l�*�a�/�/r"c��|j�|jt�t|j|j|j
|j��S)z�A tuple of four integers: (left, top, width, height).

        >>> r = Rect(0, 0, 10, 20)
        >>> r.box
        (0, 0, 10, 20)
        >>> r.box = (5, 15, 100, 200)
        >>> r.box
        (5, 15, 100, 200))rrrr)rJ�BOXrrMrNrKrLrUs r#rzRect.box�s@���;�;�"��K�K����������$�+�+�d�l�l�
�	
r"c�r�|jrtd��t|�|\}}}}||jk7s-||jk7s||j
k7s||jk7r�|j}|j}|j
}|j}	|jrAt|�|_t|�|_t|�|_t|�|_n@t|�|_t|�|_t|�|_t|�|_|j||||	�yyre)rGrr6rMrNrKrLrFr(r'r^)
rOrargrlr�r�rhrmr�r�s
          r#rzRect.box�s����>�>�!�"<�=�=�$�U�+�/4�,����9�
��
�
�
"��$�)�)�#��D�K�K�'��T�\�\�)��:�:�L��)�)�K� �K�K�M�!�\�\�N�� � �"�7�^��
�!�&�M��	�#�H�o���$�Y�/��� ��\��
���K��	�!�(�m���"�9�~������l�K���W�!*r"c�f�|tk(r|jS|tk(r|jS|tk(r|j
S|tk(r|jS|tk(r|jS|tk(r|jS|tk(r|jS|tk(r|jS|t k(r|j"S|t$k(r|j&S|t(k(r|j*S|t,k(r|j.S|t0k(r|j2S|t4k(r|j6S|t8k(r|j:S|t<k(r|j>S|t@k(r|jBS|tDk(r|jFS|tHk(r|jJS|tLk(r|jNStQd|z��)N�"'%s' is not a valid attribute name))rjrrsrrcrrorrzrr�rr}r	r�r
r�rr�rr�r
r�rr�rr�rr�rr�rr�rr�rr�rr�rr)rO�rectAttrNames  r#�getzRect.gets{���3���8�8�O�
�V�
#��;�;��
�T�
!��9�9��
�U�
"��:�:��
�W�
$��<�<��
�X�
%��=�=� �
�Z�
'��?�?�"�
�[�
(��#�#�#�
�V�
#��;�;��
�Y�
&��>�>�!�
�W�
$��<�<��
�X�
%��=�=� �
�V�
#��;�;��
�W�
$��<�<��
�W�
$��<�<��
�U�
"��:�:��
�V�
#��;�;��
�T�
!��9�9��
�T�
!��9�9��
�S�
 ��8�8�O�!�"F�,�"W�X�Xr"c���|tk(r||_y|tk(r||_y|tk(r||_y|tk(r||_y|tk(r||_	y|tk(r||_y|tk(r||_
y|tk(r||_y|t k(r||_y|t$k(r||_y|t(k(r||_y|t,k(r||_y|t0k(r||_y|t4k(r||_y|t8k(r||_y|t<k(r||_y|t@k(r||_!y|tDk(r||_#y|tHk(rtKd��|tLk(r||_'ytKd|z��)Nzarea is a read-only attributer�)(rjrrsrrcrrorrzrr�rr}r	r�r
r�rr�rr�r
r�rr�rr�rr�rr�rr�rr�rr�rr�r)rOr�ras   r#�setzRect.setEsE���3���D�H�
�V�
#��D�K�
�T�
!��D�I�
�U�
"��D�J�
�W�
$� �D�L�
�X�
%�!�D�M�
�Z�
'�#�D�O�
�[�
(�$�D��
�V�
#��D�K�
�Y�
&�"�D�N�
�W�
$� �D�L�
�X�
%�!�D�M�
�V�
#��D�K�
�W�
$� �D�L�
�W�
$� �D�L�
�U�
"��D�J�
�V�
#��D�K�
�T�
!��D�I�
�T�
!�!�"A�B�B�
�S�
 ��D�H�!�"F�,�"W�X�Xr"c�D�|jrtd��t|�t|�|jr+|xj|z
c_|xj
|z
c_y|xjt
|�z
c_|xj
t
|�z
c_y)aMoves this Rect object by the given offsets. The xOffset and yOffset
        arguments can be any integer value, positive or negative.
        >>> r = Rect(0, 0, 100, 100)
        >>> r.move(10, 20)
        >>> r
        Rect(left=10, top=20, width=100, height=100)
        rfN)rGrr,rFrMrNr')rO�xOffset�yOffsets   r#�movez	Rect.moversp���>�>�!�"<�=�=��G�$��G�$�����J�J�'�!�J��I�I�� �I��J�J�#�g�,�&�J��I�I��W��%�Ir"c��t|j|j|j|j|j
|j�S)aReturn a copied `Rect` object with the same position and size as this
        `Rect` object.

        >>> r1 = Rect(0, 0, 100, 150)
        >>> r2 = r1.copy()
        >>> r1 == r2
        True
        >>> r2
        Rect(left=0, top=0, width=100, height=150)
        )rCrMrNrKrLrFrGrUs r#�copyz	Rect.copy�s=����J�J��I�I��K�K��L�L�����N�N�

�	
r"c��|jrtd��|j}|xj|z
c_|xj|z
c_||_y)a.Increases the size of this Rect object by the given offsets. The
        rectangle's center doesn't move. Negative values will shrink the
        rectangle.

        >>> r = Rect(0, 0, 100, 150)
        >>> r.inflate(20, 40)
        >>> r
        Rect(left=-10, top=-20, width=120, height=190)
        rfN)rGrrrr)rO�widthChange�heightChange�originalCenters    r#�inflatezRect.inflate�sC���>�>�!�"<�=�=������
�
�k�!�
����|�#��$��r"c�T�|jrtd��|j|_y)aCenters this Rect object at the center of otherRect.

        >>> r1 =Rect(0, 0, 100, 100)
        >>> r2 = Rect(-20, -90, 50, 50)
        >>> r2.clamp(r1)
        >>> r2
        Rect(left=25, top=25, width=50, height=50)
        >>> r1.center == r2.center
        True
        rfN)rGrr)rO�	otherRects  r#�clampz
Rect.clamp�s$���>�>�!�"<�=�=��&�&��r"c�H�t|j|j�}t|j|j�}t|j|j�}t|j
|j
�}||_||_||z
|_||z
|_y)z�Adjusts the width and height to also cover the area of `otherRect`.

        >>> r1 = Rect(0, 0, 100, 100)
        >>> r2 = Rect(-10, -10, 100, 100)
        >>> r1.union(r2)
        >>> r1
        Rect(left=-10, top=-10, width=110, height=110)
        N)�minrMrN�maxrrrKrL)rOr��	unionLeft�unionTop�
unionRight�unionBottoms      r#�unionz
Rect.union�s|����
�
�I�O�O�4�	��t�y�y�)�.�.�1������Y�_�_�5�
��$�+�+�y�'7�'7�8����
���	� �9�,���"�X�-��r"c��t|�}|j|�t|D�cgc]}|j��c}�}t|D�cgc]}|j��c}�}t|D�cgc]}|j��c}�}t|D�cgc]}|j��c}�}||_||_||z
|_||z
|_	ycc}wcc}wcc}wcc}w)aLAdjusts the width and height to also cover all the `Rect` objects in
        the `otherRects` sequence.

        >>> r = Rect(0, 0, 100, 100)
        >>> r1 = Rect(0, 0, 150, 100)
        >>> r2 = Rect(-10, -10, 100, 100)
        >>> r.unionAll([r1, r2])
        >>> r
        Rect(left=-10, top=-10, width=160, height=110)
        N)
�listr<r�rMrNr�rrrKrL)rO�
otherRects�rr�r�r�r�s       r#�unionAllz
Rect.unionAll�s����*�%�
����$���*�5�*�Q����*�5�6�	��
�3�
�1����
�3�4���:�6�:�a�!�'�'�:�6�7�
��Z�8�Z��1�8�8�Z�8�9����
���	� �9�,���"�X�-����6��3��6��8s�C�	C�,C�Cc�4�|jrtd��|jdkr1|j|_|xj|jzc_|jdkr2|j|_|xj
|jzc_yy)aRect objects with a negative width or height cover a region where the
        right/bottom edge is to the left/above of the left/top edge, respectively.
        The `normalize()` method sets the `width` and `height` to positive if they
        were negative.

        The Rect stays in the same place, though with the `top` and `left`
        attributes representing the true top and left side.

        >>> r = Rect(0, 0, -10, -20)
        >>> r.normalize()
        >>> r
        Rect(left=-10, top=-20, width=10, height=20)
        rfrN)rGrrKrMrLrNrUs r#�	normalizezRect.normalize�sq���>�>�!�"<�=�=��;�;��?��;�;�,�D�K��J�J�$�+�+�%�J��<�<�!�� �L�L�=�D�L��I�I����%�I�r"c���t|t�r>|j|vxr.|j|vxr|j|vxr|j
|vS	t
|�t
|�dk(rtt|�|\}}|j|cxkxr|j|jzkncxr1|j|cxkxr|j|jzkScSt
|�dk(r<t|�|\}}}}||f|vxr"||z|f|vxr|||zf|vxr||z||zf|vStd|jjz��#td|jjz��xYw)N�pin <Rect> requires an (x, y) tuple, a (left, top, width, height) tuple, or a Rect object as left operand, not %sr4�)r&rCrrr	r
�lenrr)rr2rMrKrNrLr6�rOrarxryrrrrs        r#�__contains__zRect.__contains__s����e�T�"��
�
��%�.��N�N�d�*�.��$�$��,�.��%�%��-�	
�	���J��u�:��?�'��.��D�A�q��
�
�Q�9����d�k�k�!9�9�=��I�I��<�D�I�I����$<�<�
�<�
�
��Z�1�_�(��/�',�$�D�#�u�f��s��t�#�9��E�\�3�'�4�/�9��3��<�(�D�0�9��E�\�3��<�0�D�8�	
�"�C��?�?�+�+�-��
��5	�!�C��?�?�+�+�-��
�s�E	�	$E-c���t|t�r>|j|vxs.|j|vxs|j|vxs|j
|vS	t
|�t
|�dk(rtt|�|\}}|j|cxkxr|j|jzkncxr1|j|cxkxr|j|jzkScSt
|�dk(r1|\}}}}||f|vxs"||z|f|vxs|||zf|vxs||z||zf|vStd|jjz��#td|jjz��xYw)a`Returns `True` if value collides with this `Rect` object, where value can
        be an (x, y) tuple, a (left, top, width, height) box tuple, or another `Rect`
        object. If value represents a rectangular area, any part of that area
        can collide with this `Rect` object to make `collide()` return `True`.
        Otherwise, returns `False`.r�r4r�)r&rCrrr	r
r�rr)rr2rMrKrNrLr�s        r#�collidezRect.collideDs����e�T�"��
�
��%�-��>�>�T�)�-��#�#�t�+�-��$�$��,�	
�	���J��u�:��?�'��.��D�A�q��
�
�Q�9����d�k�k�!9�9�=��I�I��<�D�I�I����$<�<�
�<�
�
��Z�1�_�',�$�D�#�u�f��s��t�#�8��5�L�#�&�$�.�8��#��,�'�4�/�8��5�L�#��,�/�4�7�	
�"�C��?�?�+�+�-��
��3	�!�C��?�?�+�+�-��
�s�D>�>$E"c�j�t|t�r|j|jk(Std���Nz9Rect objects can only be compared with other Rect objects�r&rCrr�rO�others  r#�__eq__zRect.__eq__��/���e�T�"��9�9����(�(�!�K��
r"c�j�t|t�r|j|jk7Std��r�r�r�s  r#�__ne__zRect.__ne__�r�r")rrrrFFNN)rr)0rrrrRrVrXr^�propertyrP�setterrrxrryrrrr	rr
rrr
rrrrrr�wr�hrrrr�r�r�r�r�r�r�r�r�r�r�r�r�r!r"r#rCrC�s}���
�������(!�V
�
���
!��
!����-��-�"�
��
�
�[�[�
R��
R�	
�A��
��
�	�Z�Z�R��R�	�A��
(��
(��\�\�
R��
R� �(��(��]�]�
R��
R� �
0��
0�
�^�^�T��T�(�
?��
?����T��T�(�
>��
>��_�_�T��T�(�
M��
M����T��T�(�I��I�$�]�]�X��X�0�X��X�$���X��X�0�J��J�$
�^�^�X��X�0�X��X�$�_�_�X��X�0����,�]�]�X��X�0�3��3�$
�^�^�V��V�(�3��3�$
�^�^�V��V�(�
<��
<�
�[�[�T��T�$�
��
��\�\�
R��
R�	�A��
��
��]�]�
R��
R�	�A��
*��
*��
0��
0��

��

�	�Z�Z�X��X�8+Y�Z+Y�Z&�(
�(%�$'� 
�.�,.�6�
&�2+�Z1�f�*�
��r"rC�__main__))�doctest�collections�__version__rjrsrcrorzr�r}r�r�r�r�r�r�r�r�r�r�r�r�r��	PERIMETER�
namedtuplerrr�	Exceptionrr,r.r2r6r:rA�objectrCr�print�testmodr!r"r#�<module>r�s��������	��
����
����
�
���	����
���	�	��
��
����	��
����
���	��k���U�$;�<������w��.���{���f�n�5��	�i�	�
�
�	
�
�"Q�
� �<�DA�6�A�H(�z��	�/�'�/�/�
��r"

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists