%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/svgwrite/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyc

�
���Rc@s�dZddlmZddlZddlmZddlmZmZm	Z	de
fd��YZde
fd	��YZd
efd��YZ
defd
��YZdS(s7
The **BaseElement** is the root for all SVG elements.
i����(tetreeN(t	Parameter(tAutoIDt
to_unicodetPYTHON3tBaseElementcBs�eZdZdZd�Zd�Zd�Zed��Zed��Z	ed��Z
ed��Zd	�Zdd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zddd�Zd�ZRS(s�
    The **BaseElement** is the root for all SVG elements. The SVG attributes
    are stored in **attribs**, and the SVG subelements are stored in
    **elements**.

    tbaseElementcKs�|jdd�}|dk	r-|j|_nt�|_|jdd�}|dk	rf||j_n|jdd�}|dk	r�||j_nt�|_|j|�t	�|_
dS(s�
        :param extra: extra SVG attributes (keyword arguments)

          * add trailing '_' to reserved keywords: ``'class_'``, ``'from_'``
          * replace inner '-' by '_': ``'stroke_width'``


        SVG attribute names will be checked, if **debug** is `True`.

        workaround for removed **attribs** parameter in Version 0.2.2::

            # replace
            element = BaseElement(attribs=adict)

            #by
            element = BaseElement()
            element.update(adict)

        tfactorytdebugtprofileN(tpoptNonet
_parameterRRR	tdicttattribstupdatetlisttelements(tselftextraRRR	((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyt__init__s
cCsLxE|j�D]7\}}|jd�jdd�}|j||�q
WdS(s� Update SVG Attributes from `dict` attribs.

        Rules for keys:

        1. trailing '_' will be removed (``'class_'`` -> ``'class'``)
        2. inner '_' will be replaced by '-' (``'stroke_width'`` -> ``'stroke-width'``)

        t_t-N(titemstrstriptreplacet__setitem__(RRtkeytvalue((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyRHs	cCs_tj|�}tj|j�|_tj|j�|_d|jkr[|j�|d<n|S(Ntid(tcopyRRtnext_id(Rtnewobj((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyRWscCs
|jjS(N(RR(R((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyR_scCs
|jjS(N(RR	(R((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyR	cscCs
|jjS(N(Rt	validator(R((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyR!gscCs
|jj�S(N(Rtget_version(R((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pytversionkscCs
||_dS(N(R(Rt	parameter((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyt
set_parameteroscCs
tj|�S(N(RR(RR((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyRrscCs0d|jkr%|j�|jd<n|jdS(s� Get the object `id` string, if the object does not have an `id`,
        a new `id` will be created.

        :returns: `string`
        R(RR(R((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pytget_iduscCsd|j�S(sn
        Get the `IRI` reference string of the object. (i.e., ``'#id'``).

        :returns: `string`
        s#%s(R&(R((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pytget_iriscCsd|j�S(sv
        Get the `FuncIRI` reference string of the object. (i.e. ``'url(#id)'``).

        :returns: `string`
        surl(%s)(R'(R((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pytget_funciri�scCs|j|S(sz Get SVG attribute by `key`.

        :param string key: SVG attribute name
        :return: SVG attribute value

        (R(RR((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyt__getitem__�scCs6|jr%|jj|j||�n||j|<dS(s� Set SVG attribute by `key` to `value`.

        :param string key: SVG attribute name
        :param object value: SVG attribute value

        N(RR!tcheck_svg_attribute_valuetelementnameR(RRR((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyR�s		cCs9|jr%|jj|j|j�n|jj|�|S(s� Add an SVG element as subelement.

        :param element: append this SVG element
        :returns: the added element

        (RR!tcheck_valid_childrenR+Rtappend(Rtelement((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pytadd�s	cCs.|j�}tj|dd�}|jd�S(s� Get the XML representation as unicode `string`.

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

        tencodingsutf-8(tget_xmlRttostringtdecode(Rtxmltxml_utf8_str((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyR2�scCs�tj|j�}|jr7|jj|j|j�nxT|jj�D]C\}}|dk	rG|j	|�}|r�|j
||�q�qGqGWx$|jD]}|j|j
��q�W|S(s� Get the XML representation as `ElementTree` object.

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

        N(RtElementR+RR!tcheck_all_svg_attribute_valuesRRRtvalue_to_stringtsetRR-R1(RR4t	attributeRR.((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyR1�s	cCsqt|ttf�rg|jr4|jj|d�nt|t�rg|jdkrgt|d�}qgnt|�S(s�
        Converts *value* into a <string> includes a value check, depending
        on :attr:`self.debug` and :attr:`self.profile`.

        tnumberttinyi(	t
isinstancetinttfloatRR!tcheck_svg_typeR	troundR(RR((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyR8�s	cCsT|dk	r(|jjdt|��n|dk	rP|jjdt|��ndS(sK Insert a **title** and/or a **desc** element as first subelement.
        iN(RRtinserttDesctTitle(Rttitletdesc((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pytset_desc�scCs�t|�}t|j�dkr4|jj|�nid}xM|j|jdkr�|d7}|t|j�kr=|jj|�dSq=W|jj||�dS(sN
        :param xmldata: an xml.etree.ElementTree - Element() object.
        iRERFiN(stitlesdesc(tMetadatatlenRR-R+RB(Rtxmldatatmetadatatpos((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pytset_metadata�s
N(t__name__t
__module__t__doc__R+RRRtpropertyRR	R!R#R%RRR&R'R(R)RR/R2R1R8RGRM(((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyRs,	+				
					
		
		
RDcBs eZdZd�Zd�ZRS(REcCs+tj|j�|_t|�|j_dS(N(RR6R+R4Rttext(RRR((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyR�scCs|jS(N(R4(R((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyR1�s(RNROR+RR1(((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyRD�s	RCcBseZdZRS(RF(RNROR+(((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyRCsRHcBseZdZd�ZRS(RKcCs&tjd�|_|jj|�dS(sN
        :param xmldata: an xml.etree.ElementTree - Element() object.
        RKN(RR6R4R-(RRJ((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyRs(RNROR+R(((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyRHs(RPtsvgwrite.etreeRRtsvgwrite.paramsRtsvgwrite.utilsRRRtobjectRRDRCRH(((s>/opt/alt/python27/lib/python2.7/site-packages/svgwrite/base.pyt<module>
s�

Zerion Mini Shell 1.0