From: pjrm Date: Fri, 23 May 2008 06:31:40 +0000 (+0000) Subject: noop: Add vim modeline for all share/extensions/*.py files that use four-space indent... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=77d65c763568495a6ffc7c15a81964448139f47a;p=inkscape.git noop: Add vim modeline for all share/extensions/*.py files that use four-space indentation. --- diff --git a/share/extensions/addnodes.py b/share/extensions/addnodes.py index b12f440d7..a1c544a1e 100644 --- a/share/extensions/addnodes.py +++ b/share/extensions/addnodes.py @@ -110,3 +110,6 @@ class SplitIt(inkex.Effect): e = SplitIt() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/bezmisc.py b/share/extensions/bezmisc.py index 7faf69184..f5c290708 100755 --- a/share/extensions/bezmisc.py +++ b/share/extensions/bezmisc.py @@ -248,3 +248,6 @@ if __name__ == '__main__': ''' for curve in curves: print beziertatlength(curve,0.5) + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/color_randomize.py b/share/extensions/color_randomize.py index 9bad74893..cfe82a8e3 100644 --- a/share/extensions/color_randomize.py +++ b/share/extensions/color_randomize.py @@ -28,4 +28,7 @@ class C(coloreffect.ColorEffect): return '%02x%02x%02x' % (rgb[0]*255, rgb[1]*255, rgb[2]*255) c = C() -c.affect() \ No newline at end of file +c.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/cspsubdiv.py b/share/extensions/cspsubdiv.py index 427e7a494..20817d8cf 100644 --- a/share/extensions/cspsubdiv.py +++ b/share/extensions/cspsubdiv.py @@ -35,4 +35,7 @@ def subdiv(sp,flat,i=1): sp[i][0] = two[2] p = [one[2],one[3],two[1]] sp[i:1] = [p] - subdiv(sp,flat,i) \ No newline at end of file + subdiv(sp,flat,i) + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/cubicsuperpath.py b/share/extensions/cubicsuperpath.py index 2e7ae5088..21c6174e1 100755 --- a/share/extensions/cubicsuperpath.py +++ b/share/extensions/cubicsuperpath.py @@ -164,5 +164,4 @@ def formatPath(p): return simplepath.formatPath(unCubicSuperPath(p)) - - +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/dots.py b/share/extensions/dots.py index 7350cae8d..2210bf30e 100755 --- a/share/extensions/dots.py +++ b/share/extensions/dots.py @@ -70,3 +70,6 @@ class Dots(inkex.Effect): e = Dots() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py index ab093a140..b05aea546 100755 --- a/share/extensions/dxf_outlines.py +++ b/share/extensions/dxf_outlines.py @@ -73,3 +73,6 @@ class MyEffect(inkex.Effect): e = MyEffect() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/edge3d.py b/share/extensions/edge3d.py index 1984e5ff5..e37747195 100644 --- a/share/extensions/edge3d.py +++ b/share/extensions/edge3d.py @@ -143,3 +143,6 @@ class Edge3d(inkex.Effect): e = Edge3d() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/embedimage.py b/share/extensions/embedimage.py index 263cf5925..01cefacb0 100644 --- a/share/extensions/embedimage.py +++ b/share/extensions/embedimage.py @@ -104,3 +104,6 @@ class Embedder(inkex.Effect): if __name__ == '__main__': e = Embedder() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/eqtexsvg.py b/share/extensions/eqtexsvg.py index 7cbe8ebfd..92e51c44f 100644 --- a/share/extensions/eqtexsvg.py +++ b/share/extensions/eqtexsvg.py @@ -136,3 +136,6 @@ class EQTEXSVG(inkex.Effect): e = EQTEXSVG() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/export_gimp_palette.py b/share/extensions/export_gimp_palette.py index 3a9d227cf..31dad4552 100644 --- a/share/extensions/export_gimp_palette.py +++ b/share/extensions/export_gimp_palette.py @@ -44,4 +44,7 @@ walk(dom) print 'GIMP Palette\nName: %s\n#' % (dom.getElementsByTagName('svg')[0].getAttribute(DOCNAME).split('.')[0]) for k,v in sorted(colors.items()): - print k+v \ No newline at end of file + print k+v + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/extractimage.py b/share/extensions/extractimage.py index 188cb5d60..c85456c88 100644 --- a/share/extensions/extractimage.py +++ b/share/extensions/extractimage.py @@ -66,3 +66,6 @@ class MyEffect(inkex.Effect): e = MyEffect() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/ffgeom.py b/share/extensions/ffgeom.py index 24d80a175..198358672 100644 --- a/share/extensions/ffgeom.py +++ b/share/extensions/ffgeom.py @@ -136,3 +136,6 @@ def intersectSegments(s1, s2): def dot(s1, s2): return s1.delta_x() * s2.delta_x() + s1.delta_y() * s2.delta_y() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/flatten.py b/share/extensions/flatten.py index 2e1a491cd..fe1440863 100755 --- a/share/extensions/flatten.py +++ b/share/extensions/flatten.py @@ -43,4 +43,7 @@ class MyEffect(inkex.Effect): node.set('d',simplepath.formatPath(np)) e = MyEffect() -e.affect() \ No newline at end of file +e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/fractalize.py b/share/extensions/fractalize.py index 3e6f5df05..91a827f90 100755 --- a/share/extensions/fractalize.py +++ b/share/extensions/fractalize.py @@ -92,3 +92,5 @@ class PathFractalize(inkex.Effect): e = PathFractalize() e.affect() + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/funcplot.py b/share/extensions/funcplot.py index 6abdd9c40..08631a0be 100644 --- a/share/extensions/funcplot.py +++ b/share/extensions/funcplot.py @@ -271,3 +271,6 @@ class FuncPlot(inkex.Effect): e = FuncPlot() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/gears.py b/share/extensions/gears.py index 6683d12e9..202b29d8e 100644 --- a/share/extensions/gears.py +++ b/share/extensions/gears.py @@ -161,3 +161,5 @@ class Gears(inkex.Effect): e = Gears() e.affect() + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/grid_cartesian.py b/share/extensions/grid_cartesian.py index 968212e08..f531f3ac7 100644 --- a/share/extensions/grid_cartesian.py +++ b/share/extensions/grid_cartesian.py @@ -260,3 +260,4 @@ e = Grid_Polar() e.affect() +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/grid_polar.py b/share/extensions/grid_polar.py index 1d60b4bd3..1c2a6d971 100644 --- a/share/extensions/grid_polar.py +++ b/share/extensions/grid_polar.py @@ -194,3 +194,4 @@ e = Grid_Polar() e.affect() +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/handles.py b/share/extensions/handles.py index 83d7f1969..4a75e8e2f 100755 --- a/share/extensions/handles.py +++ b/share/extensions/handles.py @@ -52,3 +52,6 @@ class Handles(inkex.Effect): e = Handles() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py index 379cfa070..5aa8912a9 100755 --- a/share/extensions/inkex.py +++ b/share/extensions/inkex.py @@ -169,3 +169,5 @@ class Effect: retval = None return retval + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/interp.py b/share/extensions/interp.py index 1b28f1bff..2d840c87e 100755 --- a/share/extensions/interp.py +++ b/share/extensions/interp.py @@ -310,3 +310,6 @@ class Interp(inkex.Effect): e = Interp() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/launch_webbrowser.py b/share/extensions/launch_webbrowser.py index d27d6d1f4..0deea3c8f 100644 --- a/share/extensions/launch_webbrowser.py +++ b/share/extensions/launch_webbrowser.py @@ -1,18 +1,21 @@ -#!/usr/bin/env python -import webbrowser, threading -from optparse import OptionParser - -class VisitWebSiteWithoutLockingInkscape(threading.Thread): - def __init__(self): - threading.Thread.__init__ (self) - parser = OptionParser() - parser.add_option("-u", "--url", action="store", type="string", - default="http://www.inkscape.org/", - dest="url", help="The URL to open in web browser") - (self.options, args) = parser.parse_args() - - def run(self): - webbrowser.open(self.options.url) - -vwswli = VisitWebSiteWithoutLockingInkscape() -vwswli.start() \ No newline at end of file +#!/usr/bin/env python +import webbrowser, threading +from optparse import OptionParser + +class VisitWebSiteWithoutLockingInkscape(threading.Thread): + def __init__(self): + threading.Thread.__init__ (self) + parser = OptionParser() + parser.add_option("-u", "--url", action="store", type="string", + default="http://www.inkscape.org/", + dest="url", help="The URL to open in web browser") + (self.options, args) = parser.parse_args() + + def run(self): + webbrowser.open(self.options.url) + +vwswli = VisitWebSiteWithoutLockingInkscape() +vwswli.start() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/lindenmayer.py b/share/extensions/lindenmayer.py index e43e167b6..f8da0990a 100755 --- a/share/extensions/lindenmayer.py +++ b/share/extensions/lindenmayer.py @@ -111,3 +111,5 @@ class LSystem(inkex.Effect): e = LSystem() e.affect() + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/markers_strokepaint.py b/share/extensions/markers_strokepaint.py index 350c87f28..4d718a5b9 100644 --- a/share/extensions/markers_strokepaint.py +++ b/share/extensions/markers_strokepaint.py @@ -73,3 +73,6 @@ class MyEffect(inkex.Effect): e = MyEffect() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/measure.py b/share/extensions/measure.py index 483a4a66a..0db00105a 100644 --- a/share/extensions/measure.py +++ b/share/extensions/measure.py @@ -169,3 +169,6 @@ class Length(inkex.Effect): e = Length() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/motion.py b/share/extensions/motion.py index f9533cd50..88e545c8b 100755 --- a/share/extensions/motion.py +++ b/share/extensions/motion.py @@ -107,3 +107,6 @@ class Motion(inkex.Effect): e = Motion() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/pathalongpath.py b/share/extensions/pathalongpath.py index 5bac2550b..f02a69d50 100644 --- a/share/extensions/pathalongpath.py +++ b/share/extensions/pathalongpath.py @@ -276,3 +276,4 @@ e = PathAlongPath() e.affect() +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/pathmodifier.py b/share/extensions/pathmodifier.py index bfc72f074..645b7fb6c 100644 --- a/share/extensions/pathmodifier.py +++ b/share/extensions/pathmodifier.py @@ -305,3 +305,4 @@ class Diffeo(PathModifier): #e.affect() +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/pathscatter.py b/share/extensions/pathscatter.py index 4e41eff65..0ce095877 100644 --- a/share/extensions/pathscatter.py +++ b/share/extensions/pathscatter.py @@ -259,3 +259,4 @@ e = PathScatter() e.affect() +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/perfectboundcover.py b/share/extensions/perfectboundcover.py index 6295f6468..0e0231a50 100644 --- a/share/extensions/perfectboundcover.py +++ b/share/extensions/perfectboundcover.py @@ -165,3 +165,6 @@ class PerfectBoundCover(inkex.Effect): ''' e = PerfectBoundCover() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/perspective.py b/share/extensions/perspective.py index 6b409377a..26a23dc0a 100755 --- a/share/extensions/perspective.py +++ b/share/extensions/perspective.py @@ -125,3 +125,6 @@ class Project(inkex.Effect): e = Project() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/polyhedron_3d.py b/share/extensions/polyhedron_3d.py index a2605499a..cbb74d435 100644 --- a/share/extensions/polyhedron_3d.py +++ b/share/extensions/polyhedron_3d.py @@ -505,3 +505,4 @@ e = Poly_3D() e.affect() +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/pturtle.py b/share/extensions/pturtle.py index 431c216ed..8c67d3bc9 100755 --- a/share/extensions/pturtle.py +++ b/share/extensions/pturtle.py @@ -78,3 +78,6 @@ class pTurtle: lt = left pu = penup pd = pendown + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/radiusrand.py b/share/extensions/radiusrand.py index 902601c28..0e352f56a 100755 --- a/share/extensions/radiusrand.py +++ b/share/extensions/radiusrand.py @@ -75,3 +75,5 @@ class RadiusRandomize(inkex.Effect): e = RadiusRandomize() e.affect() + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/render_alphabetsoup_config.py b/share/extensions/render_alphabetsoup_config.py index 7bd674d03..a56120ea3 100644 --- a/share/extensions/render_alphabetsoup_config.py +++ b/share/extensions/render_alphabetsoup_config.py @@ -579,3 +579,5 @@ space = 4 # number of unit boxes to make units = 36 # pixels per unit box in font font = "alphabet_soup/" # location of font images + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/restack.py b/share/extensions/restack.py index 10510eb0b..b04c9d4b0 100644 --- a/share/extensions/restack.py +++ b/share/extensions/restack.py @@ -128,3 +128,6 @@ class Restack(inkex.Effect): e = Restack() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/rtree.py b/share/extensions/rtree.py index a70356557..d26eb2566 100755 --- a/share/extensions/rtree.py +++ b/share/extensions/rtree.py @@ -59,3 +59,6 @@ class RTreeTurtle(inkex.Effect): e = RTreeTurtle() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/rubberstretch.py b/share/extensions/rubberstretch.py index 2dfa8bb66..742101a13 100644 --- a/share/extensions/rubberstretch.py +++ b/share/extensions/rubberstretch.py @@ -77,3 +77,4 @@ e = RubberStretch() e.affect() +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/simplepath.py b/share/extensions/simplepath.py index 9869da33d..8d50429a6 100755 --- a/share/extensions/simplepath.py +++ b/share/extensions/simplepath.py @@ -200,3 +200,5 @@ def rotatePath(p, a, cx = 0, cy = 0): params[i] = (r * math.cos(theta)) + cx params[i + 1] = (r * math.sin(theta)) + cy + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/simplestyle.py b/share/extensions/simplestyle.py index 6ed6a10d0..012ea5c77 100755 --- a/share/extensions/simplestyle.py +++ b/share/extensions/simplestyle.py @@ -207,3 +207,6 @@ def formatColor3i(r,g,b): def formatColor3f(r,g,b): """3 floats to #rrggbb""" return '#%02x%02x%02x' % (int(round(r*255)),int(round(g*255)),int(round(b*255))) + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/simpletransform.py b/share/extensions/simpletransform.py index 360536e6d..cbd795665 100644 --- a/share/extensions/simpletransform.py +++ b/share/extensions/simpletransform.py @@ -175,3 +175,4 @@ def computeBBox(aList,mat=[[1,0,0],[0,1,0]]): return bbox +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/spirograph.py b/share/extensions/spirograph.py index 3ac356510..c276a826e 100644 --- a/share/extensions/spirograph.py +++ b/share/extensions/spirograph.py @@ -111,3 +111,5 @@ class Spirograph(inkex.Effect): e = Spirograph() e.affect() + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/straightseg.py b/share/extensions/straightseg.py index 071768e27..f6460f2d5 100755 --- a/share/extensions/straightseg.py +++ b/share/extensions/straightseg.py @@ -67,3 +67,6 @@ class SegmentStraightener(inkex.Effect): e = SegmentStraightener() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/summersnight.py b/share/extensions/summersnight.py index a326d327c..9dc9a0722 100755 --- a/share/extensions/summersnight.py +++ b/share/extensions/summersnight.py @@ -76,3 +76,6 @@ class Project(inkex.Effect): e = Project() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/svg_and_media_zip_output.py b/share/extensions/svg_and_media_zip_output.py index ddc1c2dea..74311b431 100644 --- a/share/extensions/svg_and_media_zip_output.py +++ b/share/extensions/svg_and_media_zip_output.py @@ -106,3 +106,6 @@ class MyEffect(inkex.Effect): e = MyEffect() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/triangle.py b/share/extensions/triangle.py index a50904b3f..4becf7b88 100644 --- a/share/extensions/triangle.py +++ b/share/extensions/triangle.py @@ -193,3 +193,4 @@ e = Grid_Polar() e.affect() +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/uniconv-ext.py b/share/extensions/uniconv-ext.py index d114b1a30..63a76cad4 100644 --- a/share/extensions/uniconv-ext.py +++ b/share/extensions/uniconv-ext.py @@ -1,69 +1,72 @@ -#!/usr/bin/env python - -""" -uniconv-ext.py -Python script for running UniConvertor 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 os -import random -import subprocess -import sys -import tempfile - -# We need a filename ending in ".svg" for UniConvertor. -# This is a hack. -chars = list("0123456789abcdefghijklmnopqrstuvwxyz") -while True: - random.shuffle(chars) - svgfile = os.path.join(tempfile.gettempdir(), ''.join(chars) + '.svg') - if not os.path.exists(svgfile): - break - -# Run UniConvertor, and determine our return code. -try: - p = subprocess.Popen('uniconv "%s" "%s"' % (sys.argv[1], svgfile), - shell=True, stderr=subprocess.PIPE) - err = p.stderr.read() - rc = p.wait() - if rc: - sys.stderr.write("UniConvertor failed: %s\n" % err) - rc = 1 -except Exception, inst: - sys.stderr.write("Spawn error: %s\n" % str(inst)) - rc = 1 - -# If successful, copy the SVG file to stdout. -if rc == 0: - try: - f = open(svgfile, "rU") - for line in f: - sys.stdout.write(line) - f.close() - except IOError, inst: - sys.stderr.write("Error reading temporary SVG file: %s\n" % str(inst)) - rc = 1 - -# Clean up and return. -try: - os.remove(svgfile) -except Exception: - pass -sys.exit(rc) +#!/usr/bin/env python + +""" +uniconv-ext.py +Python script for running UniConvertor 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 os +import random +import subprocess +import sys +import tempfile + +# We need a filename ending in ".svg" for UniConvertor. +# This is a hack. +chars = list("0123456789abcdefghijklmnopqrstuvwxyz") +while True: + random.shuffle(chars) + svgfile = os.path.join(tempfile.gettempdir(), ''.join(chars) + '.svg') + if not os.path.exists(svgfile): + break + +# Run UniConvertor, and determine our return code. +try: + p = subprocess.Popen('uniconv "%s" "%s"' % (sys.argv[1], svgfile), + shell=True, stderr=subprocess.PIPE) + err = p.stderr.read() + rc = p.wait() + if rc: + sys.stderr.write("UniConvertor failed: %s\n" % err) + rc = 1 +except Exception, inst: + sys.stderr.write("Spawn error: %s\n" % str(inst)) + rc = 1 + +# If successful, copy the SVG file to stdout. +if rc == 0: + try: + f = open(svgfile, "rU") + for line in f: + sys.stdout.write(line) + f.close() + except IOError, inst: + sys.stderr.write("Error reading temporary SVG file: %s\n" % str(inst)) + rc = 1 + +# Clean up and return. +try: + os.remove(svgfile) +except Exception: + pass +sys.exit(rc) + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 diff --git a/share/extensions/whirl.py b/share/extensions/whirl.py index 0be38e0d5..32e55b291 100644 --- a/share/extensions/whirl.py +++ b/share/extensions/whirl.py @@ -55,3 +55,6 @@ class Whirl(inkex.Effect): e = Whirl() e.affect() + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99