AlkantarClanX12

Your IP : 18.218.73.233


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/svgwrite/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/svgwrite/__pycache__/container.cpython-311.pyc

�

�܋f�)��~�dZddlmZddlmZmZmZddlmZddl	m
Z
mZmZddl	m
Z
mZddlmZGd�d	eee
��ZGd
�de��ZGd�d
ee
e
e��ZGd�dee
e
��ZdZGd�de��ZGd�deeee
��ZGd�deee
��ZGd�de��ZGd�de��ZdS)a�
The **container** module provides following structural objects:

* :class:`svgwrite.Group`
* :class:`svgwrite.SVG`
* :class:`svgwrite.Defs`
* :class:`svgwrite.Symbol`
* :class:`svgwrite.Marker`
* :class:`svgwrite.Use`
* :class:`svgwrite.Hyperlink`
* :class:`svgwrite.Script`
* :class:`svgwrite.Style`

set/get SVG attributes::

    element['attribute'] = value
    value = element['attribute']

�)�urlopen)�
font_mimetype�base64_data�find_first_url)�BaseElement)�ViewBox�	Transform�XLink)�Presentation�Clipping)�CDATAc��eZdZdZdZdS)�Groupa\ The **Group** (SVG **g**) element is a container element for grouping
    together related graphics elements.

    Grouping constructs, when used in conjunction with the **desc** and **title**
    elements, provide information about document structure and semantics.
    Documents that are rich in structure may be rendered graphically, as speech,
    or as braille, and thus promote accessibility.

    A group of elements, as well as individual objects, can be given a name using
    the **id** attribute. Named groups are needed for several purposes such as
    animation and re-usable objects.

    �gN��__name__�
__module__�__qualname__�__doc__�elementname���c/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/svgwrite/container.pyrr"s���������K�K�Krrc��eZdZdZdZdS)�Defsz� The **defs** element is a container element for referenced elements. For
    understandability and accessibility reasons, it is recommended that, whenever
    possible, referenced elements be defined inside of a **defs**.
    �defsNrrrrrr3s���������K�K�Krrc��eZdZdZdZdS)�Symbola� The **symbol** element is used to define graphical template objects which
    can be instantiated by a **use** element. The use of **symbol** elements for
    graphics that are used multiple times in the same document adds structure and
    semantics. Documents that are rich in structure may be rendered graphically,
    as speech, or as braille, and thus promote accessibility.
    �symbolNrrrrrr;s���������K�K�Krrc�(��eZdZdZdZd�fd�	Z�xZS)�Markera) The **marker** element defines the graphics that is to be used for
    drawing arrowheads or polymarkers on a given **path**, **line**, **polyline**
    or **polygon** element.

    Add Marker definitions to a **defs** section, preferred to the **defs** section
    of the **main drawing**.

    �markerNc���tt|��jd
i|��|�|d|d<|d|d<|�|d|d<|d|d<|�||d<d	|jvr|���|d	<dSdS)z�
        :param 2-tuple insert: reference point (**refX**, **refY**)
        :param 2-tuple size: (**markerWidth**, **markerHeight**)
        :param orient: ``'auto'`` | `angle`
        :param extra: additional SVG attributes as keyword-arguments
        Nr�refX��refY�markerWidth�markerHeight�orient�idr)�superr!�__init__�attribs�next_id)�self�insert�sizer)�extra�	__class__s     �rr,zMarker.__init__Qs����	%��f�d���$�-�-�u�-�-�-���!�!�9�D��L�!�!�9�D��L���"&�q�'�D���#'��7�D�� ���#�D��N��t�|�#�#������D��J�J�J�$�#r)NNN�rrrrrr,�
