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__/mixins.cpython-37.pyc

B

s�]�(�@s�ddlmZddlmZdddd�Zddd	d
�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�Z	Gdd�de�Z
Gdd�de�ZGdd�de�ZdS)�)�strlist)�	is_stringZxMidZxMinZxMax)�center�left�rightZYMidZYMinZYMax)�middle�top�bottomc@s,eZdZdZd
dd�Zdd�Zdd
d�ZdS)�ViewBoxa� The **ViewBox** mixin provides the ability to specify that a
    given set of graphics stretch to fit a particular container element.

    The value of the **viewBox** attribute is a list of four numbers
    **min-x**, **min-y**, **width** and **height**, separated by whitespace
    and/or a comma, which specify a rectangle in **user space** which should
    be mapped to the bounds of the viewport established by the given element,
    taking into account attribute **preserveAspectRatio**.

    rcCst||||g�|d<dS)a~ Specify a rectangle in **user space** (no units allowed) which
        should be mapped to the bounds of the viewport established by the
        given element.

        :param number minx: left border of the viewBox
        :param number miny: top border of the viewBox
        :param number width: width of the viewBox
        :param number height: height of the viewBox

        ZviewBoxN)r)�selfZminxZminy�widthZheight�r
�
/mixins.py�viewboxszViewBox.viewboxcCsd|d<dS)zh Stretch viewBox in x and y direction to fill viewport, does not
        preserve aspect ratio.
        Znone�preserveAspectRatioNr
)rr
r
r�stretch&szViewBox.stretchrr�meetcCs8|jr|dkrtd|��dt|t||f|d<dS)a Set the **preserveAspectRatio** attribute.

        :param string horiz: horizontal alignment ``'left | center | right'``
        :param string vert: vertical alignment ``'top | middle | bottom'``
        :param string scale: scale method ``'meet | slice'``

        ============= =======================================================
        Scale methods Description
        ============= =======================================================
        ``'meet'``    preserve aspect ration and zoom to limits of viewBox
        ``'slice'``   preserve aspect ration and viewBox touch viewport on
                      all bounds, viewBox will extend beyond the bounds of
                      the viewport
        ============= =======================================================

        )r�slicezInvalid scale parameter '%s'z%s%s %srN)�debug�
ValueError�_horiz�_vert)rZhorizZvert�scaler
r
r�fit,szViewBox.fitN)rrrr)rrr)�__name__�
__module__�__qualname__�__doc__rrrr
r
r
rr
s


r
c@sReZdZdZdZddd�Zddd�Zddd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�	Transforma| The **Transform** mixin operates on the **transform** attribute.
    The value of the **transform** attribute is a `<transform-list>`, which
    is defined as a list of transform definitions, which are applied in the
    order provided. The individual transform definitions are separated by
    whitespace and/or a comma. All coordinates are **user
    space coordinates**.

    Z	transformNcCs|�dt||g��dS)z�
        Specifies a translation by **tx** and **ty**. If **ty** is not provided,
        it is assumed to be zero.

        :param number tx: user coordinate - no units allowed
        :param number ty: user coordinate - no units allowed
        z
translate(%s)N)�_add_transformationr)rZtxZtyr
r
r�	translateKszTransform.translatecCs|�dt||g��dS)ac
        Specifies a rotation by **angle** degrees about a given point.
        If optional parameter **center** are not supplied, the rotate is
        about the origin of the current user coordinate system.

        :param number angle: rotate-angle in degrees
        :param 2-tuple center: rotate-center as user coordinate - no units allowed

        z
rotate(%s)N)rr)r�anglerr
r
r�rotateUs
zTransform.rotatecCs|�dt||g��dS)a
        Specifies a scale operation by **sx** and **sy**. If **sy** is not
        provided, it is assumed to be equal to **sx**.

        :param number sx: scalar factor x-axis, no units allowed
        :param number sy: scalar factor y-axis, no units allowed

        z	scale(%s)N)rr)rZsxZsyr
r
rras	zTransform.scalecCs|�d|�dS)z� Specifies a skew transformation along the x-axis.

        :param number angle: skew-angle in degrees, no units allowed

        z	skewX(%s)N)r)rr!r
r
r�skewXlszTransform.skewXcCs|�d|�dS)z� Specifies a skew transformation along the y-axis.

        :param number angle: skew-angle in degrees, no units allowed

        z	skewY(%s)N)r)rr!r
r
r�skewYtszTransform.skewYc
Cs"|�dt||||||g��dS)Nz
matrix(%s))rr)r�a�b�c�d�e�fr
r
r�matrix|szTransform.matrixcCs*|j�|jd�}d||f��||j<dS)N�z%s %s)�attribs�get�
transformname�strip)rZ
new_transformZ
old_transformr
r
rrszTransform._add_transformation)N)N)N)rrrrr/r r"rr#r$r+rr
r
r
rrAs



