'''
Copyright (C) 2010 Aurelio A. Heckert, aurium (a) gmail dot com
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.
'''
# standard library
import os
import sys
import tempfile
# local library
from webslicer_effect import *
import inkex
dest="dir",
help="")
dest="create_dir",
help="")
dest="with_code",
help="")
# The user must supply a directory to export:
return {'error':'You must give a directory to export the slices.'}
# No directory separator at the path end:
# Test if the directory exists:
# Try to create it:
try:
except Exception, e:
return {'error':'Can\'t create the directory to export.'}
else:
return
# Check whether slicer layer exists (bug #1198826)
if slicer_layer is None:
return {'error':'No slicer layer found.'}
else:
return None
# This solution comes from Andrew Reedick <jr9445 at ATT.COM>
# This method replaces the commands.getstatusoutput() usage, with the
# hope to correct the windows exporting bug:
_html_ids = []
_('You have more than one element with "%s" html-id.') %
conf['html-id'] )
n = 2
# Register the basic CSS code:
# Create the temporary SVG with invisible Slicer layer to export image pieces
# Start what we really want!
# Write the HTML and CSS files if asked for:
# Delete the temporary SVG with invisible Slicer layer
#TODO: prevent inkex to return svg code to update Inkscape
f.write(
'<html>\n<head>\n' +\
' <title>Web Layout Testing</title>\n' +\
' @import url("style.css")\n' +\
' </style>\n' +\
'</head>\n<body>\n' +\
' <p style="position:absolute; bottom:10px">\n' +\
' This HTML code is not done to the web. <br/>\n' +\
' The automatic HTML and CSS code are only a helper.' +\
'</p>\n</body>\n</html>' )
f.close()
f.write(
'/*\n' +\
'** This CSS code is not done to the web.\n' +\
'** The automatic HTML and CSS code are only a helper.\n' +\
'*/\n' +\
f.close()
conf = {}
if desc is None:
if not 'html-id' in conf:
return {'html-id':'#body#'}
else:
return conf
if desc is not None:
conf_a = []
for k in conf:
else:
if not 'layout-disposition' in conf:
if not 'layout-position-anchor' in conf:
return conf
bg_repeat = 'no-repeat'
if parent_id == '#body#':
css_selector = 'body'
else:
bg_repeat = 'repeat'
bg_repeat = 'repeat-x'
bg_repeat = 'repeat-y'
else: # conf['layout-disposition'][0:9] == 'bg-el...'
else: # conf['layout-disposition'] == 'img...'
el_geo = { }
if status == 0:
# This method return a dictionary with x, y, w and h keys.
# All values are float, if value_to_css is False, otherwise
# that is a string ended with "px". The x and y values are
# relative to parent position.
if value_to_css:
return geometry
if not self.has_magick:
opts = ''
if 'dimension' in conf:
'inkscape %s -i "%s" -e "%s" "%s"' % (
)
)
opts = ''
opts += ' -type Grayscale'
else:
opts += ' -type Palette'
)
if status != 0:
_html = {}
if 'html-class' in conf:
else:
el_class = ''
#inkex.errormsg( self._html )
code = ''
tag_class = ''
else:
if child_code:
code += child_code
else:
return code
_css = []
pos = i = -1
i += 1
if pos == -1:
pos = i + 1
code = ''
for att in s['atts']:
code += ' /* the next attribute needs a CSS3 enabled browser */\n'
code += '}\n'
return code
# Cancel document serialization to stdout
pass
if __name__ == '__main__':
e = WebSlicer_Export()
e.affect()