__classcell__�r3s@rr!r!FsN����������K�(�(�(�(�(�(�(�(�(�(rr!zF@font-face{{ 
    font-family: "{name}"; 
    src: url("{data}"); 
}}
c�@��eZdZdZdZd	�fd�	Zd�Zd�Zd�Zd�Z	�xZ
S)
�SVGa� A SVG document fragment consists of any number of SVG elements contained
    within an **svg** element.

    An SVG document fragment can range from an empty fragment (i.e., no content
    inside of the **svg** element), to a very simple SVG document fragment containing
    a single SVG graphics element such as a **rect**, to a complex, deeply nested
    collection of container elements and graphics elements.
    �svgNc���tt|��jd	i|��|�|d|d<|d|d<|�|d|d<|d|d<t|���|_|�|j��dS)
z�
        :param 2-tuple insert: insert position (**x**, **y**)
        :param 2-tuple size: (**width**, **height**)
        :param extra: additional SVG attributes as keyword-arguments
        Nr�xr%�y�width�height)�factoryr)r+r8r,rr�add)r/r0r1r2r3s    �rr,zSVG.__init__ws����	"��c�4���!�*�*�E�*�*�*����q�	�D��I��q�	�D��I��� ��G�D��M�!�!�W�D��N���&�&�&��	����������rc�P�|j�t|����S)z� Add <style> tag to the defs section.

        :param content: style sheet content as string
        :return: :class:`~svgwrite.container.Style` object
        )rr@�Style�r/�contents  r�embed_stylesheetzSVG.embed_stylesheet�s���y�}�}�U�7�^�^�,�,�,rc��t|d�����}|�||t|����dS)z� Embed font as base64 encoded data from font file.

        :param name: font name
        :param filename: file name of local stored font
        �rbN)�open�read�_embed_font_datar)r/�name�filename�datas    r�
embed_fontzSVG.embed_font�sE���H�d�#�#�(�(�*�*�����d�D�-��*A�*A�B�B�B�B�Brc�\�t|�����}t|�����}|�"t	d�|�����t|�����}|�||t|����dS)z� Embed font as base64 encoded data acquired from google fonts.

        :param name: font name
        :param uri: google fonts request uri like 'http://fonts.googleapis.com/css?family=Indie+Flower'
        NzGot no font data from uri: '{}')rrIr�decode�
ValueError�formatrJr)r/rK�uri�	font_info�font_urlrMs      r�embed_google_web_fontzSVG.embed_google_web_font�s����C�L�L�%�%�'�'�	�!�)�"2�"2�"4�"4�5�5�����>�E�E�c�J�J�K�K�K��8�$�$�)�)�+�+�D��!�!�$��m�H�.E�.E�F�F�F�F�Frc��t�|t||�����}|�|��dS)N)rKrM)�
FONT_TEMPLATErRrrE)r/rKrM�mimetyperDs     rrJzSVG._embed_font_data�s>���&�&�D�{�4��7R�7R�&�S�S�����g�&�&�&�&�&r�NN)rrrrrr,rErNrVrJr5r6s@rr8r8ls�����������K�������"-�-�-�C�C�C�G�G�G�'�'�'�'�'�'�'rr8c�2��eZdZdZdZd�fd�	Z�fd�Z�xZS)�Usea] The **use** element references another element and indicates that the graphical
    contents of that element is included/drawn at that given point in the document.

    Link to objects by href = ``'#object-id'`` or use the object itself as
    href-argument, if the given element has no **id** attribute it gets an
    automatic generated id.

    �useNc����tt|��jdi|��|�|��|�|d|d<|d|d<|�|d|d<|d|d<dSdS)	a
        :param string href: object link (id-string) or an object with an id-attribute
        :param 2-tuple insert: insert point (**x**, **y**)
        :param 2-tuple size: (**width**, **height**)
        :param extra: additional SVG attributes as keyword-arguments
        Nrr;r%r<r=r>r)r+r\r,�set_href)r/�hrefr0r1r2r3s     �rr,zUse.__init__�s����	"��c�4���!�*�*�E�*�*�*��
