ok

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/svgwrite/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/svgwrite/__pycache__/container.cpython-37.pyc

B

s�]�(�@sdZddlmZmZmZmZddlmZddlm	Z	m
Z
mZddlmZm
Z
ddlmZGdd�dee
e�ZGd	d
�d
e�ZGdd�dee	ee
�ZGd
d�dee	e�ZdZGdd�de�ZGdd�dee
ee�ZGdd�dee
e�ZGdd�de�ZGdd�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@seZdZdZdZdS)�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�rr�
/container.pyr
"s
r
c@seZdZdZdZdS)�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**.
    �defsN)rrrrrrrrrr3src@seZdZdZdZdS)�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.
    ZsymbolN)rrrrrrrrrr;srcs&eZdZdZdZd�fdd�	Z�ZS)�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**.

    ZmarkerNcs|tt|�jf|�|dk	r2|d|d<|d|d<|dk	rR|d|d<|d|d<|dk	rb||d<d	|jkrx|��|d	<dS)
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
        NrZrefX�ZrefYZmarkerWidthZmarkerHeight�orient�id)�superr�__init__ZattribsZnext_id)�self�insert�sizer�extra)�	__class__rrrQs
zMarker.__init__)NNN)rrrrrr�
__classcell__rr)r#rrFsrzF@font-face{{ 
    font-family: "{name}"; 
    src: url("{data}"); 
}}
csFeZdZdZdZd�fdd�	Zdd�Zdd	�Zd
d�Zdd
�Z	�Z
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.
    ZsvgNcsntt|�jf|�|dk	r2|d|d<|d|d<|dk	rR|d|d<|d|d<t|d�|_|�|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)�factory)rr%rrr�add)rr r!r")r#rrrwszSVG.__init__cCs|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�contentrrr�embed_stylesheet�szSVG.embed_stylesheetcCs$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�datarrr�
embed_font�szSVG.embed_fontcCsRt|���}t|���}|dkr0td�|���nt|���}|�||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: '{}')rr1r�decode�
ValueError�formatr2r)rr3ZuriZ	font_infoZfont_urlr5rrr�embed_google_web_font�szSVG.embed_google_web_fontcCs"tj|t||�d�}|�|�dS)N)r3r5)�
FONT_TEMPLATEr9rr.)rr3r5Zmimetyper-rrrr2�szSVG._embed_font_data)NN)rrrrrrr.r6r:r2r$rr)r#rr%ls	r%cs2eZdZdZdZd�fdd�	Z�fdd�Z�ZS)	�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.

    ZuseNcs`tt|�jf|�|�|�|dk	r<|d|d<|d|d<|dk	r\|d|d<|d|d<dS)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&rr'r(r))rr<rZset_href)r�hrefr r!r")r#rrr�s
zUse.__init__cs|��tt|���S)N)Z	update_idrr<�get_xml)r)r#rrr>�szUse.get_xml)NN)rrrrrrr>r$rr)r#rr<�sr<cs&eZdZdZdZd�fdd�	Z�ZS)�	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�_blankcs&tt|�jf|�||d<||d<dS)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
        z
xlink:href�targetN)rr?r)rr=rBr")r#rrr�szHyperlink.__init__)rA)rrrrrrr$rr)r#rr?�sr?cs:eZdZdZdZd�fdd�	Z�fdd�Zd	d
�Z�ZS)�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.

    ZscriptN�cs,tt|�jf|�|dk	r"||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.

        Nz
xlink:href)rrCr�_content)rr=r-r")r#rrr�s
zScript.__init__cs(tt|���}|jr$|�t|j��|S)N)rrCr>rE�appendr)rZxml)r#rrr>szScript.get_xmlcCs|j|7_dS)z1 Append content to the existing element-content. N)rE)rr-rrrrFsz
Script.append)NrD)	rrrrrrr>rFr$rr)r#rrC�s

rCcs&eZdZdZdZd�fdd�	Z�ZS)r,z� 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.

    ZstylerDcs&tt|�jfd|i|��d|d<dS)z;
        :param string content: stylesheet content
        r-ztext/css�typeN)rr,r)rr-r")r#rrrszStyle.__init__)rD)rrrrrrr$rr)r#rr,sr,N)rZsvgwrite.utilsrrrrZ
svgwrite.baserZsvgwrite.mixinsrrr	r
rZsvgwrite.etreerr
rrrr;r%r<r?rCr,rrrr�<module>s#@ '

Zerion Mini Shell 1.0