Code

noop: Add vim modeline for all share/extensions/*.py files that use four-space indent...
authorpjrm <pjrm@users.sourceforge.net>
Fri, 23 May 2008 06:31:40 +0000 (06:31 +0000)
committerpjrm <pjrm@users.sourceforge.net>
Fri, 23 May 2008 06:31:40 +0000 (06:31 +0000)
49 files changed:
share/extensions/addnodes.py
share/extensions/bezmisc.py
share/extensions/color_randomize.py
share/extensions/cspsubdiv.py
share/extensions/cubicsuperpath.py
share/extensions/dots.py
share/extensions/dxf_outlines.py
share/extensions/edge3d.py
share/extensions/embedimage.py
share/extensions/eqtexsvg.py
share/extensions/export_gimp_palette.py
share/extensions/extractimage.py
share/extensions/ffgeom.py
share/extensions/flatten.py
share/extensions/fractalize.py
share/extensions/funcplot.py
share/extensions/gears.py
share/extensions/grid_cartesian.py
share/extensions/grid_polar.py
share/extensions/handles.py
share/extensions/inkex.py
share/extensions/interp.py
share/extensions/launch_webbrowser.py
share/extensions/lindenmayer.py
share/extensions/markers_strokepaint.py
share/extensions/measure.py
share/extensions/motion.py
share/extensions/pathalongpath.py
share/extensions/pathmodifier.py
share/extensions/pathscatter.py
share/extensions/perfectboundcover.py
share/extensions/perspective.py
share/extensions/polyhedron_3d.py
share/extensions/pturtle.py
share/extensions/radiusrand.py
share/extensions/render_alphabetsoup_config.py
share/extensions/restack.py
share/extensions/rtree.py
share/extensions/rubberstretch.py
share/extensions/simplepath.py
share/extensions/simplestyle.py
share/extensions/simpletransform.py
share/extensions/spirograph.py
share/extensions/straightseg.py
share/extensions/summersnight.py
share/extensions/svg_and_media_zip_output.py
share/extensions/triangle.py
share/extensions/uniconv-ext.py
share/extensions/whirl.py

index b12f440d747e6718a61873459aac1b9e8f443c4e..a1c544a1ec8ddc9fd6d03b48f4d8bc77eb724e8e 100644 (file)
@@ -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
index 7faf691845377b53c19911ac280a71740bd85b81..f5c2907083b026ed6562c1a124fb160e433f8349 100755 (executable)
@@ -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
index 9bad74893718d152d7ece598c15000d4c904f2c8..cfe82a8e3c1b64da3078825ca6835b760e6705cc 100644 (file)
@@ -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
index 427e7a494e94a136538d20a2839d7b5ff40de903..20817d8cfb25adf510ba0cd3312d9f562347f10c 100644 (file)
@@ -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
index 2e7ae50885747fcf3c5aec4c5bd26f6711643db5..21c6174e15dad0e2469c1bfdb840cf52d5f5e20e 100755 (executable)
@@ -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
index 7350cae8dacc89b3d5e3a54a65887e0cf424efbe..2210bf30e5a03142272791e5c5c6abb611e743f1 100755 (executable)
@@ -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
index ab093a140dfad919c65e7ed481d52965b362744b..b05aea5468bed991e3884bf2b5a0602907b46bec 100755 (executable)
@@ -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
index 1984e5ff5b7f18e8f69c9cb8886c974eda145a37..e3774719553f8b1c4e405f4451355f540a72c69b 100644 (file)
@@ -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
index 263cf592505a6489c307041ab4108d445208b2bf..01cefacb00cb350956c20c8f20a55a203b30564d 100644 (file)
@@ -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
index 7cbe8ebfd65d122c1b74f4045f5dd80f22a4ffe5..92e51c44f2c1853b1226b16855566211f74a1693 100644 (file)
@@ -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
index 3a9d227cf6f799da616fbbbdaa682d473313bc4f..31dad455283893d8374ad0e8d089548a9f1d9157 100644 (file)
@@ -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
index 188cb5d60f73c0555b13d0136390dd7db9b5adfa..c85456c88bda1ad7640dffe032c68593cab4cb81 100644 (file)
@@ -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
index 24d80a175dd7855d0e7082078b5127a275ba25b5..1983586728760a67e852bbb3b5535d770e8eb1a3 100644 (file)
@@ -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
index 2e1a491cd3368c87c6c4503a2401d075782cd286..fe14408634493c63d27e589f211226da09809a0e 100755 (executable)
@@ -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
index 3e6f5df050858651f4ad0df4bba1c3a3b4efc781..91a827f9017a321f7c3b7cd18736a94de470498e 100755 (executable)
@@ -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
index 6abdd9c40af1f278d4ef775569cd068d3cf5aa17..08631a0beaf2e1e6542e3f073d4daf43500bdca3 100644 (file)
@@ -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
index 6683d12e979019f96148be5e37ec91f930d0a51e..202b29d8ed023b9f6c2aa623b4e1634bab9df9a7 100644 (file)
@@ -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
index 968212e083137b68e8bbf2e9dd5ae694010af20e..f531f3ac77f3dcfb5f7f013293dfa5a7346e7be2 100644 (file)
@@ -260,3 +260,4 @@ e = Grid_Polar()
 e.affect()
 
 
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 1d60b4bd3066d0580b8c6ba6eed9853eb81b02a3..1c2a6d9717d1895b2af0d99929ba5e094401216b 100644 (file)
@@ -194,3 +194,4 @@ e = Grid_Polar()
 e.affect()
 
 
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 83d7f196910d649c2b4be95055ffc062406d122f..4a75e8e2f847cfb2d3ee4f19be8dd82ed36a6f0d 100755 (executable)
@@ -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
index 379cfa070f33a15fddb48ba5e61af7b15b48b35f..5aa8912a9a1bf9f2b8e8afd7edf1dd9c1b7e5866 100755 (executable)
@@ -169,3 +169,5 @@ class Effect:
             retval = None
         return retval
             
+
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 1b28f1bffd9a97dfa1e02d6f1e1bef3735e7f1c6..2d840c87ea059634f1d2af1d73bba6ea0e488129 100755 (executable)
@@ -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
index d27d6d1f48c9635f286fe9e0fd272456aa807cff..0deea3c8f0e4cced381df6e2fa8680b686bf5ad7 100644 (file)
@@ -1,18 +1,21 @@
-#!/usr/bin/env python \r
-import webbrowser, threading\r
-from optparse import OptionParser\r
-\r
-class VisitWebSiteWithoutLockingInkscape(threading.Thread):\r
-    def __init__(self):\r
-        threading.Thread.__init__ (self)\r
-        parser = OptionParser()\r
-        parser.add_option("-u", "--url", action="store", type="string", \r
-                        default="http://www.inkscape.org/", \r
-                        dest="url", help="The URL to open in web browser")\r
-        (self.options, args) = parser.parse_args()        \r
-\r
-    def run(self):       \r
-        webbrowser.open(self.options.url)\r
-        \r
-vwswli = VisitWebSiteWithoutLockingInkscape()\r
-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
index e43e167b64f846b232bbc643c06309f7a0d6a55a..f8da0990a95bdbbec1eab5fb3f3fa25ceab7025a 100755 (executable)
@@ -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
index 350c87f28fa581eafd882742ed7c5804d41911b3..4d718a5b94dfd9015394f73a45cc27628adc9a89 100644 (file)
@@ -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
index 483a4a66a7087b464b4ec1a253a93f7680824b4a..0db00105a6adbbf1fe502bc4f5a55d474082e09f 100644 (file)
@@ -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
index f9533cd504ffbcbfe44b57cb6a5fbd27587560de..88e545c8bec17c4edc7e2093106dfdaa9dc882f8 100755 (executable)
@@ -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
index 5bac2550b5bad2fdd34ab9cd23dda8f8d49e7185..f02a69d50827f349861cdf909443395f288bae66 100644 (file)
@@ -276,3 +276,4 @@ e = PathAlongPath()
 e.affect()
 
                     
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index bfc72f074d1c5a4eaef30c52c8b855eca7a3394c..645b7fb6cf934530871a5630be1923d111154d59 100644 (file)
@@ -305,3 +305,4 @@ class Diffeo(PathModifier):
 #e.affect()
 
     
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 4e41eff65df71e712e92d3f6c93e0a700a7b40c8..0ce0958774045821f68b6a5bd7dcda3112fabcb1 100644 (file)
@@ -259,3 +259,4 @@ e = PathScatter()
 e.affect()
 
                     
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 6295f64685c5f1be96f13a3454410c4c8a448425..0e0231a5014d71173ab2e99110a1d8b035e94e37 100644 (file)
@@ -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
index 6b409377aa96ae50c8545179e9bcb0c3b3c6aba5..26a23dc0a8baf55788fc3cb319ee89bbaec0250c 100755 (executable)
@@ -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
index a2605499afc2511578b4f2c6f532fd6115c0f9a1..cbb74d43538718b90c4378e6ed82f03821fe9072 100644 (file)
@@ -505,3 +505,4 @@ e = Poly_3D()
 e.affect()
 
 
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 431c216eda48800b7606494b4a0a51cf2fe0e163..8c67d3bc9c8a4f84879fce599ed1bdd96d24db55 100755 (executable)
@@ -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
index 902601c285cab070262e01b5f1a69dc1bb437a74..0e352f56a8a47e29d6afd3103ff10fd686612a86 100755 (executable)
@@ -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
index 7bd674d0352ee59542337ea3544fcc0def2f04d9..a56120ea32f657dce536bcbb83ec004e04a86b84 100644 (file)
@@ -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
index 10510eb0bf3efdcf160e84336dafd4060fc1a999..b04c9d4b0bd36f8d4f244d400634814c570c9453 100644 (file)
@@ -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
index a703565574e8af235a1e5625a673ce8781707b24..d26eb2566f2358a5de805887c8b6cbc5f2ed1053 100755 (executable)
@@ -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
index 2dfa8bb6604d8066382414e20ff8ad3930306056..742101a13f88d31ded7ad8b0430038ebed053fa7 100644 (file)
@@ -77,3 +77,4 @@ e = RubberStretch()
 e.affect()
 
     
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 9869da33dce93dd7ef20b0a5eac1a067736663f2..8d50429a6d9f49e44426901a55b7f60fe258c282 100755 (executable)
@@ -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
index 6ed6a10d00d33b16008a2dc22f737299e91e1b9d..012ea5c77847b4dbe7057ba09919e983e7188238 100755 (executable)
@@ -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
index 360536e6d5bd2504db6f0b21f17aca7618b7c913..cbd7956657b03d543ae0b16617d04f7a3bad5089 100644 (file)
@@ -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
index 3ac3565106921fb4c0fd1ce502c26b8723377765..c276a826e8708022bdcaac99fc48023bc47e0e06 100644 (file)
@@ -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
index 071768e272caccf7c7a4d58e999af25b2008f4fa..f6460f2d55af5a1bcc65aa800ab7b6fb0b57bcc2 100755 (executable)
@@ -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
index a326d327cf75cd83e9de01aafd73aef349df1fba..9dc9a0722b57eeba4998fefa34dcc5fdc9d34b2f 100755 (executable)
@@ -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
index ddc1c2deaa642a1ba3f25762ca06232b7e440fd4..74311b4315c4a97e5abd0e49ee7e74ad296c979f 100644 (file)
@@ -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
index a50904b3f4d4f15f116920c2c922e714d02dfeb3..4becf7b88f09125277cd1f23b439fc723c1773a9 100644 (file)
@@ -193,3 +193,4 @@ e = Grid_Polar()
 e.affect()
 
 
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index d114b1a306a637bde88375e50f11f06a651d7cc9..63a76cad4f7e9297b36c4a2b9ce8eafd7291c978 100644 (file)
@@ -1,69 +1,72 @@
-#!/usr/bin/env python\r
-\r
-"""\r
-uniconv-ext.py\r
-Python script for running UniConvertor in Inkscape extensions\r
-\r
-Copyright (C) 2008 Stephen Silver\r
-\r
-This program is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-This program is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with this program; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
-\r
-"""\r
-\r
-import os\r
-import random\r
-import subprocess\r
-import sys\r
-import tempfile\r
-\r
-# We need a filename ending in ".svg" for UniConvertor.\r
-# This is a hack.\r
-chars = list("0123456789abcdefghijklmnopqrstuvwxyz")\r
-while True:\r
-    random.shuffle(chars)\r
-    svgfile = os.path.join(tempfile.gettempdir(), ''.join(chars) + '.svg')\r
-    if not os.path.exists(svgfile):\r
-        break\r
-\r
-# Run UniConvertor, and determine our return code.\r
-try:\r
-    p = subprocess.Popen('uniconv "%s" "%s"' % (sys.argv[1], svgfile),\r
-                         shell=True, stderr=subprocess.PIPE)\r
-    err = p.stderr.read()\r
-    rc = p.wait()\r
-    if rc:\r
-        sys.stderr.write("UniConvertor failed: %s\n" % err)\r
-        rc = 1\r
-except Exception, inst:\r
-    sys.stderr.write("Spawn error: %s\n" % str(inst))\r
-    rc = 1\r
-\r
-# If successful, copy the SVG file to stdout.\r
-if rc == 0:\r
-    try:\r
-        f = open(svgfile, "rU")\r
-        for line in f:\r
-            sys.stdout.write(line)\r
-        f.close()\r
-    except IOError, inst:\r
-        sys.stderr.write("Error reading temporary SVG file: %s\n" % str(inst))\r
-        rc = 1\r
-\r
-# Clean up and return.\r
-try:\r
-    os.remove(svgfile)\r
-except Exception:\r
-    pass\r
-sys.exit(rc)\r
+#!/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
index 0be38e0d584fc17579ce26c138391c3a3cb0de25..32e55b291aafccae386fe1057a390d4399fdae86 100644 (file)
@@ -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