�
�d�������q�	�D��I��q�	�D��I��� ��G�D��M�!�!�W�D��N�N�N��rc�z��|���tt|�����S�N)�	update_idr+r\�get_xml)r/r3s �rrdzUse.get_xml�s/����������S�$���'�'�)�)�)rrZ)rrrrrr,rdr5r6s@rr\r\�sg����������K�%�%�%�%�%�%� *�*�*�*�*�*�*�*�*rr\c�(��eZdZdZdZd�fd�	Z�xZS)�	Hyperlinka� The **a** element indicate links (also known as Hyperlinks or Web links).

    The remote resource (the destination for the link) is defined by a `<URI>`
    specified by the XLink **xlink:href** attribute. The remote resource may be
    any Web resource (e.g., an image, a video clip, a sound bite, a program,
    another SVG document, an HTML document, an element within the current
    document, an element within a different document, etc.). By activating
    these links (by clicking with the mouse, through keyboard input, voice
    commands, etc.), users may visit these resources.

    A **Hyperlink** is defined for each separate rendered element
    contained within the **Hyperlink** class; add sublements as usual with
    the `add` method.

    �a�_blankc�d��tt|��jdi|��||d<|�||d<dSdS)z�
        :param string href: hyperlink to the target resource
        :param string target: ``'_blank|_replace|_self|_parent|_top|<XML-name>'``
        :param extra: additional SVG attributes as keyword-arguments
        �
xlink:hrefN�targetr)r+rfr,)r/r`rkr2r3s    �rr,zHyperlink.__init__�sM���	(��i����'�0�0�%�0�0�0�!��\����#�D��N�N�N��r)rhr4r6s@rrfrf�sN����������K�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$rrfc�8��eZdZdZdZd�fd�	Z�fd�Zd�Z�xZS)	�Scripta� The **script** element indicate links to a client-side language.  This
    is normally a  (also known as Hyperlinks or Web links).

    The remote resource (the source of the script) is defined by a `<URI>`
    specified by the XLink **xlink:href** attribute. The remote resource must
    be a text-file that contains the script contents.  This script can be used
    within the SVG file by catching events or adding the mouseover/mousedown/
    mouseup elements to the markup.

    �scriptN�c�d��tt|��jdi|��|�||d<||_dS)a
        :param string href: hyperlink to the target resource or *None* if using *content*
        :param string content: script content
        :param extra: additional attributes as keyword-arguments

        Use *href* **or** *content*, but not both at the same time.

        Nrjr)r+rmr,�_content)r/r`rDr2r3s    �rr,zScript.__init__�sC���	%��f�d���$�-�-�u�-�-�-���!%�D�����
�
�
rc���tt|�����}|jr'|�t|j����|Srb)r+rmrdrq�appendr
)r/�xmlr3s  �rrdzScript.get_xmlsI����F�D�!�!�)�)�+�+���=�	-��J�J�u�T�]�+�+�,�,�,��
rc�&�|xj|z
c_dS)z1 Append content to the existing element-content. N)rqrCs  rrsz
Script.appends���
�
�� �
�
�
�
r)Nro)	rrrrrr,rdrsr5r6s@rrmrm�sv�������	�	��K�
 �
 �
 �
 �
 �
 ������!�!�!�!�!�!�!rrmc�(��eZdZdZdZd�fd�	Z�xZS)rBz� The *style* element allows style sheets to be embedded directly within
    SVG content. SVG's *style* element has the same attributes as the
    corresponding element in HTML.

    �styleroc�V��tt|��jdd|i|��d|d<dS)z;
        :param string content: stylesheet content
        rDztext/css�typeNr)r+rBr,)r/rDr2r3s   �rr,zStyle.__init__s:���	$��e�T���#�=�=�G�=�u�=�=�=�!��V���r)ror4r6s@rrBrBsN���������
�K�"�"�"�"�"�"�"�"�"�"rrBN)r�urllib.requestr�svgwrite.utilsrrr�
svgwrite.baser�svgwrite.mixinsrr	r
rr�svgwrite.etreer
rrrr!rXr8r\rfrmrBrrr�<module>rsA����&#�"�"�"�"�"�E�E�E�E�E�E�E�E�E�E�%�%�%�%�%�%�5�5�5�5�5�5�5�5�5�5�2�2�2�2�2�2�2�2� � � � � � ������K��L����"�����5���������[�'�<�����(�(�(�(�(�[�'�<�(�(�(�>�
�='�='�='�='�='�&�='�='�='�@*�*�*�*�*�+�y�%��*�*�*�@$�$�$�$�$��Y��$�$�$�<$!�$!�$!�$!�$!�[�$!�$!�$!�N
"�
"�
"�
"�
"�F�
"�
"�
"�
"�
"r