summaryrefslogtreecommitdiffstats
path: root/share/extensions
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2013-10-25 13:51:20 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2013-10-25 13:51:20 +0000
commit9cc90961f5f051e320bb02c626b0eebd3bf847cf (patch)
tree644f6afa11a532c15552bb60efd6b5e2b7e0d4ff /share/extensions
parentFix for Bug 1242927 (minor EMF import issues) (diff)
downloadinkscape-9cc90961f5f051e320bb02c626b0eebd3bf847cf.tar.gz
inkscape-9cc90961f5f051e320bb02c626b0eebd3bf847cf.zip
fix unit handling of all python extensions. did not test with all extensions
(bzr r12722)
Diffstat (limited to 'share/extensions')
-rwxr-xr-xshare/extensions/dots.py10
-rwxr-xr-xshare/extensions/dxf_outlines.py2
-rwxr-xr-xshare/extensions/eqtexsvg.py4
-rwxr-xr-xshare/extensions/foldablebox.py10
-rwxr-xr-xshare/extensions/gcodetools.py2
-rwxr-xr-xshare/extensions/gimp_xcf.py4
-rwxr-xr-xshare/extensions/guides_creator.py4
-rwxr-xr-xshare/extensions/guillotine.py4
-rwxr-xr-xshare/extensions/hpgl_output.py4
-rwxr-xr-xshare/extensions/ink2canvas.py4
-rwxr-xr-xshare/extensions/inkex.py64
-rwxr-xr-xshare/extensions/interp.py4
-rwxr-xr-xshare/extensions/interp_att_g.py4
-rwxr-xr-xshare/extensions/layout_nup_pageframe.py2
-rwxr-xr-xshare/extensions/measure.py2
-rwxr-xr-xshare/extensions/pixelsnap.py13
-rw-r--r--share/extensions/print_win32_vector.py2
-rwxr-xr-xshare/extensions/printing_marks.py26
-rw-r--r--share/extensions/render_gears.py5
-rwxr-xr-xshare/extensions/split.py6
-rwxr-xr-xshare/extensions/svgcalendar.py8
-rwxr-xr-xshare/extensions/voronoi2svg.py4
-rwxr-xr-xshare/extensions/webslicer_export.py4
23 files changed, 100 insertions, 92 deletions
diff --git a/share/extensions/dots.py b/share/extensions/dots.py
index 7b88dd1b1..33ead21e7 100755
--- a/share/extensions/dots.py
+++ b/share/extensions/dots.py
@@ -69,8 +69,8 @@ class Dots(inkex.Effect):
y = dy/dist
if x1 > x2: x *= -1
if y1 > y2: y *= -1
- p[lastDot][1][-2] += x * inkex.unittouu(self.options.dotsize)
- p[lastDot][1][-1] += y * inkex.unittouu(self.options.dotsize)
+ p[lastDot][1][-2] += x * self.unittouu(self.options.dotsize)
+ p[lastDot][1][-1] += y * self.unittouu(self.options.dotsize)
def addDot(self, node):
self.group = inkex.etree.SubElement( node.getparent(), inkex.addNS('g','svg') )
@@ -94,7 +94,7 @@ class Dots(inkex.Effect):
if cmd != 'Z' and cmd != 'z':
dot_att = {
'style': style,
- 'r': str( inkex.unittouu(self.options.dotsize) / 2 ),
+ 'r': str( self.unittouu(self.options.dotsize) / 2 ),
'cx': str( params[-2] ),
'cy': str( params[-1] )
}
@@ -104,8 +104,8 @@ class Dots(inkex.Effect):
dot_att )
self.addText(
self.numGroup,
- params[-2] + ( inkex.unittouu(self.options.dotsize) / 2 ),
- params[-1] - ( inkex.unittouu(self.options.dotsize) / 2 ),
+ params[-2] + ( self.unittouu(self.options.dotsize) / 2 ),
+ params[-1] - ( self.unittouu(self.options.dotsize) / 2 ),
num )
num += self.options.step
node.getparent().remove( node )
diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py
index c5217f886..f5cf37aff 100755
--- a/share/extensions/dxf_outlines.py
+++ b/share/extensions/dxf_outlines.py
@@ -325,7 +325,7 @@ class MyEffect(inkex.Effect):
scale = eval(self.options.units)
if not scale:
scale = 25.4/90 # if no scale is specified, assume inch as baseunit
- h = inkex.unittouu(self.document.getroot().xpath('@height', namespaces=inkex.NSS)[0])
+ h = self.unittouu(self.document.getroot().xpath('@height', namespaces=inkex.NSS)[0])
self.groupmat = [[[scale, 0.0, 0.0], [0.0, -scale, h*scale]]]
doc = self.document.getroot()
self.process_group(doc)
diff --git a/share/extensions/eqtexsvg.py b/share/extensions/eqtexsvg.py
index a6000dc6d..99d3c0660 100755
--- a/share/extensions/eqtexsvg.py
+++ b/share/extensions/eqtexsvg.py
@@ -55,8 +55,8 @@ def create_equation_tex(filename, equation, add_header=""):
tex.close()
def svg_open(self,filename):
- doc_width = inkex.unittouu(self.document.getroot().get('width'))
- doc_height = inkex.unittouu(self.document.getroot().get('height'))
+ doc_width = self.unittouu(self.document.getroot().get('width'))
+ doc_height = self.unittouu(self.document.getroot().get('height'))
doc_sizeH = min(doc_width,doc_height)
doc_sizeW = max(doc_width,doc_height)
diff --git a/share/extensions/foldablebox.py b/share/extensions/foldablebox.py
index 21de10565..5d5945dd9 100755
--- a/share/extensions/foldablebox.py
+++ b/share/extensions/foldablebox.py
@@ -58,12 +58,12 @@ class FoldableBox(inkex.Effect):
def effect(self):
- docW = inkex.unittouu(self.document.getroot().get('width'))
- docH = inkex.unittouu(self.document.getroot().get('height'))
+ docW = self.unittouu(self.document.getroot().get('width'))
+ docH = self.unittouu(self.document.getroot().get('height'))
- boxW = inkex.unittouu( str(self.options.width) + self.options.unit )
- boxH = inkex.unittouu( str(self.options.height) + self.options.unit )
- boxD = inkex.unittouu( str(self.options.depth) + self.options.unit )
+ boxW = self.unittouu( str(self.options.width) + self.options.unit )
+ boxH = self.unittouu( str(self.options.height) + self.options.unit )
+ boxD = self.unittouu( str(self.options.depth) + self.options.unit )
tabProp = self.options.tabProportion
tabH = boxD * tabProp
diff --git a/share/extensions/gcodetools.py b/share/extensions/gcodetools.py
index ff0454db0..b9e6348f2 100755
--- a/share/extensions/gcodetools.py
+++ b/share/extensions/gcodetools.py
@@ -5852,7 +5852,7 @@ class Gcodetools(inkex.Effect):
attr["transform"] = transform
orientation_group = inkex.etree.SubElement(layer, inkex.addNS('g','svg'), attr)
- doc_height = inkex.unittouu(self.document.getroot().get('height'))
+ doc_height = self.unittouu(self.document.getroot().get('height'))
if self.document.getroot().get('height') == "100%" :
doc_height = 1052.3622047
print_("Overruding height from 100 percents to %s" % doc_height)
diff --git a/share/extensions/gimp_xcf.py b/share/extensions/gimp_xcf.py
index fe657d999..35d0bbd4c 100755
--- a/share/extensions/gimp_xcf.py
+++ b/share/extensions/gimp_xcf.py
@@ -74,8 +74,8 @@ class MyEffect(inkex.Effect):
docname = ttmp_orig.get(inkex.addNS('docname',u'sodipodi'))
if docname is None: docname = self.args[-1]
- pageHeight = int(inkex.unittouu(self.xpathSingle('/svg:svg/@height').split('.')[0]))
- pageWidth = int(inkex.unittouu(self.xpathSingle('/svg:svg/@width').split('.')[0]))
+ pageHeight = int(self.unittouu(self.xpathSingle('/svg:svg/@height').split('.')[0]))
+ pageWidth = int(self.unittouu(self.xpathSingle('/svg:svg/@width').split('.')[0]))
# Create os temp dir (to store exported pngs and Gimp log file)
self.tmp_dir = tempfile.mkdtemp()
diff --git a/share/extensions/guides_creator.py b/share/extensions/guides_creator.py
index 178dc3c95..abd41c6fc 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 = inkex.unittouu(svg.get('width'))
- height = inkex.unittouu(svg.attrib['height'])
+ width = self.unittouu(svg.get('width'))
+ height = self.unittouu(svg.attrib['height'])
# getting edges coordinates
h_orientation = '0,' + str(round(width,4))
diff --git a/share/extensions/guillotine.py b/share/extensions/guillotine.py
index 82b1a5441..bd077d60a 100755
--- a/share/extensions/guillotine.py
+++ b/share/extensions/guillotine.py
@@ -128,7 +128,7 @@ class Guillotine(inkex.Effect):
'''
root = self.document.getroot()
horizontals = ['0']
- height = inkex.unittouu(root.attrib['height'])
+ height = self.unittouu(root.attrib['height'])
for h in self.get_all_horizontal_guides():
if h >= 0 and float(h) <= float(height):
horizontals.append(h)
@@ -144,7 +144,7 @@ class Guillotine(inkex.Effect):
'''
root = self.document.getroot()
verticals = ['0']
- width = inkex.unittouu(root.attrib['width'])
+ width = self.unittouu(root.attrib['width'])
for v in self.get_all_vertical_guides():
if v >= 0 and float(v) <= float(width):
verticals.append(v)
diff --git a/share/extensions/hpgl_output.py b/share/extensions/hpgl_output.py
index 83d6da5af..eb3d6ffe3 100755
--- a/share/extensions/hpgl_output.py
+++ b/share/extensions/hpgl_output.py
@@ -115,8 +115,8 @@ class MyEffect(inkex.Effect):
if viewBox:
viewBox = string.split(viewBox, ' ')
if viewBox[2] and viewBox[3]:
- viewBoxTransformX = float(inkex.unittouu(doc.get('width'))) / float(viewBox[2])
- viewBoxTransformY = float(inkex.unittouu(doc.get('height'))) / float(viewBox[3])
+ viewBoxTransformX = float(self.unittouu(doc.get('width'))) / float(viewBox[2])
+ viewBoxTransformY = float(self.unittouu(doc.get('height'))) / float(viewBox[3])
# dryRun to find edges
self.dryRun = True
self.groupmat = [[[scale*viewBoxTransformX, 0.0, 0.0], [0.0, mirror*scale*viewBoxTransformY, 0.0]]]
diff --git a/share/extensions/ink2canvas.py b/share/extensions/ink2canvas.py
index 7d2ee6a7f..51b75d846 100755
--- a/share/extensions/ink2canvas.py
+++ b/share/extensions/ink2canvas.py
@@ -78,8 +78,8 @@ class Ink2Canvas(inkex.Effect):
def effect(self):
"""Applies the effect"""
svg_root = self.document.getroot()
- width = inkex.unittouu(svg_root.get("width"))
- height = inkex.unittouu(svg_root.get("height"))
+ width = self.unittouu(svg_root.get("width"))
+ height = self.unittouu(svg_root.get("height"))
self.canvas = Canvas(width, height)
self.walk_tree(svg_root)
diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py
index 861cc2300..fd70d1c7d 100755
--- a/share/extensions/inkex.py
+++ b/share/extensions/inkex.py
@@ -78,30 +78,6 @@ def localize():
#sys.stderr.write(str(localdir) + "\n")
trans.install()
-#a dictionary of unit to user unit conversion factors
-uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866,
- 'km':3543307.0866, 'pc':15.0, 'yd':3240 , 'ft':1080}
-def unittouu(string):
- '''Returns userunits given a string representation of units in another system'''
- unit = re.compile('(%s)$' % '|'.join(uuconv.keys()))
- param = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)')
-
- p = param.match(string)
- u = unit.search(string)
- if p:
- retval = float(p.string[p.start():p.end()])
- else:
- retval = 0.0
- if u:
- try:
- return retval * uuconv[u.string[u.start():u.end()]]
- except KeyError:
- pass
- return retval
-
-def uutounit(val, unit):
- return val/uuconv[unit]
-
def debug(what):
sys.stderr.write(str(what) + "\n")
return what
@@ -189,6 +165,7 @@ class Effect:
self.original_document = copy.deepcopy(self.document)
stream.close()
+ # defines view_center in terms of document units
def getposinlayer(self):
#defaults
self.current_layer = self.document.getroot()
@@ -203,10 +180,10 @@ class Effect:
xattr = self.document.xpath('//sodipodi:namedview/@inkscape:cx', namespaces=NSS)
yattr = self.document.xpath('//sodipodi:namedview/@inkscape:cy', namespaces=NSS)
- doc_height = unittouu(self.document.getroot().get('height'))
if xattr and yattr:
- x = xattr[0]
- y = yattr[0]
+ x = self.unittouu( xattr[0] + 'px' )
+ y = self.unittouu( yattr[0] + 'px')
+ doc_height = self.unittouu(self.document.getroot().get('height'))
if x and y:
self.view_center = (float(x), doc_height - float(y)) # FIXME: y-coordinate flip, eliminate it when it's gone in Inkscape
@@ -283,6 +260,37 @@ class Effect:
errormsg(_("No matching node for expression: %s") % path)
retval = None
return retval
-
+
+ def getDocumentUnit(self):
+ docunit = self.document.xpath('//sodipodi:namedview/@inkscape:document-units', namespaces=NSS)
+ if docunit:
+ return docunit[0]
+ else:
+ return 'px'
+
+ #a dictionary of unit to user unit conversion factors
+ uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866,
+ 'km':3543307.0866, 'pc':15.0, 'yd':3240 , 'ft':1080}
+ def unittouu(self, string):
+ '''Returns userunits given a string representation of units in another system'''
+ unit = re.compile('(%s)$' % '|'.join(self.uuconv.keys()))
+ param = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)')
+
+ p = param.match(string)
+ u = unit.search(string)
+ if p:
+ retval = float(p.string[p.start():p.end()])
+ else:
+ retval = 0.0
+ if u:
+ try:
+ return retval * (self.uuconv[u.string[u.start():u.end()]] / self.uuconv[self.getDocumentUnit()])
+ except KeyError:
+ pass
+ return retval
+
+ def uutounit(self, val, unit):
+ return val / (self.uuconv[unit] / self.uuconv[self.getDocumentUnit()])
+
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
diff --git a/share/extensions/interp.py b/share/extensions/interp.py
index 9e10f30d8..c69dd4a73 100755
--- a/share/extensions/interp.py
+++ b/share/extensions/interp.py
@@ -61,8 +61,8 @@ def tweenstylefloat(property, start, end, time):
ep = float(end[property])
return str(sp + (time * (ep - sp)))
def tweenstyleunit(property, start, end, time):
- sp = inkex.unittouu(start[property])
- ep = inkex.unittouu(end[property])
+ sp = self.unittouu(start[property])
+ ep = self.unittouu(end[property])
return str(sp + (time * (ep - sp)))
def tweenstylecolor(property, start, end, time):
sr,sg,sb = parsecolor(start[property])
diff --git a/share/extensions/interp_att_g.py b/share/extensions/interp_att_g.py
index 8ceaf8e34..0798f7f58 100755
--- a/share/extensions/interp_att_g.py
+++ b/share/extensions/interp_att_g.py
@@ -103,8 +103,8 @@ class InterpAttG(inkex.Effect):
sv = self.options.start_val
ev = self.options.end_val
if self.inte_att_type and self.inte_att_type != 'none':
- sv = inkex.unittouu( sv + self.inte_att_type )
- ev = inkex.unittouu( ev + self.inte_att_type )
+ sv = self.unittouu( sv + self.inte_att_type )
+ ev = self.unittouu( ev + self.inte_att_type )
self.val_cur = self.val_ini = sv
self.val_end = ev
self.val_inc = ( ev - sv ) / float( self.tot_el - 1 )
diff --git a/share/extensions/layout_nup_pageframe.py b/share/extensions/layout_nup_pageframe.py
index 16b781470..59da1f4bb 100755
--- a/share/extensions/layout_nup_pageframe.py
+++ b/share/extensions/layout_nup_pageframe.py
@@ -32,7 +32,7 @@ def expandTuple(unit, x, length = 4):
if len(x) != length:
raise Exception("expandTuple: requires 2 or 4 item tuple")
try:
- return tuple(map(lambda ev: (inkex.unittouu(str(eval(str(ev)))+unit)), x))
+ return tuple(map(lambda ev: (self.unittouu(str(eval(str(ev)))+unit)), x))
except:
return None
#@-node:tbrown.20070622103716.1:expandTuple
diff --git a/share/extensions/measure.py b/share/extensions/measure.py
index 8aa940ed2..68cce0334 100755
--- a/share/extensions/measure.py
+++ b/share/extensions/measure.py
@@ -154,7 +154,7 @@ class Length(inkex.Effect):
mat = simpletransform.composeParents(node, [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]])
p = cubicsuperpath.parsePath(node.get('d'))
simpletransform.applyTransformToPath(mat, p)
- factor = factor/inkex.unittouu('1'+self.options.unit)
+ factor = factor/self.unittouu('1'+self.options.unit)
if self.options.type == "length":
slengths, stotal = csplength(p)
else:
diff --git a/share/extensions/pixelsnap.py b/share/extensions/pixelsnap.py
index 95ae7f0dc..162822920 100755
--- a/share/extensions/pixelsnap.py
+++ b/share/extensions/pixelsnap.py
@@ -77,7 +77,6 @@ import simplestyle, simpletransform, simplepath
try:
import inkex
- from inkex import unittouu
except ImportError:
raise ImportError("No module named inkex.\nPlease edit the file %s and see the section titled 'INKEX MODULE'" % __file__)
@@ -170,7 +169,7 @@ class PixelSnapEffect(inkex.Effect):
stroke_width = 0
if stroke and setval is None:
- stroke_width = unittouu(style.get('stroke-width', '').strip())
+ stroke_width = self.unittouu(style.get('stroke-width', '').strip())
if setval:
style['stroke-width'] = str(setval)
@@ -436,10 +435,10 @@ class PixelSnapEffect(inkex.Effect):
offset = self.elem_offset(elem, parent_transform) % 1
- width = unittouu(elem.attrib['width'])
- height = unittouu(elem.attrib['height'])
- x = unittouu(elem.attrib['x'])
- y = unittouu(elem.attrib['y'])
+ width = self.unittouu(elem.attrib['width'])
+ height = self.unittouu(elem.attrib['height'])
+ x = self.unittouu(elem.attrib['x'])
+ y = self.unittouu(elem.attrib['y'])
width, height = transform_dimensions(transform, width, height)
x, y = transform_point(transform, [x, y])
@@ -494,7 +493,7 @@ class PixelSnapEffect(inkex.Effect):
def effect(self):
svg = self.document.getroot()
- self.document_offset = unittouu(svg.attrib['height']) % 1 # although SVG units are absolute, the elements are positioned relative to the top of the page, rather than zero
+ self.document_offset = self.unittouu(svg.attrib['height']) % 1 # although SVG units are absolute, the elements are positioned relative to the top of the page, rather than zero
for id, elem in self.selected.iteritems():
try:
diff --git a/share/extensions/print_win32_vector.py b/share/extensions/print_win32_vector.py
index e77b49826..ca166d25a 100644
--- a/share/extensions/print_win32_vector.py
+++ b/share/extensions/print_win32_vector.py
@@ -63,7 +63,7 @@ class MyEffect(inkex.Effect):
if style['stroke'] and style['stroke'] != 'none' and style['stroke'][0:3] != 'url':
rgb = simplestyle.parseColor(style['stroke'])
if style.has_key('stroke-width'):
- stroke = inkex.unittouu(style['stroke-width'])
+ stroke = self.unittouu(style['stroke-width'])
stroke = int(stroke*self.scale)
if style.has_key('fill'):
if style['fill'] and style['fill'] != 'none' and style['fill'][0:3] != 'url':
diff --git a/share/extensions/printing_marks.py b/share/extensions/printing_marks.py
index 7d3ab02d1..5c6ac3a61 100755
--- a/share/extensions/printing_marks.py
+++ b/share/extensions/printing_marks.py
@@ -34,8 +34,6 @@ class Printing_Marks (inkex.Effect):
# Default parameters
stroke_width = 0.25
- mark_size = inkex.unittouu('1cm')
- min_mark_margin = inkex.unittouu('3mm')
def __init__(self):
inkex.Effect.__init__(self)
@@ -228,6 +226,8 @@ class Printing_Marks (inkex.Effect):
self.area_h = max_y - min_y
def effect(self):
+ self.mark_size = self.unittouu('1cm')
+ self.min_mark_margin = self.unittouu('3mm')
if self.options.where_to_crop == 'selection' :
self.get_selection_area()
@@ -235,8 +235,8 @@ class Printing_Marks (inkex.Effect):
#exit(1)
else :
svg = self.document.getroot()
- self.area_w = inkex.unittouu(svg.get('width'))
- self.area_h = inkex.unittouu(svg.attrib['height'])
+ self.area_w = self.unittouu(svg.get('width'))
+ self.area_h = self.unittouu(svg.attrib['height'])
self.area_x1 = 0
self.area_y1 = 0
self.area_x2 = self.area_w
@@ -245,16 +245,16 @@ class Printing_Marks (inkex.Effect):
# Get SVG document dimensions
# self.width must be replaced by self.area_x2. same to others.
svg = self.document.getroot()
- #self.width = width = inkex.unittouu(svg.get('width'))
- #self.height = height = inkex.unittouu(svg.attrib['height'])
+ #self.width = width = self.unittouu(svg.get('width'))
+ #self.height = height = self.unittouu(svg.attrib['height'])
# Convert parameters to user unit
- offset = inkex.unittouu(str(self.options.crop_offset) + \
+ offset = self.unittouu(str(self.options.crop_offset) + \
self.options.unit)
- bt = inkex.unittouu(str(self.options.bleed_top) + self.options.unit)
- bb = inkex.unittouu(str(self.options.bleed_bottom) + self.options.unit)
- bl = inkex.unittouu(str(self.options.bleed_left) + self.options.unit)
- br = inkex.unittouu(str(self.options.bleed_right) + self.options.unit)
+ bt = self.unittouu(str(self.options.bleed_top) + self.options.unit)
+ bb = self.unittouu(str(self.options.bleed_bottom) + self.options.unit)
+ bl = self.unittouu(str(self.options.bleed_left) + self.options.unit)
+ br = self.unittouu(str(self.options.bleed_right) + self.options.unit)
# Bleed margin
if bt < offset : bmt = 0
else : bmt = bt - offset
@@ -476,9 +476,9 @@ class Printing_Marks (inkex.Effect):
}
txt = inkex.etree.SubElement(g_pag_info, 'text', txt_attribs)
txt.text = 'Page size: ' +\
- str(round(inkex.uutounit(self.area_w,self.options.unit),2)) +\
+ str(round(self.uutounit(self.area_w,self.options.unit),2)) +\
'x' +\
- str(round(inkex.uutounit(self.area_h,self.options.unit),2)) +\
+ str(round(self.uutounit(self.area_h,self.options.unit),2)) +\
' ' + self.options.unit
diff --git a/share/extensions/render_gears.py b/share/extensions/render_gears.py
index a1b3ee666..5201e553b 100644
--- a/share/extensions/render_gears.py
+++ b/share/extensions/render_gears.py
@@ -67,9 +67,9 @@ class Gears(inkex.Effect):
def effect(self):
teeth = self.options.teeth
- pitch = inkex.unittouu( str(self.options.pitch) + self.options.unit)
+ pitch = self.unittouu( str(self.options.pitch) + self.options.unit)
angle = self.options.angle # Angle of tangent to tooth at circular pitch wrt radial line.
- centerdiameter = inkex.unittouu( str(self.options.centerdiameter) + self.options.unit)
+ centerdiameter = self.unittouu( str(self.options.centerdiameter) + self.options.unit)
# print >>sys.stderr, "Teeth: %s\n" % teeth
@@ -182,4 +182,5 @@ if __name__ == '__main__':
e.affect()
+
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
diff --git a/share/extensions/split.py b/share/extensions/split.py
index 0cbc7b05b..18d4327fe 100755
--- a/share/extensions/split.py
+++ b/share/extensions/split.py
@@ -58,7 +58,7 @@ class Split(inkex.Effect):
fontsize = parseStyle(node.get("style"))["font-size"]
except:
fontsize = "12px"
- fs = inkex.unittouu(fontsize)
+ fs = self.unittouu(fontsize)
#selects the flowRegion's child (svg:rect) to get @X and @Y
id = node.get("id")
@@ -124,7 +124,7 @@ class Split(inkex.Effect):
fontsize = parseStyle(line.get("style"))["font-size"]
except:
fontsize = "12px"
- fs = inkex.unittouu(fontsize)
+ fs = self.unittouu(fontsize)
#extract and returns a list of words
words_list = "".join(plain_str(line)).split()
@@ -170,7 +170,7 @@ class Split(inkex.Effect):
fontsize = simplestyle.parseStyle(word.get("style"))["font-size"]
except:
fontsize = "12px"
- fs = inkex.unittouu(fontsize)
+ fs = self.unittouu(fontsize)
#for each letter in element string
for letter in word[0].text:
diff --git a/share/extensions/svgcalendar.py b/share/extensions/svgcalendar.py
index 23290bfe5..a4269f5d7 100755
--- a/share/extensions/svgcalendar.py
+++ b/share/extensions/svgcalendar.py
@@ -166,8 +166,8 @@ class SVGCalendar (inkex.Effect):
else:
calendar.setfirstweekday(0)
# Convert string numbers with unit to user space float numbers
- self.options.month_width = inkex.unittouu( self.options.month_width )
- self.options.month_margin = inkex.unittouu( self.options.month_margin )
+ self.options.month_width = self.unittouu( self.options.month_width )
+ self.options.month_margin = self.unittouu( self.options.month_margin )
# initial values
month_x_pos = 0
@@ -176,8 +176,8 @@ class SVGCalendar (inkex.Effect):
def calculate_size_and_positions(self):
#month_margin month_width months_per_line auto_organize
- self.doc_w = inkex.unittouu(self.document.getroot().get('width'))
- self.doc_h = inkex.unittouu(self.document.getroot().get('height'))
+ self.doc_w = self.unittouu(self.document.getroot().get('width'))
+ self.doc_h = self.unittouu(self.document.getroot().get('height'))
if self.options.show_weeknr:
self.cols_before = 1
else:
diff --git a/share/extensions/voronoi2svg.py b/share/extensions/voronoi2svg.py
index dd693f8bb..c5b8a511f 100755
--- a/share/extensions/voronoi2svg.py
+++ b/share/extensions/voronoi2svg.py
@@ -290,8 +290,8 @@ class Voronoi2svg(inkex.Effect):
clipBox = ()
if self.options.clipBox == 'Page':
svg = self.document.getroot()
- w = inkex.unittouu(svg.get('width'))
- h = inkex.unittouu(svg.get('height'))
+ w = self.unittouu(svg.get('width'))
+ h = self.unittouu(svg.get('height'))
clipBox = (0,w,0,h)
else:
clipBox = (2*gBbox[0]-gBbox[1],
diff --git a/share/extensions/webslicer_export.py b/share/extensions/webslicer_export.py
index 118dfbeee..c9ea761a7 100755
--- a/share/extensions/webslicer_export.py
+++ b/share/extensions/webslicer_export.py
@@ -303,8 +303,8 @@ class WebSlicer_Export(WebSlicer_Effect):
if len(el) == 5:
self.el_geo[el[0]] = { 'x':float(el[1]), 'y':float(el[2]),
'w':float(el[3]), 'h':float(el[4]) }
- doc_w = inkex.unittouu( self.document.getroot().get('width') )
- doc_h = inkex.unittouu( self.document.getroot().get('height') )
+ doc_w = self.unittouu( self.document.getroot().get('width') )
+ doc_h = self.unittouu( self.document.getroot().get('height') )
self.el_geo['webslicer-layer'] = { 'x':0, 'y':0, 'w':doc_w, 'h':doc_h }