From 8349b9475ff8f1bcea6dadffce16b212b2336b6d Mon Sep 17 00:00:00 2001 From: sasilver Date: Fri, 27 Jun 2008 20:43:58 +0000 Subject: [PATCH] Use Python script instead of shell script for .fig import (fixes bug 240889). --- share/extensions/Makefile.am | 2 +- share/extensions/fig2dev-ext.py | 30 ++++++++++++++++++++++++++++++ share/extensions/fig2svg.sh | 10 ---------- share/extensions/fig_input.inx | 4 ++-- 4 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 share/extensions/fig2dev-ext.py delete mode 100755 share/extensions/fig2svg.sh diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index 92a52847c..24289b5bb 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -50,7 +50,7 @@ extensions = \ export_gimp_palette.py \ extractimage.py \ ffgeom.py\ - fig2svg.sh \ + fig2dev-ext.py \ flatten.py \ fractalize.py \ funcplot.py \ diff --git a/share/extensions/fig2dev-ext.py b/share/extensions/fig2dev-ext.py new file mode 100644 index 000000000..0e32a941d --- /dev/null +++ b/share/extensions/fig2dev-ext.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +""" +fig2dev-ext.py +Python script for running fig2dev in Inkscape extensions + +Copyright (C) 2008 Stephen Silver + +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 +""" + +import sys +from run_command import run + +run('fig2dev -L svg "%s" "%%s"' % sys.argv[1].replace("%","%%"), "fig2dev") + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/fig2svg.sh b/share/extensions/fig2svg.sh deleted file mode 100755 index 81c6bc827..000000000 --- a/share/extensions/fig2svg.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -rc=0 -TMPDIR="${TMPDIR-/tmp}" -TEMPFILENAME=`mktemp 2>/dev/null || echo "$TMPDIR/tmp-fig$$.svg"` - -fig2dev -L svg "$1" "${TEMPFILENAME}" > /dev/null 2>&1 || rc=1 - -cat < "${TEMPFILENAME}" || rc=1 -rm -f "${TEMPFILENAME}" -exit $rc diff --git a/share/extensions/fig_input.inx b/share/extensions/fig_input.inx index 5ef749bc6..8f0410221 100644 --- a/share/extensions/fig_input.inx +++ b/share/extensions/fig_input.inx @@ -3,7 +3,7 @@ <_name>XFIG Input org.inkscape.input.fig fig2dev - fig2svg.sh + fig2dev-ext.py .fig image/x-xfig @@ -12,6 +12,6 @@ org.inkscape.output.fig -- 2.30.2