File: //usr/share/inkscape/extensions/webslicer_export.pyc
�
��Yc @ s| d Z d d l Z d d l Z d d l Z d d l Td d l Z d e f d � � YZ e d k rx e � Z e j
� n d S( s�
Copyright (C) 2010 Aurelio A. Heckert, aurium (a) gmail dot com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
i����N( t *t WebSlicer_Exportc B s e Z d � Z d Z d � Z d � Z g Z d � Z d � Z d � Z d � Z
d � Z d � Z d
� Z
d Z d � Z d
� Z d � Z d � Z d � Z d � Z i Z d � Z e d � Z d � Z d � Z i Z d � Z d d d � Z g Z d � Z d � Z d � Z! RS( c C s� t j | � | j j d � | j j d d d d d d d d d
�| j j d d d d d d
t d d d d
�| j j d d d d d d
t d d d d
�d S( Ns --tabs --dirt actiont storet typet stringt destt dirt helpt s --create-dirt inkboolt defaultt
create_dirs --with-codet with_code( t WebSlicer_Effectt __init__t OptionParsert
add_optiont False( t self( ( s2 /usr/share/inkscape/extensions/webslicer_export.pyR s
s {http://www.w3.org/2000/svg}c C ss t | j j � r0 t j t d � � i d d 6S| j j d d k s\ | j j d d k rx | j j d d !| j _ n t j j | j j � s,| j j ry t j
| j j � Wq)t k
r} t j t d � | j j � t j t d � | � i d d 6SXq,t j t d
� | j j � d Sn | j � } | d k rbt j t d � � i d d 6S| j | � d S( Ns/ You must give a directory to export the slices.t errori����t /s \i s Can't create "%s".s Error: %ss% Can't create the directory to export.s# The directory "%s" does not exists.s No slicer layer found.( t is_emptyt optionsR t inkext errormsgt _t ost patht existsR t makedirst Exceptiont get_slicer_layert Nonet unique_html_id( R t et slicer_layer( ( s2 /usr/share/inkscape/extensions/webslicer_export.pyt validate_inputs4 s* ,
c C s� t j d k r d | d } n t j | d d � } | j � } | j � } | d k rc d } n | d d k r� | d } n | | f S( Nt win32s { s ; }s 2>&1t ri i����s
( t syst platformR t popent readt closeR! ( R t cmdt pipet textt sts( ( s2 /usr/share/inkscape/extensions/webslicer_export.pyt get_cmd_outputS s
c C s x| j � D]} | j | j d | j d | j d | j d g k r
| j | � } | d | j k r� t j t d � | d � d } x/ | d d t | � | j k r� | d 7} q� W| d c d t | � 7<n | j j | d � | j
| | � | j | � q
q
Wd S(
Nt rectR t circlet gs html-ids1 You have more than one element with "%s" html-id.i t -i ( t getchildrent tagt svgNSt get_el_conft _html_idsR R R t strt appendt save_confR"