File: //opt/alt/python27/lib/python2.7/site-packages/svgwrite/drawing.pyc
�
#8oRc           @  se   d  Z  d d l m Z d d l Z d d l m Z m Z d d l m Z d e e f d �  �  YZ	 d S(   u�  
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)
i����(   t   unicode_literalsN(   t   SVGt   Defs(   t   ElementFactoryt   Drawingc           B  sP   e  Z d  Z d d d � Z d �  Z d d d � Z d �  Z d	 �  Z d
 �  Z RS(   u�   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.
    u
   noname.svgu   100%c         K  s2   t  t |  � j d | | � | |  _ g  |  _ d S(   u�  
        :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
        t   sizeN(   t   superR   t   __init__t   filenamet   _stylesheets(   t   selfR   R   t   extra(    (    sA   /opt/alt/python27/lib/python2.7/site-packages/svgwrite/drawing.pyR   *   s    	c         C  sf   |  j  } |  j } d |  j d <d |  j d <d |  j d <| |  j d <| |  j d <t t |  � j �  S(	   u�    Get the XML representation as `ElementTree` object.
        :return: XML `ElementTree` of this object and all its subelements
        u   http://www.w3.org/2000/svgu   xmlnsu   http://www.w3.org/1999/xlinku   xmlns:xlinku!   http://www.w3.org/2001/xml-eventsu   xmlns:evu   baseProfileu   version(   t   profilet   versiont   attribsR   R   t   get_xml(   R
   R   R
   (    (    sA   /opt/alt/python27/lib/python2.7/site-packages/svgwrite/drawing.pyR   :   s    		
u   nou   screenc         C  s    |  j  j | | | | f � d S(   u5   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	   t   append(   R
   t   hreft   titlet	   alternatet   media(    (    sA   /opt/alt/python27/lib/python2.7/site-packages/svgwrite/drawing.pyt   add_stylesheetJ   s    	c         C  sO   | j  d � d } x"