rc@s*eZdZdZdd�Zd	dd�Zdd�ZdS)
�XLinkz
 XLink mixin cCs||_|��dS)a

        Create a reference to **element**.

        :param element: if element is a `string` its the **id** name of the
          referenced element, if element is a **BaseElement** class the **id**
          SVG Attribute is used to create the reference.

        N)�href�	update_id)rZelementr
r
r�set_href�s	zXLink.set_hrefNcCsD|dk	r||d<|dk	r ||d<|dk	r0||d<|dk	r@||d<dS)zA Set XLink attributes (for `href` use :meth:`set_href`).
        Nz
xlink:rolez
xlink:arcrolezxlink:titlez
xlink:showr
)r�titleZshowZroleZarcroler
r
r�	set_xlink�szXLink.set_xlinkcCs8t|d�sdSt|j�r |j}n
|j��}||jd<dS)Nr2z
xlink:href)�hasattrrr2Zget_irir-)rZidstrr
r
rr3�s


zXLink.update_id)NNNN)rrrrr4r6r3r
r
r
rr1�s
r1c@s.eZdZdZd	dd�Zd
dd�Zddd�ZdS)�Presentationz8
    Helper methods to set presentation attributes.
    NcCsJ|dk	r&t|�r||d<n|��|d<|dk	r6||d<|dk	rF||d<|S)zS
        Set SVG Properties **fill**, **fill-rule** and **fill-opacity**.

        N�fillz	fill-rulezfill-opacity)r�get_paint_server)r�colorZrule�opacityr
r
rr9�s
zPresentation.fillcCsz|dk	r&t|�r||d<n|��|d<|dk	r6||d<|dk	rF||d<|dk	rV||d<|dk	rf||d<|dk	rv||d<|S)z�
        Set SVG Properties **stroke**, **stroke-width**, **stroke-opacity**,
        **stroke-linecap** and **stroke-miterlimit**.

        N�strokezstroke-widthzstroke-opacityzstroke-linecapzstroke-linejoinzstroke-miterlimit)rr:)rr;rr<ZlinecapZlinejoinZ
miterlimitr
r
rr=�s
zPresentation.strokecCs*|dk	rt|d�|d<|dk	r&||d<|S)at
        Set SVG Properties **stroke-dashoffset** and **stroke-dasharray**.

        Where *dasharray* specify the lengths of alternating dashes and gaps as
        <list> of <int> or <float> values or a <string> of comma and/or white
        space separated <lengths> or <percentages>. (e.g. as <list> dasharray=[1, 0.5]
        or as <string> dasharray='1 0.5')
        N� zstroke-dasharrayzstroke-dashoffset)r)r�	dasharray�offsetr
r
rr?�s
	zPresentation.dasharray)NNN)NNNNNN)NN)rrrrr9r=r?r
r
r
rr8�s


r8c@seZdZdZddd�ZdS)�
MediaGroupz8
    Helper methods to set media group attributes.

    NcCs$|dk	r||d<|dk	r ||d<|S)zV
        Set SVG Properties **viewport-fill** and **viewport-fill-opacity**.

        Nz
viewport-fillzviewport-fill-opacityr
)rr;r<r
r
r�
viewport_fill�s
zMediaGroup.viewport_fill)NN)rrrrrBr
r
r
rrA�srAc@seZdZdZdd�ZdS)�Markersz3
    Helper methods to set marker attributes.

    c	Cs�dd�}t|�r||�|d<ndy>|\}}}|r:||�|d<|rJ||�|d<|rZ||�|d<Wn$ttfk
r�||�|d<YnXdS)a�
        Set markers for line elements (line, polygon, polyline, path) to
        values specified by  `markers`.

        * if `markers` is a 3-tuple:

          * attribute 'marker-start' = markers[0]
          * attribute 'marker-mid' = markers[1]
          * attribute 'marker-end' = markers[2]

        * `markers` is a `string` or a `Marker` class:

          * attribute 'marker' = `FuncIRI` of markers

        cSs t|�rd|Sd|dSdS)Nzurl(%s)zurl(#%s)�id)r)�valuer
r
r�get_funcirisz(Markers.set_markers.<locals>.get_funciriZmarkerzmarker-startz
marker-midz
marker-endN)r�	TypeError�KeyError)rZmarkersrFZstart_markerZ
mid_markerZ
end_markerr
r
r�set_markers�s
zMarkers.set_markersN)rrrrrIr
r
r
rrC�srCc@seZdZddd�ZdS)�Clipping�autocCsd||||f|d<dS)z-
        Set SVG Property **clip**.

        zrect(%s,%s,%s,%s)ZclipNr
)rrrr	rr
r
r�	clip_rect$szClipping.clip_rectN)rKrKrKrK)rrrrLr
r
r
rrJ#srJN)
Zsvgwrite.utilsrrrr�objectr
rr1r8rArCrJr
r
r
r�<module>s3C$=,

Zerion Mini Shell 1.0