Code

share/extension/*.py: noop: minor whitespace regularizations ahead of adding vim...
authorpjrm <pjrm@users.sourceforge.net>
Fri, 23 May 2008 06:15:31 +0000 (06:15 +0000)
committerpjrm <pjrm@users.sourceforge.net>
Fri, 23 May 2008 06:15:31 +0000 (06:15 +0000)
18 files changed:
share/extensions/bezmisc.py
share/extensions/coloreffect.py
share/extensions/cubicsuperpath.py
share/extensions/eqtexsvg.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/lindenmayer.py
share/extensions/perfectboundcover.py
share/extensions/polyhedron_3d.py
share/extensions/restack.py
share/extensions/simpletransform.py
share/extensions/spirograph.py
share/extensions/svg_and_media_zip_output.py
share/extensions/text_replace.py

index f52fb672803af7228a7e6a7fd5649d28e988e5c9..7faf691845377b53c19911ac280a71740bd85b81 100755 (executable)
@@ -22,7 +22,7 @@ import math, cmath
 def rootWrapper(a,b,c,d):
     if a:
         #TODO: find a new cubic solver and put it here
-          #return solveCubicMonic(b/a,c/a,d/a)
+        #return solveCubicMonic(b/a,c/a,d/a)
         return ()
     elif b:
         det=c**2.0-4.0*b*d
index 5c0c93b4bec802aa744b5aff63ab121409aad9f2..c32df4d8de5beda33103508caa4a8f15b86dc771 100644 (file)
@@ -73,7 +73,7 @@ class ColorEffect(inkex.Effect):
     return col
 
   def process_gradient(self, node, newid):
-    #if node.hasAttributes():                          
+    #if node.hasAttributes():
        #this_id=node.getAttribute('id')
        #if this_id in self.visited:
          ## prevent multiple processing of the same gradient if it is used by more than one selected object
index cc59905abc03fd7a9e74db0b4a629474dc182c75..2e7ae50885747fcf3c5aec4c5bd26f6711643db5 100755 (executable)
@@ -77,7 +77,7 @@ def ArcToPath(p1,params):
     #v=dTeta*2/pi*0.552
     v=dTeta*2/pi*4*(sqrt(2)-1)/3
     #if not sweepflag:
-    #  v*=-1
+    #    v*=-1
     p=[]
     for i in range(0,NbSectors+1,1):
         angle=start+i*dTeta
index 3dd09c28c74b953caf74f7343d07081fa825da5c..7cbe8ebfd65d122c1b74f4045f5dd80f22a4ffe5 100644 (file)
@@ -105,10 +105,10 @@ class EQTEXSVG(inkex.Effect):
         create_equation_tex(latex_file, self.options.formula)
         os.system('latex "-output-directory=%s" -halt-on-error "%s" > "%s"' \
                   % (base_dir, latex_file, out_file))
-       try:
-           os.stat(dvi_file)
-       except OSError:
-           print >>sys.stderr, "invalid LaTeX input:"
+        try:
+            os.stat(dvi_file)
+        except OSError:
+            print >>sys.stderr, "invalid LaTeX input:"
             print >>sys.stderr, self.options.formula
             print >>sys.stderr, "temporary files were left in:", base_dir
             sys.exit(1)
index 2ebd9636517d7f0982233dd553ac4fa449f0c2a0..3e6f5df050858651f4ad0df4bba1c3a3b4efc781 100755 (executable)
@@ -28,11 +28,11 @@ def calculateSubdivision(x1,y1,x2,y2,smoothness):
     """ Calculate normalized vector perpendicular to the vector (x3,y3) """
     length = math.sqrt(x3*x3 + y3*y3)
     if length != 0:
-      nx = -y3/length
-      ny = x3/length
+        nx = -y3/length
+        ny = x3/length
     else:
-      nx = 1
-      ny = 0
+        nx = 1
+        ny = 0
     """ Scale perpendicular vector by random factor """
     r = random.uniform(-length/(1+smoothness),length/(1+smoothness))
     nx = nx * r
index 24d6951b3518fb722fe61c59cb6972c47d75617e..6abdd9c40af1f278d4ef775569cd068d3cf5aa17 100644 (file)
@@ -99,10 +99,10 @@ def drawfunction(xstart, xend, ybottom, ytop, samples, width, height, left, bott
     x0 =   xstart
     y0 = f(xstart)
     if polar :
-      xp0 = y0 * cos( x0 )
-      yp0 = y0 * sin( x0 )
-      x0 = xp0
-      y0 = yp0
+        xp0 = y0 * cos( x0 )
+        yp0 = y0 * sin( x0 )
+        x0 = xp0
+        y0 = yp0
     if fponum or polar: # numerical derivative, using 0.001*step as the small differential
         x1 = xstart + ds # Second point AFTER first point (Good for first point)
         y1 = f(x1)
index 17fea40f8bf108a9ce5d1d30f758b59fc2d76fa8..6683d12e979019f96148be5e37ec91f930d0a51e 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python 
+#! /usr/bin/env python
 '''
 Copyright (C) 2007 Aaron Spike  (aaron @ ekips.org)
 Copyright (C) 2007 Tavmjong Bah (tavmjong @ free.fr)
@@ -44,19 +44,19 @@ class Gears(inkex.Effect):
     def __init__(self):
         inkex.Effect.__init__(self)
         self.OptionParser.add_option("-t", "--teeth",
-                        action="store", type="int", 
+                        action="store", type="int",
                         dest="teeth", default=24,
                         help="Number of teeth")
         self.OptionParser.add_option("-p", "--pitch",
-                        action="store", type="float", 
+                        action="store", type="float",
                         dest="pitch", default=20.0,
                         help="Circular Pitch (length of arc from one tooth to next)")
         self.OptionParser.add_option("-a", "--angle",
-                        action="store", type="float", 
+                        action="store", type="float",
                         dest="angle", default=20.0,
                         help="Pressure Angle (common values: 14.5, 20, 25 degrees)")
     def effect(self):
-    
+
         teeth = self.options.teeth
         pitch = self.options.pitch
         angle = self.options.angle  # Angle of tangent to tooth at circular pitch wrt radial line.
@@ -64,85 +64,85 @@ class Gears(inkex.Effect):
         # print >>sys.stderr, "Teeth: %s\n"        % teeth
 
         two_pi = 2.0 * pi
-        
+
         # Pitch (circular pitch): Length of the arc from one tooth to the next)
         # Pitch diameter: Diameter of pitch circle.
         pitch_diameter = float( teeth ) * pitch / pi
         pitch_radius   = pitch_diameter / 2.0
-       
+
         # Base Circle
         base_diameter = pitch_diameter * cos( radians( angle ) )
         base_radius   = base_diameter / 2.0
-    
+
         # Diametrial pitch: Number of teeth per unit length.
         pitch_diametrial = float( teeth )/ pitch_diameter
 
         # Addendum: Radial distance from pitch circle to outside circle.
         addendum = 1.0 / pitch_diametrial
-    
+
         # Outer Circle
         outer_radius = pitch_radius + addendum
         outer_diameter = outer_radius * 2.0
-    
+
         # Tooth thickness: Tooth width along pitch circle.
         tooth  = ( pi * pitch_diameter ) / ( 2.0 * float( teeth ) )
-    
+
         # Undercut?
         undercut = (2.0 / ( sin( radians( angle ) ) ** 2))
         needs_undercut = teeth < undercut
 
-    
+
         # Clearance: Radial distance between top of tooth on one gear to bottom of gap on another.
         clearance = 0.0
 
         # Dedendum: Radial distance from pitch circle to root diameter.
         dedendum = addendum + clearance
-    
+
         # Root diameter: Diameter of bottom of tooth spaces. 
         root_radius =  pitch_radius - dedendum
         root_diameter = root_radius * 2.0
-    
+
         half_thick_angle = two_pi / (4.0 * float( teeth ) )
         pitch_to_base_angle  = involute_intersect_angle( base_radius, pitch_radius )
         pitch_to_outer_angle = involute_intersect_angle( base_radius, outer_radius ) - pitch_to_base_angle
-    
+
         centers = [(x * two_pi / float( teeth) ) for x in range( teeth ) ]
-    
+
         points = []
 
         for c in centers:
 
-             # Angles
-             pitch1 = c - half_thick_angle
-             base1  = pitch1 - pitch_to_base_angle
-             outer1 = pitch1 + pitch_to_outer_angle
-        
-             pitch2 = c + half_thick_angle
-             base2  = pitch2 + pitch_to_base_angle
-             outer2 = pitch2 - pitch_to_outer_angle
-        
-             # Points
-             b1 = point_on_circle( base_radius,  base1  )
-             p1 = point_on_circle( pitch_radius, pitch1 )
-             o1 = point_on_circle( outer_radius, outer1 )
-
-             b2 = point_on_circle( base_radius,  base2  )
-             p2 = point_on_circle( pitch_radius, pitch2 )
-             o2 = point_on_circle( outer_radius, outer2 )
-
-             if root_radius > base_radius:
-                 pitch_to_root_angle = pitch_to_base_angle - involute_intersect_angle(base_radius, root_radius )
-                 root1 = pitch1 - pitch_to_root_angle
-                 root2 = pitch2 + pitch_to_root_angle
-                 r1 = point_on_circle(root_radius, root1)
-                 r2 = point_on_circle(root_radius, root2)
-                 p_tmp = [r1,p1,o1,o2,p2,r2]
-             else:
-                 r1 = point_on_circle(root_radius, base1)
-                 r2 = point_on_circle(root_radius, base2)
-                 p_tmp = [r1,b1,p1,o1,o2,p2,b2,r2]
-            
-             points.extend( p_tmp )
+            # Angles
+            pitch1 = c - half_thick_angle
+            base1  = pitch1 - pitch_to_base_angle
+            outer1 = pitch1 + pitch_to_outer_angle
+
+            pitch2 = c + half_thick_angle
+            base2  = pitch2 + pitch_to_base_angle
+            outer2 = pitch2 - pitch_to_outer_angle
+
+            # Points
+            b1 = point_on_circle( base_radius,  base1  )
+            p1 = point_on_circle( pitch_radius, pitch1 )
+            o1 = point_on_circle( outer_radius, outer1 )
+
+            b2 = point_on_circle( base_radius,  base2  )
+            p2 = point_on_circle( pitch_radius, pitch2 )
+            o2 = point_on_circle( outer_radius, outer2 )
+
+            if root_radius > base_radius:
+                pitch_to_root_angle = pitch_to_base_angle - involute_intersect_angle(base_radius, root_radius )
+                root1 = pitch1 - pitch_to_root_angle
+                root2 = pitch2 + pitch_to_root_angle
+                r1 = point_on_circle(root_radius, root1)
+                r2 = point_on_circle(root_radius, root2)
+                p_tmp = [r1,p1,o1,o2,p2,r2]
+            else:
+                r1 = point_on_circle(root_radius, base1)
+                r2 = point_on_circle(root_radius, base2)
+                p_tmp = [r1,b1,p1,o1,o2,p2,b2,r2]
+
+                    points.extend( p_tmp )
 
         path = points_to_svgd( points )
 
@@ -150,7 +150,7 @@ class Gears(inkex.Effect):
         #  Translate group, Rotate path.
         t = 'translate(' + str( self.view_center[0] ) + ',' + str( self.view_center[1] ) + ')'
         g_attribs = {inkex.addNS('label','inkscape'):'Gear' + str( teeth ),
-                   'transform':t }
+                     'transform':t }
         g = inkex.etree.SubElement(self.current_layer, 'g', g_attribs)
 
         # Create SVG Path for gear
index 28cb8c3922e3989ca8fbbcca9c972ab26e862d22..3a0ee47c4c59266ae896d8ba8b08d380b75227d7 100755 (executable)
@@ -40,7 +40,7 @@ class MyEffect(inkex.Effect):
 
         #create os temp dir
         tmp_dir = tempfile.mkdtemp()
-       
+
        hGuides = []
        vGuides = []
        if self.options.saveGuides:
@@ -60,10 +60,10 @@ class MyEffect(inkex.Effect):
                                #GIMP doesn't like guides that are outside of the image
                                if pos > 0 and pos < pageWidth:
                                        vGuides.append(str(pos))
-       
+
        hGList = ' '.join(hGuides)
        vGList = ' '.join(vGuides)
-       
+
        gridSpacingFunc = ''
        gridOriginFunc = '' 
        #GIMP only allows one rectangular grid
@@ -73,13 +73,13 @@ class MyEffect(inkex.Effect):
                        #these attributes could be nonexistant
                        spacingX = gridNode.get('spacingx')
                        if spacingX == None: spacingX = '1  '
-                               
+
                        spacingY = gridNode.get('spacingy')
                        if spacingY == None: spacingY = '1  '
-                               
+
                        originX = gridNode.get('originx')
                        if originX == None: originX = '0  '
-                       
+
                        originY = gridNode.get('originy')
                        if originY == None: originY = '0  '
 
@@ -139,14 +139,14 @@ class MyEffect(inkex.Effect):
     )
     '(%s)
   )
-  
+
   (for-each
     (lambda (vGuide)
       (gimp-image-add-vguide img vGuide)
     )
     '(%s)
   )
-  
+
   %s
   %s
 
index b996d6e849437a2c74dd6322de18f8c1d03f4b5a..968212e083137b68e8bbf2e9dd5ae694010af20e 100644 (file)
@@ -133,7 +133,7 @@ class Grid_Polar(inkex.Effect):
                            str( self.view_center[1]- ymax/2.0) + ')'
         g_attribs = {inkex.addNS('label','inkscape'):'Grid_Polar:X' + \
                      str( self.options.x_divs )+':Y'+str( self.options.y_divs ),
-                    'transform':t }
+                     'transform':t }
         grid = inkex.etree.SubElement(self.current_layer, 'g', g_attribs)
         
         #Group for major x gridlines
index 9da5017aa93d00e861fc2d83044a0df6236cde88..1d60b4bd3066d0580b8c6ba6eed9853eb81b02a3 100644 (file)
@@ -125,7 +125,7 @@ class Grid_Polar(inkex.Effect):
         t = 'translate(' + str( self.view_center[0] ) + ',' + str( self.view_center[1] ) + ')'
         g_attribs = {inkex.addNS('label','inkscape'):'Grid_Polar:R' +
                                  str( self.options.r_divs )+':A'+str( self.options.a_divs ),
-                   'transform':t }
+                     'transform':t }
         grid = inkex.etree.SubElement(self.current_layer, 'g', g_attribs)
 
         dr = self.options.dr                        #Distance between neighbouring circles
@@ -135,19 +135,19 @@ class Grid_Polar(inkex.Effect):
         #Create SVG circles
         for i in range(1, self.options.r_divs+1):
             draw_SVG_circle(i*dr, 0, 0, #major div circles
-                             self.options.r_divs_th, 'none',
-                             'MajorDivCircle'+str(i)+':R'+str(i*dr), grid)
+                            self.options.r_divs_th, 'none',
+                            'MajorDivCircle'+str(i)+':R'+str(i*dr), grid)
             
             if self.options.r_log: #logarithmic subdivisions
                 for j in range (2, self.options.r_subdivs):
                     draw_SVG_circle(i*dr-(1-log(j, self.options.r_subdivs))*dr, #minor div circles
                                     0, 0, self.options.r_subdivs_th, 'none',
-                                     'MinorDivCircle'+str(i)+':Log'+str(j), grid)
+                                    'MinorDivCircle'+str(i)+':Log'+str(j), grid)
             else: #linear subdivs
                 for j in range (1, self.options.r_subdivs):
                     draw_SVG_circle(i*dr-j*dr/self.options.r_subdivs, #minor div circles
-                                     0, 0, self.options.r_subdivs_th, 'none',
-                                     'MinorDivCircle'+str(i)+':R'+str(i*dr), grid)
+                                    0, 0, self.options.r_subdivs_th, 'none',
+                                    'MinorDivCircle'+str(i)+':R'+str(i*dr), grid)
         
         if self.options.a_divs == self.options.a_divs_cent: #the lines can go from the centre to the edge
             for i in range(0, self.options.a_divs):
@@ -177,7 +177,7 @@ class Grid_Polar(inkex.Effect):
         
         if self.options.c_dot_dia <> 0: #if a non-zero diameter, draw the centre dot
             draw_SVG_circle(self.options.c_dot_dia /2.0,
-                             0, 0, 0, '#000000', 'CentreDot', grid)
+                            0, 0, 0, '#000000', 'CentreDot', grid)
         
         if self.options.a_labels == 'deg':
             label_radius = rmax+self.options.a_label_outset  #radius of label centres
index 5912201d2b4562a75dcb74667c4b607feaada4f0..e43e167b64f846b232bbc643c06309f7a0d6a55a 100755 (executable)
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 import inkex, simplestyle, pturtle, random
 
 def stripme(s):
-    return s.strip()   
+    return s.strip()
 
 class LSystem(inkex.Effect):
     def __init__(self):
index 71558af742db5375bcc50b2cbd484476e6051def..6295f64685c5f1be96f13a3454410c4c8a448425 100644 (file)
@@ -19,13 +19,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 import sys, inkex
 
 def caliper_to_ppi(caliper):
-  return 2 / caliper
+    return 2 / caliper
 
 def bond_weight_to_ppi(bond_weight):
-  return caliper_to_ppi(bond_weight * .0002)
+    return caliper_to_ppi(bond_weight * .0002)
 
 def points_to_ppi(points):
-  return caliper_to_ppi(points / 1000.0)
+    return caliper_to_ppi(points / 1000.0)
 
 class PerfectBoundCover(inkex.Effect):
     def __init__(self):
index d6bf2c5dabcc420deb367641fd50df888f7b6af9..a2605499afc2511578b4f2c6f532fd6115c0f9a1 100644 (file)
@@ -424,7 +424,7 @@ class Poly_3D(inkex.Effect):
                                                                      so.r1_ax+str('%.2f'%so.r4_ang)+':'+
                                                                      so.r2_ax+str('%.2f'%so.r5_ang)+':'+
                                                                      so.r3_ax+str('%.2f'%so.r6_ang),
-                    'transform':t }
+                        'transform':t }
         proj = inkex.etree.SubElement(self.current_layer, 'g', proj_attribs)#the group to put everything in
         
         vp_pts=[] #the points as projected in the z-axis onto the viewplane
index 8623bb1031834d073cfdd4d878cb127e70758023..10510eb0bf3efdcf160e84336dafd4060fc1a999 100644 (file)
@@ -49,24 +49,24 @@ class Restack(inkex.Effect):
 
             file = self.args[ -1 ]
             #get all bounding boxes in file by calling inkscape again with the --querry-all command line option
-                       #it returns a comma seperated list structured id,x,y,w,h
+            #it returns a comma seperated list structured id,x,y,w,h
             _,f,err = os.popen3( "inkscape --query-all %s" % ( file ) )
             reader=csv.reader( f.readlines() )
             f.close()
             err.close()
-                       
+
             #build a dictionary with id as the key
             dimen = dict()
             for line in reader:
                 dimen[line[0]] = map( float, line[1:])
-                               
-                       #find the center of all selected objects **Not the average!     
+
+            #find the center of all selected objects **Not the average!
             x,y,w,h = dimen[self.selected.keys()[0]]
             minx = x
             miny = y
             maxx = x + w
             maxy = y + h
-                       
+
             for id, node in self.selected.iteritems():
                 # get the bounding box
                 x,y,w,h = dimen[id]
@@ -77,16 +77,16 @@ class Restack(inkex.Effect):
                 if y < miny:
                     miny = y
                 if (y + h) > maxy:
-                    maxy = y + h                               
+                    maxy = y + h
 
             midx = (minx + maxx) / 2
             midy = (miny + maxy) / 2
-                       
+
             #calculate distances fro each selected object
             for id, node in self.selected.iteritems():
                 # get the bounding box
                 x,y,w,h = dimen[id]
-                
+
                 # calc the comparison coords
                 if self.options.xanchor == "l":
                     cx = x
@@ -101,25 +101,25 @@ class Restack(inkex.Effect):
                     cy = y + h
                 else:  # middle
                     cy = y + h / 2
-                               
+
                 #direction chosen
                 if self.options.direction == "tb" or self.options.angle == 270:
-                           objlist.append([cy,id])
+                    objlist.append([cy,id])
                 elif self.options.direction == "bt" or self.options.angle == 90:
-                           objlist.append([-cy,id])
+                    objlist.append([-cy,id])
                 elif self.options.direction == "lr" or self.options.angle == 0 or self.options.angle == 360:
-                           objlist.append([cx,id])
+                    objlist.append([cx,id])
                 elif self.options.direction == "rl" or self.options.angle == 180:
-                           objlist.append([-cx,id])                    
+                    objlist.append([-cx,id])
                 elif self.options.direction == "aa":
                     distance = math.hypot(cx,cy)*(math.cos(math.radians(-self.options.angle)-math.atan2(cy, cx)))
-                           objlist.append([distance,id])
+                    objlist.append([distance,id])
                 elif self.options.direction == "ro":
                     distance = math.hypot(midx - cx, midy - cy)
-                           objlist.append([distance,id])
+                    objlist.append([distance,id])
                 elif self.options.direction == "ri":
                     distance = -math.hypot(midx - cx, midy - cy)
-                           objlist.append([distance,id])
+                    objlist.append([distance,id])
 
             objlist.sort()
             #move them to the top of the object stack in this order.
index 4e4de301946dbd9479d9f0c417c029c367d93e60..360536e6d5bd2504db6f0b21f17aca7618b7c913 100644 (file)
@@ -130,14 +130,14 @@ def boxunion(b1,b2):
         return((min(b1[0],b2[0]),max(b1[1],b2[1]),min(b1[2],b2[2]),max(b1[3],b2[3])))
 
 def roughBBox(path):
-    xmin,xMax,ymin,yMax=path[0][0][0][0],path[0][0][0][0],path[0][0][0][1],path[0][0][0][1]
+    xmin,xMax,ymin,yMax = path[0][0][0][0],path[0][0][0][0],path[0][0][0][1],path[0][0][0][1]
     for pathcomp in path:
         for ctl in pathcomp:
-           for pt in ctl:
-               xmin=min(xmin,pt[0])
-               xMax=max(xMax,pt[0])
-               ymin=min(ymin,pt[1])
-               yMax=max(yMax,pt[1])
+            for pt in ctl:
+                xmin = min(xmin,pt[0])
+                xMax = max(xMax,pt[0])
+                ymin = min(ymin,pt[1])
+                yMax = max(yMax,pt[1])
     return xmin,xMax,ymin,yMax
 
 def computeBBox(aList,mat=[[1,0,0],[0,1,0]]):
index 8ed297849707771ea3d6a014cc726e64e29e4e50..3ac3565106921fb4c0fd1ce502c26b8723377765 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python 
+#! /usr/bin/env python
 '''
 Copyright (C) 2007 Joel Holdsworth joel@airwebreathe.org.uk
 
@@ -22,31 +22,32 @@ class Spirograph(inkex.Effect):
     def __init__(self):
         inkex.Effect.__init__(self)
         self.OptionParser.add_option("-R", "--primaryr",
-                        action="store", type="float", 
+                        action="store", type="float",
                         dest="primaryr", default=60.0,
                         help="The radius of the outer gear")
         self.OptionParser.add_option("-r", "--secondaryr",
-                        action="store", type="float", 
+                        action="store", type="float",
                         dest="secondaryr", default=100.0,
                         help="The radius of the inner gear")
         self.OptionParser.add_option("-d", "--penr",
-                        action="store", type="float", 
+                        action="store", type="float",
                         dest="penr", default=50.0,
                         help="The distance of the pen from the inner gear")
         self.OptionParser.add_option("-p", "--gearplacement",
-                        action="store", type="string", 
+                        action="store", type="string",
                         dest="gearplacement", default=50.0,
                         help="Selects whether the gear is inside or outside the ring")
         self.OptionParser.add_option("-a", "--rotation",
-                        action="store", type="float", 
+                        action="store", type="float",
                         dest="rotation", default=0.0,
-                        help="The number of degrees to rotate the image by")                        
+                        help="The number of degrees to rotate the image by")
         self.OptionParser.add_option("-q", "--quality",
-                        action="store", type="int", 
+                        action="store", type="int",
                         dest="quality", default=16,
-                        help="The quality of the calculated output")                       
+                        help="The quality of the calculated output")
+
     def effect(self):
-    
+
         if self.options.secondaryr == 0:
             return
         if self.options.quality == 0:
@@ -58,42 +59,42 @@ class Spirograph(inkex.Effect):
         else:
             a = self.options.primaryr - self.options.secondaryr
             flip = 1
-        
+
         ratio = a / self.options.secondaryr
         if ratio == 0:
             return
         scale = 2 * math.pi / (ratio * self.options.quality)
-        
+
         rotation = - math.pi * self.options.rotation / 180;
-        
+
         new = inkex.etree.Element(inkex.addNS('path','svg'))
         s = { 'stroke': '#000000', 'fill': 'none' }
         new.set('style', simplestyle.formatStyle(s))
-        
+
         pathString = ''
         maxPointCount = 1000
-        
+
         for i in range(maxPointCount):
 
             theta = i * scale
-           
+
             x = a * math.cos(theta + rotation) + \
                 self.options.penr * math.cos(ratio * theta + rotation) * flip + \
                 self.view_center[0]
             y = a * math.sin(theta + rotation) - \
                 self.options.penr * math.sin(ratio * theta + rotation) + \
                 self.view_center[1]
-                
+
             dx = (-a * math.sin(theta + rotation) - \
                 ratio * self.options.penr * math.sin(ratio * theta + rotation) * flip) * scale / 3
             dy = (a * math.cos(theta + rotation) - \
                 ratio * self.options.penr * math.cos(ratio * theta + rotation)) * scale / 3
-            
+
             if i <= 0:
                 pathString += 'M ' + str(x) + ',' + str(y) + ' C ' + str(x + dx) + ',' + str(y + dy) + ' '
             else:
                 pathString += str(x - dx) + ',' + str(y - dy) + ' ' + str(x) + ',' + str(y)
-                    
+
                 if math.fmod(i / ratio, self.options.quality) == 0 and i % self.options.quality == 0:
                     pathString += 'Z'
                     break
@@ -102,8 +103,8 @@ class Spirograph(inkex.Effect):
                         pass # we reached the allowed maximum of points, stop here
                     else:
                         pathString += ' C ' + str(x + dx) + ',' + str(y + dy) + ' '
-                    
-        
+
+
         new.set('d', pathString)
         self.current_layer.append(new)
 
index 29add99e3dc4c90bc1b1a68be708d4623ace6ac1..ddc1c2deaa642a1ba3f25762ca06232b7e440fd4 100644 (file)
@@ -1,7 +1,7 @@
-#!/usr/bin/env python 
+#! /usr/bin/env python
 """
 svg_and_media_zip_output.py
-An extention which collects all images to the documents directory and 
+An extention which collects all images to the documents directory and
 creates a zip archive containing all images and the document
 
 Copyright (C) 2005 Pim Snel, pim@lingewoud.com
@@ -28,7 +28,7 @@ Version 0.3
 TODO
 - fix bug: not saving existing .zip after a Collect for Output is run
      this bug occurs because after running an effect extention the inkscape:output_extension is reset to svg.inkscape
-     the file name is still xxx.zip. after saving again the file xxx.zip is written with a plain .svg which 
+     the file name is still xxx.zip. after saving again the file xxx.zip is written with a plain .svg which
      looks like a corrupt zip
 - maybe add better extention
 """
@@ -50,7 +50,7 @@ class MyEffect(inkex.Effect):
 
     def effect(self):
         ttmp_orig = self.document.getroot()
-        
+
         docbase = ttmp_orig.get(inkex.addNS('docbase',u'sodipodi'),'')
         docname = ttmp_orig.get(inkex.addNS('docname',u'sodipodi'))
 
index 0d6e501f57713e7e442a42fa357c67ad10932ae9..6fb08cd279728662eb5b41fbd094db37cd4e1bc9 100644 (file)
@@ -5,7 +5,7 @@ class C(chardataeffect.CharDataEffect):
     chardataeffect.CharDataEffect.__init__(self)
     self.OptionParser.add_option("-f", "--from_text", action="store", type="string", dest="from_text", default="", help="Replace")
     self.OptionParser.add_option("-t", "--to_text", action="store", type="string", dest="to_text", default="", help="by")
-             
+
   def process_chardata(self,text, line, par):
     fr = self.options.from_text.strip('"').replace('\$','$')
     to = self.options.to_text.strip('"').replace('\$','$')