From: pjrm Date: Fri, 23 May 2008 07:05:15 +0000 (+0000) Subject: share/extensions/*.py: Wrap ‘e = MyEffect(); e.affect()’ in ‘if __name__ == '__main__... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a223910930e4cf964962a08cf1d30928395652c5;p=inkscape.git share/extensions/*.py: Wrap ‘e = MyEffect(); e.affect()’ in ‘if __name__ == '__main__':’, to allow use of pychecker. --- diff --git a/share/extensions/addnodes.py b/share/extensions/addnodes.py index a1c544a1e..3a8bebe66 100644 --- a/share/extensions/addnodes.py +++ b/share/extensions/addnodes.py @@ -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 diff --git a/share/extensions/dimension.py b/share/extensions/dimension.py index 7a319ebdc..f7dfb902e 100644 --- a/share/extensions/dimension.py +++ b/share/extensions/dimension.py @@ -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 diff --git a/share/extensions/dots.py b/share/extensions/dots.py index 2210bf30e..1f7312a87 100755 --- a/share/extensions/dots.py +++ b/share/extensions/dots.py @@ -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 diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py index b05aea546..10b9f1286 100755 --- a/share/extensions/dxf_outlines.py +++ b/share/extensions/dxf_outlines.py @@ -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 diff --git a/share/extensions/edge3d.py b/share/extensions/edge3d.py index e37747195..2deff9b67 100644 --- a/share/extensions/edge3d.py +++ b/share/extensions/edge3d.py @@ -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 diff --git a/share/extensions/eqtexsvg.py b/share/extensions/eqtexsvg.py index 92e51c44f..563bf2c4c 100644 --- a/share/extensions/eqtexsvg.py +++ b/share/extensions/eqtexsvg.py @@ -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 diff --git a/share/extensions/extractimage.py b/share/extensions/extractimage.py index c85456c88..07074c8a4 100644 --- a/share/extensions/extractimage.py +++ b/share/extensions/extractimage.py @@ -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 diff --git a/share/extensions/flatten.py b/share/extensions/flatten.py index fe1440863..48044936b 100755 --- a/share/extensions/flatten.py +++ b/share/extensions/flatten.py @@ -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 diff --git a/share/extensions/fractalize.py b/share/extensions/fractalize.py index 91a827f90..ec92064d1 100755 --- a/share/extensions/fractalize.py +++ b/share/extensions/fractalize.py @@ -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 diff --git a/share/extensions/funcplot.py b/share/extensions/funcplot.py index 08631a0be..e5f93d430 100644 --- a/share/extensions/funcplot.py +++ b/share/extensions/funcplot.py @@ -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 diff --git a/share/extensions/gears.py b/share/extensions/gears.py index e6acabfae..e4dbefc2e 100644 --- a/share/extensions/gears.py +++ b/share/extensions/gears.py @@ -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 diff --git a/share/extensions/gimp_xcf.py b/share/extensions/gimp_xcf.py index 3a0ee47c4..121cb360d 100755 --- a/share/extensions/gimp_xcf.py +++ b/share/extensions/gimp_xcf.py @@ -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() diff --git a/share/extensions/grid_cartesian.py b/share/extensions/grid_cartesian.py index f531f3ac7..19adbbbe2 100644 --- a/share/extensions/grid_cartesian.py +++ b/share/extensions/grid_cartesian.py @@ -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 diff --git a/share/extensions/grid_polar.py b/share/extensions/grid_polar.py index 1c2a6d971..4d7a3989c 100644 --- a/share/extensions/grid_polar.py +++ b/share/extensions/grid_polar.py @@ -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 diff --git a/share/extensions/handles.py b/share/extensions/handles.py index 4a75e8e2f..256e3d422 100755 --- a/share/extensions/handles.py +++ b/share/extensions/handles.py @@ -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 diff --git a/share/extensions/interp.py b/share/extensions/interp.py index 2d840c87e..bb05d8d84 100755 --- a/share/extensions/interp.py +++ b/share/extensions/interp.py @@ -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 diff --git a/share/extensions/lindenmayer.py b/share/extensions/lindenmayer.py index f8da0990a..e690e003c 100755 --- a/share/extensions/lindenmayer.py +++ b/share/extensions/lindenmayer.py @@ -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 diff --git a/share/extensions/lorem_ipsum.py b/share/extensions/lorem_ipsum.py index 938d63e0b..52d1bb190 100644 --- a/share/extensions/lorem_ipsum.py +++ b/share/extensions/lorem_ipsum.py @@ -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() diff --git a/share/extensions/markers_strokepaint.py b/share/extensions/markers_strokepaint.py index 4d718a5b9..11fa77d0f 100644 --- a/share/extensions/markers_strokepaint.py +++ b/share/extensions/markers_strokepaint.py @@ -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 diff --git a/share/extensions/measure.py b/share/extensions/measure.py index 0db00105a..26b20b3e2 100644 --- a/share/extensions/measure.py +++ b/share/extensions/measure.py @@ -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 diff --git a/share/extensions/motion.py b/share/extensions/motion.py index 88e545c8b..5e0e73731 100755 --- a/share/extensions/motion.py +++ b/share/extensions/motion.py @@ -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 diff --git a/share/extensions/pathalongpath.py b/share/extensions/pathalongpath.py index f02a69d50..917bc665b 100644 --- a/share/extensions/pathalongpath.py +++ b/share/extensions/pathalongpath.py @@ -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 diff --git a/share/extensions/pathscatter.py b/share/extensions/pathscatter.py index 0ce095877..20623de6a 100644 --- a/share/extensions/pathscatter.py +++ b/share/extensions/pathscatter.py @@ -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 diff --git a/share/extensions/perfectboundcover.py b/share/extensions/perfectboundcover.py index 0e0231a50..694040434 100644 --- a/share/extensions/perfectboundcover.py +++ b/share/extensions/perfectboundcover.py @@ -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 diff --git a/share/extensions/perspective.py b/share/extensions/perspective.py index 26a23dc0a..53b1a9149 100755 --- a/share/extensions/perspective.py +++ b/share/extensions/perspective.py @@ -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 diff --git a/share/extensions/polyhedron_3d.py b/share/extensions/polyhedron_3d.py index cbb74d435..006d16d6b 100644 --- a/share/extensions/polyhedron_3d.py +++ b/share/extensions/polyhedron_3d.py @@ -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 diff --git a/share/extensions/radiusrand.py b/share/extensions/radiusrand.py index 0e352f56a..15b816853 100755 --- a/share/extensions/radiusrand.py +++ b/share/extensions/radiusrand.py @@ -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 diff --git a/share/extensions/render_alphabetsoup.py b/share/extensions/render_alphabetsoup.py index e3f64fc07..f741eaa57 100644 --- a/share/extensions/render_alphabetsoup.py +++ b/share/extensions/render_alphabetsoup.py @@ -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() diff --git a/share/extensions/render_barcode.py b/share/extensions/render_barcode.py index 590e55b86..77cb3135b 100644 --- a/share/extensions/render_barcode.py +++ b/share/extensions/render_barcode.py @@ -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() diff --git a/share/extensions/restack.py b/share/extensions/restack.py index b04c9d4b0..1f61bd3af 100644 --- a/share/extensions/restack.py +++ b/share/extensions/restack.py @@ -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 diff --git a/share/extensions/rtree.py b/share/extensions/rtree.py index d26eb2566..ddd0078d0 100755 --- a/share/extensions/rtree.py +++ b/share/extensions/rtree.py @@ -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 diff --git a/share/extensions/rubberstretch.py b/share/extensions/rubberstretch.py index 742101a13..5426ea3c9 100644 --- a/share/extensions/rubberstretch.py +++ b/share/extensions/rubberstretch.py @@ -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 diff --git a/share/extensions/spirograph.py b/share/extensions/spirograph.py index c276a826e..9dbf0dcea 100644 --- a/share/extensions/spirograph.py +++ b/share/extensions/spirograph.py @@ -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 diff --git a/share/extensions/straightseg.py b/share/extensions/straightseg.py index f6460f2d5..16db996fc 100755 --- a/share/extensions/straightseg.py +++ b/share/extensions/straightseg.py @@ -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 diff --git a/share/extensions/summersnight.py b/share/extensions/summersnight.py index 9dc9a0722..f3d9811c4 100755 --- a/share/extensions/summersnight.py +++ b/share/extensions/summersnight.py @@ -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 diff --git a/share/extensions/svg_and_media_zip_output.py b/share/extensions/svg_and_media_zip_output.py index 74311b431..001d5b0f8 100644 --- a/share/extensions/svg_and_media_zip_output.py +++ b/share/extensions/svg_and_media_zip_output.py @@ -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 diff --git a/share/extensions/triangle.py b/share/extensions/triangle.py index 4becf7b88..965de243e 100644 --- a/share/extensions/triangle.py +++ b/share/extensions/triangle.py @@ -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 diff --git a/share/extensions/whirl.py b/share/extensions/whirl.py index 32e55b291..4c5db2262 100644 --- a/share/extensions/whirl.py +++ b/share/extensions/whirl.py @@ -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