jessyInk_export.py revision 1b1107ddff011fb4b14c466805d0f3b75a1bae3c
# Copyright 2008, 2009 Hannes Hochreiner
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 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, see http://www.gnu.org/licenses/.
# These lines are only needed if you don't put the script directly into
# the installation directory
import sys
# Unix
# OS X
# Windows
import subprocess
import tempfile
import os
import zipfile
import glob
import re
def propStrToDict(inStr):
dictio = {}
return dictio
def dictToPropStr(dictio):
str = ""
return str[1:]
props = {}
inkscapeCommand = None
zipFile = None
self.OptionParser.add_option('--type', action = 'store', type = 'string', dest = 'type', default = '')
self.OptionParser.add_option('--resolution', action = 'store', type = 'string', dest = 'resolution', default = '')
# Register jessyink namespace.
# Set inkscape command.
if (self.inkscapeCommand == None):
pass
# Remove any temporary files that might be left from last time.
# Check whether the JessyInk-script is present (indicating that the presentation has not been properly exported).
sys.stderr.write("The JessyInk-script is present in this SVG file. This indicates that the presentation has not been properly exported. Please visit code.goolge.com/p/jessyink to find information on how to export a JessyInk presentation.\n\n")
# Find layers.
for node in exportNodes:
for node in exportNodes:
# Write temporary zip file to stdout.
# Switch stdout to binary on Windows.
# Output the file.
# Delete temporary files.
# Function to export the current state of the file using Inkscape.
# Write the svg file.
# Prepare output file.
proc = subprocess.Popen([self.inkscapeCommand + " --file=" + svgFile + " --without-gui --export-dpi=" + str(self.options.resolution) + " --export-" + ext + "=" + outFile], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Function to remove any temporary files created during the export.
try:
except:
pass
# Function to try and find the correct command to invoke Inkscape.
def findInkscapeCommand(self):
commands = []
proc = subprocess.Popen([command + " --without-gui --version"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return command
return None
e = MyEffect()
e.affect()