From 8db8b3d85d2f91e5429d9bb407d0babcfe44518b Mon Sep 17 00:00:00 2001 From: pjrm Date: Fri, 23 May 2008 06:15:31 +0000 Subject: [PATCH] share/extension/*.py: noop: minor whitespace regularizations ahead of adding vim modelines --- share/extensions/bezmisc.py | 2 +- share/extensions/coloreffect.py | 2 +- share/extensions/cubicsuperpath.py | 2 +- share/extensions/eqtexsvg.py | 8 +- share/extensions/fractalize.py | 8 +- share/extensions/funcplot.py | 8 +- share/extensions/gears.py | 96 ++++++++++---------- share/extensions/gimp_xcf.py | 16 ++-- share/extensions/grid_cartesian.py | 2 +- share/extensions/grid_polar.py | 14 +-- share/extensions/lindenmayer.py | 2 +- share/extensions/perfectboundcover.py | 6 +- share/extensions/polyhedron_3d.py | 2 +- share/extensions/restack.py | 32 +++---- share/extensions/simpletransform.py | 12 +-- share/extensions/spirograph.py | 43 ++++----- share/extensions/svg_and_media_zip_output.py | 8 +- share/extensions/text_replace.py | 2 +- 18 files changed, 133 insertions(+), 132 deletions(-) diff --git a/share/extensions/bezmisc.py b/share/extensions/bezmisc.py index f52fb6728..7faf69184 100755 --- a/share/extensions/bezmisc.py +++ b/share/extensions/bezmisc.py @@ -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 diff --git a/share/extensions/coloreffect.py b/share/extensions/coloreffect.py index 5c0c93b4b..c32df4d8d 100644 --- a/share/extensions/coloreffect.py +++ b/share/extensions/coloreffect.py @@ -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 diff --git a/share/extensions/cubicsuperpath.py b/share/extensions/cubicsuperpath.py index cc59905ab..2e7ae5088 100755 --- a/share/extensions/cubicsuperpath.py +++ b/share/extensions/cubicsuperpath.py @@ -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 diff --git a/share/extensions/eqtexsvg.py b/share/extensions/eqtexsvg.py index 3dd09c28c..7cbe8ebfd 100644 --- a/share/extensions/eqtexsvg.py +++ b/share/extensions/eqtexsvg.py @@ -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) diff --git a/share/extensions/fractalize.py b/share/extensions/fractalize.py index 2ebd96365..3e6f5df05 100755 --- a/share/extensions/fractalize.py +++ b/share/extensions/fractalize.py @@ -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 diff --git a/share/extensions/funcplot.py b/share/extensions/funcplot.py index 24d6951b3..6abdd9c40 100644 --- a/share/extensions/funcplot.py +++ b/share/extensions/funcplot.py @@ -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) diff --git a/share/extensions/gears.py b/share/extensions/gears.py index 17fea40f8..6683d12e9 100644 --- a/share/extensions/gears.py +++ b/share/extensions/gears.py @@ -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 diff --git a/share/extensions/gimp_xcf.py b/share/extensions/gimp_xcf.py index 28cb8c392..3a0ee47c4 100755 --- a/share/extensions/gimp_xcf.py +++ b/share/extensions/gimp_xcf.py @@ -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 diff --git a/share/extensions/grid_cartesian.py b/share/extensions/grid_cartesian.py index b996d6e84..968212e08 100644 --- a/share/extensions/grid_cartesian.py +++ b/share/extensions/grid_cartesian.py @@ -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 diff --git a/share/extensions/grid_polar.py b/share/extensions/grid_polar.py index 9da5017aa..1d60b4bd3 100644 --- a/share/extensions/grid_polar.py +++ b/share/extensions/grid_polar.py @@ -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 diff --git a/share/extensions/lindenmayer.py b/share/extensions/lindenmayer.py index 5912201d2..e43e167b6 100755 --- a/share/extensions/lindenmayer.py +++ b/share/extensions/lindenmayer.py @@ -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): diff --git a/share/extensions/perfectboundcover.py b/share/extensions/perfectboundcover.py index 71558af74..6295f6468 100644 --- a/share/extensions/perfectboundcover.py +++ b/share/extensions/perfectboundcover.py @@ -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): diff --git a/share/extensions/polyhedron_3d.py b/share/extensions/polyhedron_3d.py index d6bf2c5da..a2605499a 100644 --- a/share/extensions/polyhedron_3d.py +++ b/share/extensions/polyhedron_3d.py @@ -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 diff --git a/share/extensions/restack.py b/share/extensions/restack.py index 8623bb103..10510eb0b 100644 --- a/share/extensions/restack.py +++ b/share/extensions/restack.py @@ -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. diff --git a/share/extensions/simpletransform.py b/share/extensions/simpletransform.py index 4e4de3019..360536e6d 100644 --- a/share/extensions/simpletransform.py +++ b/share/extensions/simpletransform.py @@ -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]]): diff --git a/share/extensions/spirograph.py b/share/extensions/spirograph.py index 8ed297849..3ac356510 100644 --- a/share/extensions/spirograph.py +++ b/share/extensions/spirograph.py @@ -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) diff --git a/share/extensions/svg_and_media_zip_output.py b/share/extensions/svg_and_media_zip_output.py index 29add99e3..ddc1c2dea 100644 --- a/share/extensions/svg_and_media_zip_output.py +++ b/share/extensions/svg_and_media_zip_output.py @@ -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')) diff --git a/share/extensions/text_replace.py b/share/extensions/text_replace.py index 0d6e501f5..6fb08cd27 100644 --- a/share/extensions/text_replace.py +++ b/share/extensions/text_replace.py @@ -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('\$','$') -- 2.30.2