AlkantarClanX12

Your IP : 3.145.57.41


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__/drawing.cpython-311.pyc

�

�܋f���X�dZddlZddlmZmZddlmZddlmZGd�dee��Z	dS)a�
The *Drawing* object is the overall container for all SVG
elements. It provides the methods to store the drawing into a file or a
file-like object. If you want to use stylesheets, the reference links
to this stylesheets were also stored (`add_stylesheet`)
in the *Drawing* object.

set/get SVG attributes::

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

The Drawing object also includes a defs section, add elements to the defs
section by::

    drawing.defs.add(element)

�N)�SVG�Defs)�ElementFactory)�
pretty_xmlc�T��eZdZdZd�fd�	Z�fd�Zdd�Zdd�Zdd�Zdd
�Z	d�Z
�xZS)�Drawinga� This is the SVG drawing represented by the top level *svg* element.

    A drawing consists of any number of SVG elements contained within the drawing
    element, stored in the *elements* attribute.

    A drawing can range from an empty drawing (i.e., no content inside of the drawing),
    to a very simple drawing containing a single SVG element such as a *rect*,
    to a complex, deeply nested collection of container elements and graphics elements.
    �
noname.svg��100%rc�h��tt|��jdd|i|��||_g|_dS)a�
        :param string filename: filesystem filename valid for :func:`open`
        :param 2-tuple size: width, height
        :param keywords extra: additional svg-attributes for the *SVG* object

        Important (and not SVG Attributes) **extra** parameters:

        :param string profile: ``'tiny | full'`` - define the SVG baseProfile
        :param bool debug: switch validation on/off

        �sizeN�)�superr�__init__�filename�_stylesheets)�selfrr
�extra�	__class__s    ��a/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/svgwrite/drawing.pyrzDrawing.__init__+sB���	&��g�t���%�9�9�4�9�5�9�9�9� ��
������c����|j}|j}d|jd<d|jd<d|jd<||jd<||jd<tt|�����S)	z� Get the XML representation as `ElementTree` object.

        :return: XML `ElementTree` of this object and all its subelements

        zhttp://www.w3.org/2000/svg�xmlnszhttp://www.w3.org/1999/xlinkzxmlns:xlinkz!http://www.w3.org/2001/xml-eventszxmlns:ev�baseProfile�version)�profiler�attribsrr�get_xml)rrrrs   �rrzDrawing.get_xml;sk����,���,�� <���W��&D���]�#�#F���Z� �&-���]�#�")���Y���W�d�#�#�+�+�-�-�-r�no�screenc�B�|j�||||f��dS)a5 Add a stylesheet reference.

        :param string href: link to stylesheet <URI>
        :param string title: name of stylesheet
        :param string alternate: ``'yes'|'no'``
        :param string media: ``'all | aureal | braille | embossed | handheld | print | projection | screen | tty | tv'``

        N)r�append)r�href�title�	alternate�medias     r�add_stylesheetzDrawing.add_stylesheetKs*��	
�� � �$��y�%�!@�A�A�A�A�ArF�c���|�d��d}|jD]}|�||z���|���}|rt||���}|�|��dS)aK Write XML string to `fileobj`.

        :param fileobj: a file-like object
        :param pretty: True for easy readable output
        :param indent: how much to indent if pretty is enabled, by default 2 spaces

        Python 3.x - set encoding at the open command::

            open('filename', 'w', encoding='utf-8')
        z(<?xml version="1.0" encoding="utf-8" ?>
zR<?xml-stylesheet href="%s" type="text/css" title="%s" alternate="%s" media="%s"?>
)�indentN)�writer�tostringr)r�fileobj�prettyr*�stylesheet_template�
stylesheet�
xml_strings       rr+z
Drawing.writeVs���	�
�
�A�B�B�B�
7���+�	<�	<�J��M�M�-�
�:�;�;�;�;��]�]�_�_�
��	?�#�J�v�>�>�>�J��
�
�j�!�!�!�!�!rc��tj|jdd���}|�|||���|���dS)z� Write the XML string to `self.filename`.

        :param pretty: True for easy readable output
        :param indent: how much to indent if pretty is enabled, by default 2 spaces
        �wzutf-8)�mode�encoding�r.r*N)�io�openrr+�close)rr.r*r-s    r�savezDrawing.saversE���'�$�-�c�G�D�D�D���
�
�7�6�&�
�9�9�9��
�
�����rc�B�||_|�||���dS)a Write the XML string to `filename`.

        :param string filename: filesystem filename valid for :func:`open`
        :param pretty: True for easy readable output
        :param indent: how much to indent if pretty is enabled, by default 2 spaces
        r6N)rr:)rrr.r*s    r�saveaszDrawing.saveas|s'��!��
��	�	���	�/�/�/�/�/rc�*�|���S)z� Show SVG in IPython, Jupyter Notebook, and Jupyter Lab

        :return: unicode XML string of this object and all its subelements

        )r,)rs r�
_repr_svg_zDrawing._repr_svg_�s���}�}���r)r	r
)rr )Fr()�__name__�
__module__�__qualname__�__doc__rrr'r+r:r<r>�
__classcell__)rs@rrr!s���������������� .�.�.�.�.� 	B�	B�	B�	B�"�"�"�"�8����0�0�0�0�������rr)
rBr7�svgwrite.containerrr�svgwrite.elementfactoryr�svgwrite.utilsrrrrr�<module>rGs�����$
�	�	�	�(�(�(�(�(�(�(�(�2�2�2�2�2�2�%�%�%�%�%�%�k�k�k�k�k�c�>�k�k�k�k�kr