Code

share/extensions/*.py: Wrap ‘e = MyEffect(); e.affect()’ in ‘if __name__ == '__main__...
authorpjrm <pjrm@users.sourceforge.net>
Fri, 23 May 2008 07:05:15 +0000 (07:05 +0000)
committerpjrm <pjrm@users.sourceforge.net>
Fri, 23 May 2008 07:05:15 +0000 (07:05 +0000)
38 files changed:
share/extensions/addnodes.py
share/extensions/dimension.py
share/extensions/dots.py
share/extensions/dxf_outlines.py
share/extensions/edge3d.py
share/extensions/eqtexsvg.py
share/extensions/extractimage.py
share/extensions/flatten.py
share/extensions/fractalize.py
share/extensions/funcplot.py
share/extensions/gears.py
share/extensions/gimp_xcf.py
share/extensions/grid_cartesian.py
share/extensions/grid_polar.py
share/extensions/handles.py
share/extensions/interp.py
share/extensions/lindenmayer.py
share/extensions/lorem_ipsum.py
share/extensions/markers_strokepaint.py
share/extensions/measure.py
share/extensions/motion.py
share/extensions/pathalongpath.py
share/extensions/pathscatter.py
share/extensions/perfectboundcover.py
share/extensions/perspective.py
share/extensions/polyhedron_3d.py
share/extensions/radiusrand.py
share/extensions/render_alphabetsoup.py
share/extensions/render_barcode.py
share/extensions/restack.py
share/extensions/rtree.py
share/extensions/rubberstretch.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/whirl.py

index a1c544a1ec8ddc9fd6d03b48f4d8bc77eb724e8e..3a8bebe668fb5e4cebb33652e91133b057b2ac49 100644 (file)
@@ -108,8 +108,9 @@ class SplitIt(inkex.Effect):
                     
                 node.set('d',cubicsuperpath.formatPath(new))
 
-e = SplitIt()
-e.affect()
+if __name__ == '__main__':
+    e = SplitIt()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 7a319ebdcf7d8106e7dd21275a521903bf2e0152..f7dfb902e8e78c3a4fcc18190fe1af26696f0f40 100644 (file)
@@ -138,8 +138,9 @@ class Dimension(pathmodifier.PathModifier):
         
         layer.append(group)
 
-e = Dimension()
-e.affect()
+if __name__ == '__main__':
+    e = Dimension()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 2210bf30e5a03142272791e5c5c6abb611e743f1..1f7312a874bf68f38c3cf327beb8794c9e12bf07 100755 (executable)
@@ -68,8 +68,9 @@ class Dots(inkex.Effect):
                 new.set('y', str(y))
                 new.text = str(text)
 
-e = Dots()
-e.affect()
+if __name__ == '__main__':
+    e = Dots()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index b05aea5468bed991e3884bf2b5a0602907b46bec..10b9f1286698df6300fd2e916d5eb18cc6c32652 100755 (executable)
@@ -71,8 +71,9 @@ class MyEffect(inkex.Effect):
 
         self.dxf_add(dxf_templates.r14_footer)
 
-e = MyEffect()
-e.affect()
+if __name__ == '__main__':
+    e = MyEffect()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index e3774719553f8b1c4e405f4451355f540a72c69b..2deff9b67021bd0801f35e13c8e8e0d4ac22fc8e 100644 (file)
@@ -141,8 +141,9 @@ class Edge3d(inkex.Effect):
 
         return g
 
-e = Edge3d()
-e.affect()
+if __name__ == '__main__':
+    e = Edge3d()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 92e51c44f2c1853b1226b16855566211f74a1693..563bf2c4cea5c98be87b5dd6b731f6b1a1bc9064 100644 (file)
@@ -134,8 +134,9 @@ class EQTEXSVG(inkex.Effect):
 
         clean()
 
-e = EQTEXSVG()
-e.affect()
+if __name__ == '__main__':
+    e = EQTEXSVG()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index c85456c88bda1ad7640dffe032c68593cab4cb81..07074c8a4693fd47527246267ad35b6531a896fe 100644 (file)
@@ -64,8 +64,9 @@ class MyEffect(inkex.Effect):
                                 inkex.debug('Difficulty finding the image data.')
                             break
 
-e = MyEffect()
-e.affect()
+if __name__ == '__main__':
+    e = MyEffect()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index fe14408634493c63d27e589f211226da09809a0e..48044936b306a3d60c0ba8f501945655ed24a3b1 100755 (executable)
@@ -42,8 +42,9 @@ class MyEffect(inkex.Effect):
                         np.append([cmd,[csp[1][0],csp[1][1]]])
                         node.set('d',simplepath.formatPath(np))
 
-e = MyEffect()
-e.affect()
+if __name__ == '__main__':
+    e = MyEffect()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 91a827f9017a321f7c3b7cd18736a94de470498e..ec92064d19688a8e1b474265b3a75f0900038e33 100755 (executable)
@@ -89,8 +89,9 @@ class PathFractalize(inkex.Effect):
             """ recursively subdivide the segment right of the subdivision point """
             self.fractalize(a,subdivPoint[-2],subdivPoint[-1],x2,y2,s-1,f)
              
-e = PathFractalize()
-e.affect()
+if __name__ == '__main__':
+    e = PathFractalize()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 08631a0beaf2e1e6542e3f073d4daf43500bdca3..e5f93d4309eab1cd91f7b39fc60d83930853f69d 100644 (file)
@@ -269,8 +269,9 @@ class FuncPlot(inkex.Effect):
                 if self.options.remove:
                     node.getparent().remove(node)
                 
-e = FuncPlot()
-e.affect()
+if __name__ == '__main__':
+    e = FuncPlot()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index e6acabfaef3447d7f8e6e45c29ca980e88b5f619..e4dbefc2e48b78cf9c9ef9888ebce017cce026c3 100644 (file)
@@ -158,8 +158,9 @@ class Gears(inkex.Effect):
         gear_attribs = {'style':simplestyle.formatStyle(style), 'd':path}
         gear = inkex.etree.SubElement(g, inkex.addNS('path','svg'), gear_attribs )
 
-e = Gears()
-e.affect()
+if __name__ == '__main__':
+    e = Gears()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 3a0ee47c4c59266ae896d8ba8b08d380b75227d7..121cb360d228356156f0a1dc9b43ca0e3dfc3e83 100755 (executable)
@@ -23,13 +23,13 @@ class MyEffect(inkex.Effect):
     def __init__(self):
         inkex.Effect.__init__(self)
        self.OptionParser.add_option("-d", "--guides",
-                                               action="store", type="inkbool",
-                                               dest="saveGuides", default=False,
-                                               help="Save the Guides with the .XCF")
+                                     action="store", type="inkbool",
+                                     dest="saveGuides", default=False,
+                                     help="Save the Guides with the .XCF")
        self.OptionParser.add_option("-r", "--grid",
-                                               action="store", type="inkbool",
-                                               dest="saveGrid", default=False,
-                                               help="Save the Grid with the .XCF")
+                                     action="store", type="inkbool",
+                                     dest="saveGrid", default=False,
+                                     help="Save the Grid with the .XCF")
     def output(self):
         pass
     def effect(self):
@@ -168,6 +168,7 @@ class MyEffect(inkex.Effect):
         sys.stdout.write(x.read())
         x.close()
 
-e = MyEffect()
-e.affect()
+if __name__ == '__main__':
+    e = MyEffect()
+    e.affect()
 
index f531f3ac77f3dcfb5f7f013293dfa5a7346e7be2..19adbbbe29d76905dfe61d34b5b361d711fef70f 100644 (file)
@@ -256,8 +256,9 @@ class Grid_Polar(inkex.Effect):
 
 
 
-e = Grid_Polar()
-e.affect()
+if __name__ == '__main__':
+    e = Grid_Polar()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 1c2a6d9717d1895b2af0d99929ba5e094401216b..4d7a3989c37d63a2fe2d012c6fe655369434f56a 100644 (file)
@@ -190,8 +190,9 @@ class Grid_Polar(inkex.Effect):
                                        str(i*360/self.options.a_divs), 
                                        label_size, 'Label'+str(i), grid)
 
-e = Grid_Polar()
-e.affect()
+if __name__ == '__main__':
+    e = Grid_Polar()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 4a75e8e2f847cfb2d3ee4f19be8dd82ed36a6f0d..256e3d422b686526f91b4608b1112a2e80e4e93d 100755 (executable)
@@ -50,8 +50,9 @@ class Handles(inkex.Effect):
                     attribs = {'style':simplestyle.formatStyle(s),'d':simplepath.formatPath(a)}
                     inkex.etree.SubElement(node.getparent(), inkex.addNS('path','svg'), attribs)
                     
-e = Handles()
-e.affect()
+if __name__ == '__main__':
+    e = Handles()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 2d840c87ea059634f1d2af1d73bba6ea0e488129..bb05d8d846b3a9299c3e3b25b17397419969b1e7 100755 (executable)
@@ -308,8 +308,9 @@ class Interp(inkex.Effect):
                 attribs = {'style':simplestyle.formatStyle(basestyle),'d':cubicsuperpath.formatPath(interp)}
                 new = inkex.etree.SubElement(group,inkex.addNS('path','svg'), attribs)
 
-e = Interp()
-e.affect()
+if __name__ == '__main__':
+    e = Interp()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index f8da0990a95bdbbec1eab5fb3f3fa25ceab7025a..e690e003c097d3ec9aeca7e991ef06785ed6c7b7 100755 (executable)
@@ -108,8 +108,9 @@ class LSystem(inkex.Effect):
         attribs = {'style':simplestyle.formatStyle(s),'d':self.iterate()}
         inkex.etree.SubElement(self.current_layer,inkex.addNS('path','svg'),attribs)
 
-e = LSystem()
-e.affect()
+if __name__ == '__main__':
+    e = LSystem()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 938d63e0ba7288b1239b728d520a6e1484de6e25..52d1bb190cc6da6acd3d93ab6e6399cc2bb8c02a 100644 (file)
@@ -228,5 +228,6 @@ class MyEffect(inkex.Effect):
       rect=inkex.etree.SubElement(flowRegion,inkex.addNS('rect','svg'),rattribs)
       self.addText(flowRoot)
 
-e = MyEffect()
-e.affect()
+if __name__ == '__main__':
+  e = MyEffect()
+  e.affect()
index 4d718a5b94dfd9015394f73a45cc27628adc9a89..11fa77d0fe007bfc1a6244bf122c215f08bc7d28 100644 (file)
@@ -71,8 +71,9 @@ class MyEffect(inkex.Effect):
                         child.set('style',simplestyle.formatStyle(cstyle))
             node.set('style',simplestyle.formatStyle(style))
 
-e = MyEffect()
-e.affect()
+if __name__ == '__main__':
+    e = MyEffect()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 0db00105a6adbbf1fe502bc4f5a55d474082e09f..26b20b3e22a28dd8d3a2cf1152a4befefbd92b91 100644 (file)
@@ -167,8 +167,9 @@ class Length(inkex.Effect):
                 node.set('x', str(x))
                 node.set('y', str(y))
 
-e = Length()
-e.affect()
+if __name__ == '__main__':
+    e = Length()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 88e545c8bec17c4edc7e2093106dfdaa9dc882f8..5e0e7373186f47fb2edf2f38ee9548e825fa63b3 100755 (executable)
@@ -105,8 +105,9 @@ class Motion(inkex.Effect):
                     else:
                         last = params[-2:]
 
-e = Motion()
-e.affect()
+if __name__ == '__main__':
+    e = Motion()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index f02a69d50827f349861cdf909443395f288bae66..917bc665b910b6b3a157b16c2927ba70d2208d1e 100644 (file)
@@ -272,8 +272,9 @@ class PathAlongPath(pathmodifier.Diffeo):
 
                 node.set('d', cubicsuperpath.formatPath(newp))
 
-e = PathAlongPath()
-e.affect()
+if __name__ == '__main__':
+    e = PathAlongPath()
+    e.affect()
 
                     
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 0ce0958774045821f68b6a5bd7dcda3112fabcb1..20623de6a794fd9fdec29e474f46a3ddbe106937 100644 (file)
@@ -255,8 +255,9 @@ class PathScatter(pathmodifier.Diffeo):
         self.patternNode.getparent().remove(self.patternNode)
 
 
-e = PathScatter()
-e.affect()
+if __name__ == '__main__':
+    e = PathScatter()
+    e.affect()
 
                     
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 0e0231a5014d71173ab2e99110a1d8b035e94e37..6940404342bf9349dd7ea2e3dad10e22210715db 100644 (file)
@@ -163,8 +163,10 @@ class PerfectBoundCover(inkex.Effect):
                     
                 node.set('d',cubicsuperpath.formatPath(new))
             '''
-e = PerfectBoundCover()
-e.affect()
+
+if __name__ == '__main__':
+    e = PerfectBoundCover()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 26a23dc0a8baf55788fc3cb319ee89bbaec0250c..53b1a9149174c1e52ce4f3dfae4ea3319558006d 100755 (executable)
@@ -123,8 +123,9 @@ class Project(inkex.Effect):
         y = p[1]
         return [(x*m[0][0] + y*m[0][1] + m[0][2])/(x*m[2][0]+y*m[2][1]+m[2][2]),(x*m[1][0] + y*m[1][1] + m[1][2])/(x*m[2][0]+y*m[2][1]+m[2][2])]
 
-e = Project()
-e.affect()
+if __name__ == '__main__':
+    e = Project()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index cbb74d43538718b90c4378e6ed82f03821fe9072..006d16d6b5813b29acb457565904691abd29f90d 100644 (file)
@@ -501,8 +501,9 @@ class Poly_3D(inkex.Effect):
         else:
             sys.stderr.write('Internal Error. No view type selected\n')
         
-e = Poly_3D()
-e.affect()
+if __name__ == '__main__':
+    e = Poly_3D()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 0e352f56a8a47e29d6afd3103ff10fd686612a86..15b8168539882b32eb8263d14e3d62e39348e1ed 100755 (executable)
@@ -72,8 +72,9 @@ class RadiusRandomize(inkex.Effect):
                             csp[2]=randomize(csp[2], self.options.radiusx, self.options.radiusy, self.options.norm)
                 node.set('d',cubicsuperpath.formatPath(p))
 
-e = RadiusRandomize()
-e.affect()
+if __name__ == '__main__':
+    e = RadiusRandomize()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index e3f64fc07d850996eb462213763947ed885dffd6..f741eaa578ee236ac54e2e257b82d79b5cce19f5 100644 (file)
@@ -451,6 +451,7 @@ class AlphabetSoup(inkex.Effect):
                        new.set('d', simplepath.formatPath(image))
                        self.current_layer.append(new)
 
-e = AlphabetSoup()
-e.affect()
+if __name__ == '__main__':
+    e = AlphabetSoup()
+    e.affect()
 
index 590e55b86c519b385f89f6edc29c108459f361a0..77cb3135b5ea40a8e6268cd34de665b40a6ca4c5 100644 (file)
@@ -54,6 +54,7 @@ class InsertBarcode(inkex.Effect):
                else:
                        sys.stderr.write("Unable to make barcode with: " + str(self.options) + "\n")
 
-e = InsertBarcode()
-e.affect()
+if __name__ == '__main__':
+        e = InsertBarcode()
+        e.affect()
 
index b04c9d4b0bd36f8d4f244d400634814c570c9453..1f61bd3afb77ce56e8d908a6b04eefcb14bbefd6 100644 (file)
@@ -126,8 +126,9 @@ class Restack(inkex.Effect):
             for item in objlist:
                 svg.append( self.selected[item[1]])
 
-e = Restack()
-e.affect()
+if __name__ == '__main__':
+    e = Restack()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index d26eb2566f2358a5de805887c8b6cbc5f2ed1053..ddd0078d0be4b35d3972dd050a6e101ee3a50b56 100755 (executable)
@@ -57,8 +57,9 @@ class RTreeTurtle(inkex.Effect):
         attribs = {'d':t.getPath(),'style':simplestyle.formatStyle(s)}
         inkex.etree.SubElement(self.current_layer, inkex.addNS('path','svg'), attribs)
 
-e = RTreeTurtle()
-e.affect()
+if __name__ == '__main__':
+    e = RTreeTurtle()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 742101a13f88d31ded7ad8b0430038ebed053fa7..5426ea3c90f655216516f2f7c09a6e4df3590ed6 100644 (file)
@@ -73,8 +73,9 @@ class RubberStretch(pathmodifier.Diffeo):
             v[1]*=-1
         bpt[1]*=-1
 
-e = RubberStretch()
-e.affect()
+if __name__ == '__main__':
+    e = RubberStretch()
+    e.affect()
 
     
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index c276a826e8708022bdcaac99fc48023bc47e0e06..9dbf0dcea2fa13b64e233adca86e1e31ba493285 100644 (file)
@@ -108,8 +108,9 @@ class Spirograph(inkex.Effect):
         new.set('d', pathString)
         self.current_layer.append(new)
 
-e = Spirograph()
-e.affect()
+if __name__ == '__main__':
+    e = Spirograph()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index f6460f2d55af5a1bcc65aa800ab7b6fb0b57bcc2..16db996fc94a81c089550522667aba96122756e6 100755 (executable)
@@ -65,8 +65,9 @@ class SegmentStraightener(inkex.Effect):
                         last = params[-2:]
                 node.set('d',simplepath.formatPath(p))
 
-e = SegmentStraightener()
-e.affect()
+if __name__ == '__main__':
+    e = SegmentStraightener()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 9dc9a0722b57eeba4998fefa34dcc5fdc9d34b2f..f3d9811c4f2e19f233e783c227a710e6b31147ff 100755 (executable)
@@ -74,8 +74,9 @@ class Project(inkex.Effect):
         p = intersectSegments(vert,horz)
         return [p['x'],p['y']]    
 
-e = Project()
-e.affect()
+if __name__ == '__main__':
+    e = Project()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 74311b4315c4a97e5abd0e49ee7e74ad296c979f..001d5b0f8a77600715cdf74d8d299ec7215cf3e3 100644 (file)
@@ -104,8 +104,9 @@ class MyEffect(inkex.Effect):
             node.set(inkex.addNS('absref',u'sodipodi'),os.path.basename(absref))
 
             
-e = MyEffect()
-e.affect()
+if __name__ == '__main__':
+    e = MyEffect()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 4becf7b88f09125277cd1f23b439fc723c1773a9..965de243ee9abe51e02abfde19360ca47205fb20 100644 (file)
@@ -189,8 +189,9 @@ class Grid_Polar(inkex.Effect):
             
             draw_tri_from_3_sides(s_a, s_b, s_c, offset, tri)
 
-e = Grid_Polar()
-e.affect()
+if __name__ == '__main__':
+    e = Grid_Polar()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
index 32e55b291aafccae386fe1057a390d4399fdae86..4c5db2262c2eb224a71926f0209cf1cc5815b089 100644 (file)
@@ -53,8 +53,9 @@ class Whirl(inkex.Effect):
                             point[1] += self.view_center[1]
                 node.set('d',cubicsuperpath.formatPath(p))
 
-e = Whirl()
-e.affect()
+if __name__ == '__main__':
+    e = Whirl()
+    e.affect()
 
 
 # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99