diff options
| author | Alvin Penner <penner@vaxxine.com> | 2014-02-08 00:16:27 +0000 |
|---|---|---|
| committer | apenner <penner@vaxxine.com> | 2014-02-08 00:16:27 +0000 |
| commit | 71cc176ac4cd1da4ef5ad3a5b50ddb8f71098695 (patch) | |
| tree | 507af11892e47927ff87752320cc84d0ca9b4857 | |
| parent | Fix for Bug #1275443 (Including picture results in crash). (diff) | |
| download | inkscape-71cc176ac4cd1da4ef5ad3a5b50ddb8f71098695.tar.gz inkscape-71cc176ac4cd1da4ef5ad3a5b50ddb8f71098695.zip | |
Extensions->Render submenu. Scaling of input parameters into document units, Part 2 (Bug 1240455)
Fixed bugs:
- https://launchpad.net/bugs/1240455
(bzr r13007)
| -rwxr-xr-x | share/extensions/grid_cartesian.py | 12 | ||||
| -rwxr-xr-x | share/extensions/grid_isometric.py | 6 | ||||
| -rwxr-xr-x | share/extensions/grid_polar.py | 11 | ||||
| -rwxr-xr-x | share/extensions/guides_creator.py | 4 | ||||
| -rwxr-xr-x | share/extensions/lindenmayer.py | 3 | ||||
| -rwxr-xr-x | share/extensions/rtree.py | 4 | ||||
| -rwxr-xr-x | share/extensions/spirograph.py | 5 | ||||
| -rwxr-xr-x | share/extensions/triangle.py | 7 | ||||
| -rwxr-xr-x | share/extensions/wireframe_sphere.py | 3 |
9 files changed, 45 insertions, 10 deletions
diff --git a/share/extensions/grid_cartesian.py b/share/extensions/grid_cartesian.py index 85716a6fd..23df0ff84 100755 --- a/share/extensions/grid_cartesian.py +++ b/share/extensions/grid_cartesian.py @@ -122,7 +122,17 @@ class Grid_Polar(inkex.Effect): def effect(self): - + + self.options.border_th = self.unittouu(str(self.options.border_th) + 'px') + self.options.dx = self.unittouu(str(self.options.dx) + 'px') + self.options.x_divs_th = self.unittouu(str(self.options.x_divs_th) + 'px') + self.options.x_subdivs_th = self.unittouu(str(self.options.x_subdivs_th) + 'px') + self.options.x_subsubdivs_th = self.unittouu(str(self.options.x_subsubdivs_th) + 'px') + self.options.dy = self.unittouu(str(self.options.dy) + 'px') + self.options.y_divs_th = self.unittouu(str(self.options.y_divs_th) + 'px') + self.options.y_subdivs_th = self.unittouu(str(self.options.y_subdivs_th) + 'px') + self.options.y_subsubdivs_th = self.unittouu(str(self.options.y_subsubdivs_th) + 'px') + #find the pixel dimensions of the overall grid ymax = self.options.dy * self.options.y_divs xmax = self.options.dx * self.options.x_divs diff --git a/share/extensions/grid_isometric.py b/share/extensions/grid_isometric.py index 27951a0a8..8ac407613 100755 --- a/share/extensions/grid_isometric.py +++ b/share/extensions/grid_isometric.py @@ -84,6 +84,12 @@ class Grid_Polar(inkex.Effect): def effect(self): + self.options.dx = self.unittouu(str(self.options.dx) + 'px') + self.options.divs_th = self.unittouu(str(self.options.divs_th) + 'px') + self.options.subdivs_th = self.unittouu(str(self.options.subdivs_th) + 'px') + self.options.subsubdivs_th = self.unittouu(str(self.options.subsubdivs_th) + 'px') + self.options.border_th = self.unittouu(str(self.options.border_th) + 'px') + #Can't generate a grid too flat #If the Y dimension is smallest than half the X dimension, fix it. if self.options.y_divs<((self.options.x_divs+1)/2): diff --git a/share/extensions/grid_polar.py b/share/extensions/grid_polar.py index 3ae3fac34..17c3499cb 100755 --- a/share/extensions/grid_polar.py +++ b/share/extensions/grid_polar.py @@ -119,7 +119,16 @@ class Grid_Polar(inkex.Effect): help="The radial outset of the circumferential labels") def effect(self): - + + self.options.dr = self.unittouu(str(self.options.dr) + 'px') + self.options.r_divs_th = self.unittouu(str(self.options.r_divs_th) + 'px') + self.options.r_subdivs_th = self.unittouu(str(self.options.r_subdivs_th) + 'px') + self.options.a_divs_th = self.unittouu(str(self.options.a_divs_th) + 'px') + self.options.a_subdivs_th = self.unittouu(str(self.options.a_subdivs_th) + 'px') + self.options.c_dot_dia = self.unittouu(str(self.options.c_dot_dia) + 'px') + self.options.a_label_size = self.unittouu(str(self.options.a_label_size) + 'px') + self.options.a_label_outset = self.unittouu(str(self.options.a_label_outset) + 'px') + # Embed grid in group #Put in in the centre of the current view t = 'translate(' + str( self.view_center[0] ) + ',' + str( self.view_center[1] ) + ')' diff --git a/share/extensions/guides_creator.py b/share/extensions/guides_creator.py index abd41c6fc..21df1cd50 100755 --- a/share/extensions/guides_creator.py +++ b/share/extensions/guides_creator.py @@ -297,8 +297,8 @@ class Guides_Creator(inkex.Effect): svg = self.document.getroot() # getting the width and height attributes of the canvas - width = self.unittouu(svg.get('width')) - height = self.unittouu(svg.attrib['height']) + width = float(svg.get('width')) + height = float(svg.get('height')) # getting edges coordinates h_orientation = '0,' + str(round(width,4)) diff --git a/share/extensions/lindenmayer.py b/share/extensions/lindenmayer.py index f9abce3ec..2e058f541 100755 --- a/share/extensions/lindenmayer.py +++ b/share/extensions/lindenmayer.py @@ -104,7 +104,8 @@ class LSystem(inkex.Effect): return level_string def effect(self): - s = {'stroke-linejoin': 'miter', 'stroke-width': '1.0px', + self.options.step = self.unittouu(str(self.options.step) + 'px') + s = {'stroke-linejoin': 'miter', 'stroke-width': str(self.unittouu('1px')), 'stroke-opacity': '1.0', 'fill-opacity': '1.0', 'stroke': '#000000', 'stroke-linecap': 'butt', 'fill': 'none'} diff --git a/share/extensions/rtree.py b/share/extensions/rtree.py index 3231d284e..db677d0d5 100755 --- a/share/extensions/rtree.py +++ b/share/extensions/rtree.py @@ -44,7 +44,9 @@ class RTreeTurtle(inkex.Effect): dest="minimum", default=4.0, help="minimum branch size") def effect(self): - s = {'stroke-linejoin': 'miter', 'stroke-width': '1.0px', + self.options.size = self.unittouu(str(self.options.size) + 'px') + self.options.minimum = self.unittouu(str(self.options.minimum) + 'px') + s = {'stroke-linejoin': 'miter', 'stroke-width': str(self.unittouu('1px')), 'stroke-opacity': '1.0', 'fill-opacity': '1.0', 'stroke': '#000000', 'stroke-linecap': 'butt', 'fill': 'none'} diff --git a/share/extensions/spirograph.py b/share/extensions/spirograph.py index cb9d1ac24..77a258d5f 100755 --- a/share/extensions/spirograph.py +++ b/share/extensions/spirograph.py @@ -47,6 +47,9 @@ class Spirograph(inkex.Effect): help="The quality of the calculated output") def effect(self): + self.options.primaryr = self.unittouu(str(self.options.primaryr) + 'px') + self.options.secondaryr = self.unittouu(str(self.options.secondaryr) + 'px') + self.options.penr = self.unittouu(str(self.options.penr) + 'px') if self.options.secondaryr == 0: return @@ -68,7 +71,7 @@ class Spirograph(inkex.Effect): rotation = - math.pi * self.options.rotation / 180; new = inkex.etree.Element(inkex.addNS('path','svg')) - s = { 'stroke': '#000000', 'fill': 'none' } + s = { 'stroke': '#000000', 'fill': 'none', 'stroke-width': str(self.unittouu('1px')) } new.set('style', simplestyle.formatStyle(s)) pathString = '' diff --git a/share/extensions/triangle.py b/share/extensions/triangle.py index 81945f370..ad26c6891 100755 --- a/share/extensions/triangle.py +++ b/share/extensions/triangle.py @@ -82,7 +82,7 @@ def draw_tri_from_3_sides(s_a, s_b, s_c, offset, parent): #draw a triangle from offy = c[1]/2 #c is the highest point offset = ( offset[0]-offx , offset[1]-offy ) #add the centre of the triangle to the offset - draw_SVG_tri(a, b, c , offset, 2, 'Triangle', parent) + draw_SVG_tri(a, b, c , offset, Grid_Polar.unittouu(e, '2px'), 'Triangle', parent) else: sys.stderr.write('Error:Invalid Triangle Specifications.\n') @@ -122,7 +122,10 @@ class Grid_Polar(inkex.Effect): tri = self.current_layer offset = (self.view_center[0],self.view_center[1]) #the offset require to centre the triangle - + self.options.s_a = self.unittouu(str(self.options.s_a) + 'px') + self.options.s_b = self.unittouu(str(self.options.s_b) + 'px') + self.options.s_c = self.unittouu(str(self.options.s_c) + 'px') + if self.options.mode == '3_sides': s_a = self.options.s_a s_b = self.options.s_b diff --git a/share/extensions/wireframe_sphere.py b/share/extensions/wireframe_sphere.py index 5804a1b45..b8947869c 100755 --- a/share/extensions/wireframe_sphere.py +++ b/share/extensions/wireframe_sphere.py @@ -66,7 +66,7 @@ inkex.localize() def draw_SVG_ellipse((rx, ry), (cx, cy), parent, start_end=(0,2*pi),transform='' ): style = { 'stroke' : '#000000', - 'stroke-width' : '1', + 'stroke-width' : str(Wireframe_Sphere.unittouu(e, '1px')), 'fill' : 'none' } circ_attribs = {'style':simplestyle.formatStyle(style), inkex.addNS('cx','sodipodi') :str(cx), @@ -120,6 +120,7 @@ class Wireframe_Sphere(inkex.Effect): else: flip = '' #no flip + so.RADIUS = self.unittouu(str(so.RADIUS) + 'px') so.TILT = abs(so.TILT)*(pi/180) #Convert to radians so.ROT_OFFSET = so.ROT_OFFSET*(pi/180) #Convert to radians |
