svg_and_media_zip_output.py revision 550cd00e78ac8ff3634ff9cb6cd89fbb7867ab5d
"""
An extention which collects all images to the documents directory and
creates a zip archive containing all images and the document
Copyright (C) 2005 Pim Snel, pim@lingewoud.com
Copyright (C) 2008 Aaron Spike, aaron@ekips.org
this is the first Python script ever created
its based on embedimage.py
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Version 0.5 (Nicolas Dufour, nicoduf@yahoo.fr)
Fix a bug related to special caracters in the path (LP #456248).
TODO
- fix bug: not saving existing .zip after a Collect for Output is run
this bug occurs because after running an effect extention the inkscape:output_extension is reset to svg.inkscape
the file name is still xxx.zip. after saving again the file xxx.zip is written with a plain .svg which
looks like a corrupt zip
- maybe add better extention
- consider switching to lzma in order to allow cross platform compression with no encoding problem...
"""
import inkex
import urlparse
import urllib
import string
import zipfile
import shutil
import sys
import tempfile
import gettext
else:
try:
import msvcrt
except:
pass
#create os temp dir
#fixme replace whatever extention
# create destination zip in same directory as the document
#read tmpdoc and copy all images to temp dir
##copy tmpdoc to tempdir
z.close()
if (href != None):
#TODO: please explain why this clause is necessary
else:
e = SVG_and_Media_ZIP_Output()
e.affect()
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99