summaryrefslogtreecommitdiffstats
path: root/share/extensions
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-05-26 17:37:48 +0000
committerjabiertxof <info@marker.es>2016-05-26 17:37:48 +0000
commit43bc2051d07eb88f0ef3bff36880d9b39e809cc5 (patch)
tree18582075e686eb9bcc2e1af5ef9e2a4ceb19e65b /share/extensions
parentFixing pointwise (diff)
parent[Bug #1538277] Translations in inkex.py fail unless extension script itself i... (diff)
downloadinkscape-43bc2051d07eb88f0ef3bff36880d9b39e809cc5.tar.gz
inkscape-43bc2051d07eb88f0ef3bff36880d9b39e809cc5.zip
update to trunk
(bzr r13645.1.144)
Diffstat (limited to 'share/extensions')
-rwxr-xr-xshare/extensions/convert2dashes.py18
-rwxr-xr-xshare/extensions/dimension.py1
-rwxr-xr-xshare/extensions/draw_from_triangle.py1
-rwxr-xr-xshare/extensions/dxf_input.py1
-rwxr-xr-xshare/extensions/dxf_outlines.py2
-rwxr-xr-xshare/extensions/embedimage.py1
-rwxr-xr-xshare/extensions/export_gimp_palette.py2
-rwxr-xr-xshare/extensions/extractimage.py2
-rwxr-xr-xshare/extensions/extrude.py2
-rwxr-xr-xshare/extensions/funcplot.py2
-rwxr-xr-xshare/extensions/gcodetools.py2
-rwxr-xr-xshare/extensions/generate_voronoi.py2
-rwxr-xr-xshare/extensions/gimp_xcf.py2
-rwxr-xr-xshare/extensions/guides_creator.py3
-rwxr-xr-xshare/extensions/guillotine.py2
-rwxr-xr-xshare/extensions/hpgl_input.py4
-rwxr-xr-xshare/extensions/hpgl_output.py3
-rwxr-xr-xshare/extensions/image_attributes.py6
-rwxr-xr-xshare/extensions/inkex.py2
-rwxr-xr-xshare/extensions/interp_att_g.py1
-rwxr-xr-xshare/extensions/jessyInk_autoTexts.py1
-rwxr-xr-xshare/extensions/jessyInk_effects.py1
-rwxr-xr-xshare/extensions/jessyInk_export.py2
-rwxr-xr-xshare/extensions/jessyInk_keyBindings.py1
-rwxr-xr-xshare/extensions/jessyInk_masterSlide.py2
-rwxr-xr-xshare/extensions/jessyInk_mouseHandler.py1
-rwxr-xr-xshare/extensions/jessyInk_summary.py1
-rwxr-xr-xshare/extensions/jessyInk_transitions.py1
-rwxr-xr-xshare/extensions/jessyInk_video.py2
-rwxr-xr-xshare/extensions/jessyInk_view.py1
-rw-r--r--share/extensions/jitternodes.inx (renamed from share/extensions/radiusrand.inx)13
-rwxr-xr-xshare/extensions/jitternodes.py (renamed from share/extensions/radiusrand.py)82
-rwxr-xr-xshare/extensions/launch_webbrowser.py1
-rwxr-xr-xshare/extensions/markers_strokepaint.py1
-rwxr-xr-xshare/extensions/measure.py1
-rwxr-xr-xshare/extensions/pathalongpath.py1
-rwxr-xr-xshare/extensions/pathmodifier.py2
-rwxr-xr-xshare/extensions/pathscatter.py2
-rwxr-xr-xshare/extensions/perspective.py2
-rwxr-xr-xshare/extensions/plotter.py3
-rwxr-xr-xshare/extensions/polyhedron_3d.py2
-rwxr-xr-xshare/extensions/print_win32_vector.py2
-rwxr-xr-xshare/extensions/render_alphabetsoup.py2
-rwxr-xr-xshare/extensions/render_barcode_datamatrix.py2
-rwxr-xr-xshare/extensions/render_barcode_qrcode.py2
-rwxr-xr-xshare/extensions/replace_font.py2
-rwxr-xr-xshare/extensions/restack.py1
-rwxr-xr-xshare/extensions/summersnight.py2
-rwxr-xr-xshare/extensions/svg_and_media_zip_output.py2
-rwxr-xr-xshare/extensions/svgcalendar.py1
-rwxr-xr-xshare/extensions/test/jitternodes.test.py (renamed from share/extensions/test/radiusrand.test.py)8
-rwxr-xr-xshare/extensions/uniconv-ext.py2
-rwxr-xr-xshare/extensions/uniconv_output.py1
-rw-r--r--share/extensions/voronoi2svg.py1
-rwxr-xr-xshare/extensions/web-set-att.py2
-rwxr-xr-xshare/extensions/web-transmit-att.py1
-rwxr-xr-xshare/extensions/webslicer_create_group.py2
-rwxr-xr-xshare/extensions/webslicer_create_rect.py2
-rwxr-xr-xshare/extensions/webslicer_export.py2
-rwxr-xr-xshare/extensions/wireframe_sphere.py1
60 files changed, 85 insertions, 135 deletions
diff --git a/share/extensions/convert2dashes.py b/share/extensions/convert2dashes.py
index 3910d8e82..d13e6498e 100755
--- a/share/extensions/convert2dashes.py
+++ b/share/extensions/convert2dashes.py
@@ -26,8 +26,6 @@ import cubicsuperpath
import bezmisc
import simplestyle
-inkex.localize()
-
def tpoint((x1,y1), (x2,y2), t = 0.5):
return [x1+t*(x2-x1),y1+t*(y2-y1)]
def cspbezsplit(sp1, sp2, t = 0.5):
@@ -49,9 +47,21 @@ def cspseglength(sp1,sp2, tolerance = 0.001):
class SplitIt(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
+ self.not_converted = []
def effect(self):
- for id, node in self.selected.iteritems():
+ for _, node in self.selected.iteritems():
+ self.convert2dash(node)
+ if len(self.not_converted):
+ inkex.errormsg('Total number of objects not converted: {}\n'.format(len(self.not_converted)))
+ # return list of IDs in case the user needs to find a specific object
+ inkex.debug(self.not_converted)
+
+ def convert2dash(self, node):
+ if node.tag == inkex.addNS('g', 'svg'):
+ for child in node:
+ self.convert2dash(child)
+ else:
if node.tag == inkex.addNS('path','svg'):
dashes = []
offset = 0
@@ -97,7 +107,7 @@ class SplitIt(inkex.Effect):
if node.get(inkex.addNS('type','sodipodi')):
del node.attrib[inkex.addNS('type', 'sodipodi')]
else:
- inkex.errormsg(_("The selected object is not a path.\nTry using the procedure Path->Object to Path."))
+ self.not_converted.append(node.get('id'))
if __name__ == '__main__':
e = SplitIt()
diff --git a/share/extensions/dimension.py b/share/extensions/dimension.py
index 462a05bae..e6b2d8f85 100755
--- a/share/extensions/dimension.py
+++ b/share/extensions/dimension.py
@@ -44,7 +44,6 @@ import inkex
import pathmodifier
from simpletransform import *
-inkex.localize()
class Dimension(pathmodifier.PathModifier):
def __init__(self):
diff --git a/share/extensions/draw_from_triangle.py b/share/extensions/draw_from_triangle.py
index 5efabfbba..74a58b863 100755
--- a/share/extensions/draw_from_triangle.py
+++ b/share/extensions/draw_from_triangle.py
@@ -38,7 +38,6 @@ import inkex
import simplestyle
import simplepath
-inkex.localize()
#DRAWING ROUTINES
diff --git a/share/extensions/dxf_input.py b/share/extensions/dxf_input.py
index caeee6679..1dcbac7b8 100755
--- a/share/extensions/dxf_input.py
+++ b/share/extensions/dxf_input.py
@@ -26,7 +26,6 @@ import inkex, simplestyle, math
from StringIO import StringIO
from urllib import quote
-inkex.localize()
def export_MTEXT():
# mandatory group codes : (1 or 3, 10, 20) (text, x, y)
diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py
index 0e8cb7f62..525461bde 100755
--- a/share/extensions/dxf_outlines.py
+++ b/share/extensions/dxf_outlines.py
@@ -40,8 +40,6 @@ import cubicsuperpath
import coloreffect
import dxf_templates
-inkex.localize()
-
try:
from numpy import *
from numpy.linalg import solve
diff --git a/share/extensions/embedimage.py b/share/extensions/embedimage.py
index 136c20f98..9ebe084a3 100755
--- a/share/extensions/embedimage.py
+++ b/share/extensions/embedimage.py
@@ -25,7 +25,6 @@ import urlparse
# local library
import inkex
-inkex.localize()
class Embedder(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/export_gimp_palette.py b/share/extensions/export_gimp_palette.py
index 25856f4b4..9c04d6e34 100755
--- a/share/extensions/export_gimp_palette.py
+++ b/share/extensions/export_gimp_palette.py
@@ -19,8 +19,6 @@ except:
import inkex
import simplestyle
-inkex.localize()
-
colortags=(u'fill',u'stroke',u'stop-color',u'flood-color',u'lighting-color')
colors={}
diff --git a/share/extensions/extractimage.py b/share/extensions/extractimage.py
index aae7bd062..031a01560 100755
--- a/share/extensions/extractimage.py
+++ b/share/extensions/extractimage.py
@@ -22,8 +22,6 @@ import os
# local library
import inkex
-inkex.localize()
-
class MyEffect(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
diff --git a/share/extensions/extrude.py b/share/extensions/extrude.py
index 8db6b1512..88ae3994a 100755
--- a/share/extensions/extrude.py
+++ b/share/extensions/extrude.py
@@ -22,8 +22,6 @@ import simplepath
import simpletransform
import cubicsuperpath
-inkex.localize()
-
class Extrude(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
diff --git a/share/extensions/funcplot.py b/share/extensions/funcplot.py
index c0fb3e525..557aac302 100755
--- a/share/extensions/funcplot.py
+++ b/share/extensions/funcplot.py
@@ -34,8 +34,6 @@ import inkex
import simplepath
import simplestyle
-inkex.localize()
-
def drawfunction(xstart, xend, ybottom, ytop, samples, width, height, left, bottom,
fx = "sin(x)", fpx = "cos(x)", fponum = True, times2pi = False, polar = False, isoscale = True, drawaxis = True, endpts = False):
diff --git a/share/extensions/gcodetools.py b/share/extensions/gcodetools.py
index 4cb5b2696..dab0312af 100755
--- a/share/extensions/gcodetools.py
+++ b/share/extensions/gcodetools.py
@@ -87,8 +87,6 @@ import simplepath
import cubicsuperpath
import simpletransform
import bezmisc
-
-inkex.localize()
### Check if inkex has errormsg (0.46 version does not have one.) Could be removed later.
if "errormsg" not in dir(inkex):
diff --git a/share/extensions/generate_voronoi.py b/share/extensions/generate_voronoi.py
index 8907db493..4cf541aa2 100755
--- a/share/extensions/generate_voronoi.py
+++ b/share/extensions/generate_voronoi.py
@@ -27,8 +27,6 @@ import inkex
import simplestyle, simpletransform
import voronoi
-inkex.localize()
-
try:
from subprocess import Popen, PIPE
except:
diff --git a/share/extensions/gimp_xcf.py b/share/extensions/gimp_xcf.py
index 39dec8c13..7dfdc0cc8 100755
--- a/share/extensions/gimp_xcf.py
+++ b/share/extensions/gimp_xcf.py
@@ -27,8 +27,6 @@ import tempfile
# local library
import inkex
-inkex.localize()
-
# Define extension exceptions
class GimpXCFError(Exception): pass
diff --git a/share/extensions/guides_creator.py b/share/extensions/guides_creator.py
index e0aa6cadf..70144d9dd 100755
--- a/share/extensions/guides_creator.py
+++ b/share/extensions/guides_creator.py
@@ -54,9 +54,6 @@ from math import sqrt
import inkex
from simplestyle import *
-# for localized debugging output
-inkex.localize()
-
from xml.etree import ElementTree as ET
# for golden number formula and diagonal guides
diff --git a/share/extensions/guillotine.py b/share/extensions/guillotine.py
index 15a0fba96..ee7ae39fa 100755
--- a/share/extensions/guillotine.py
+++ b/share/extensions/guillotine.py
@@ -50,8 +50,6 @@ except:
import inkex
import simplestyle
-inkex.localize()
-
locale.setlocale(locale.LC_ALL, '')
def float_sort(a, b):
diff --git a/share/extensions/hpgl_input.py b/share/extensions/hpgl_input.py
index 8cc7edaaf..2b275cbf8 100755
--- a/share/extensions/hpgl_input.py
+++ b/share/extensions/hpgl_input.py
@@ -25,8 +25,6 @@ from StringIO import StringIO
import hpgl_decoder
import inkex
import sys
-inkex.localize()
-
# parse options
parser = inkex.optparse.OptionParser(usage='usage: %prog [options] HPGLfile', option_class=inkex.InkOption)
@@ -68,4 +66,4 @@ if 'UNKNOWN_COMMANDS' in warnings:
# deliver document to inkscape
doc.write(inkex.sys.stdout)
-# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
diff --git a/share/extensions/hpgl_output.py b/share/extensions/hpgl_output.py
index 477db40e7..58f82da71 100755
--- a/share/extensions/hpgl_output.py
+++ b/share/extensions/hpgl_output.py
@@ -23,7 +23,6 @@ import sys
# local libraries
import hpgl_encoder
import inkex
-inkex.localize()
class HpglOutput(inkex.Effect):
@@ -79,4 +78,4 @@ if __name__ == '__main__':
e = HpglOutput()
e.affect()
-# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
diff --git a/share/extensions/image_attributes.py b/share/extensions/image_attributes.py
index 80ad62c26..98cc5204f 100755
--- a/share/extensions/image_attributes.py
+++ b/share/extensions/image_attributes.py
@@ -28,12 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import inkex
import simplestyle
-try:
- inkex.localize()
-except:
- import gettext
- _ = gettext.gettext
-
class SetAttrImage(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py
index 264ae0ff4..9d3bb0c6d 100755
--- a/share/extensions/inkex.py
+++ b/share/extensions/inkex.py
@@ -95,7 +95,6 @@ def errormsg(msg):
Note that this should always be combined with translation:
import inkex
- inkex.localize()
...
inkex.errormsg(_("This extension requires two selected paths."))
"""
@@ -275,6 +274,7 @@ class Effect:
def affect(self, args=sys.argv[1:], output=True):
"""Affect an SVG document with a callback effect"""
self.svg_file = args[-1]
+ localize()
self.getoptions(args)
self.parse()
self.getposinlayer()
diff --git a/share/extensions/interp_att_g.py b/share/extensions/interp_att_g.py
index 2ae46b46d..8718caf41 100755
--- a/share/extensions/interp_att_g.py
+++ b/share/extensions/interp_att_g.py
@@ -25,7 +25,6 @@ import inkex
import simplestyle
from pathmodifier import zSort
-inkex.localize()
class InterpAttG(inkex.Effect):
diff --git a/share/extensions/jessyInk_autoTexts.py b/share/extensions/jessyInk_autoTexts.py
index ed0edb6fa..2c52964da 100755
--- a/share/extensions/jessyInk_autoTexts.py
+++ b/share/extensions/jessyInk_autoTexts.py
@@ -25,7 +25,6 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-inkex.localize()
class JessyInk_AutoTexts(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/jessyInk_effects.py b/share/extensions/jessyInk_effects.py
index e20e9fc2c..dc56d3a75 100755
--- a/share/extensions/jessyInk_effects.py
+++ b/share/extensions/jessyInk_effects.py
@@ -25,7 +25,6 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-inkex.localize()
class JessyInk_Effects(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/jessyInk_export.py b/share/extensions/jessyInk_export.py
index 71907e276..1c7cc8c37 100755
--- a/share/extensions/jessyInk_export.py
+++ b/share/extensions/jessyInk_export.py
@@ -31,8 +31,6 @@ import zipfile
import glob
import re
-inkex.localize()
-
def propStrToDict(inStr):
dictio = {}
diff --git a/share/extensions/jessyInk_keyBindings.py b/share/extensions/jessyInk_keyBindings.py
index df50f4447..2e2b48c7d 100755
--- a/share/extensions/jessyInk_keyBindings.py
+++ b/share/extensions/jessyInk_keyBindings.py
@@ -26,7 +26,6 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-inkex.localize()
class JessyInk_CustomKeyBindings(inkex.Effect):
modes = ('slide', 'index', 'drawing')
diff --git a/share/extensions/jessyInk_masterSlide.py b/share/extensions/jessyInk_masterSlide.py
index eca7711ff..edaf751fa 100755
--- a/share/extensions/jessyInk_masterSlide.py
+++ b/share/extensions/jessyInk_masterSlide.py
@@ -26,8 +26,6 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-inkex.localize()
-
class JessyInk_MasterSlide(inkex.Effect):
def __init__(self):
# Call the base class constructor.
diff --git a/share/extensions/jessyInk_mouseHandler.py b/share/extensions/jessyInk_mouseHandler.py
index fafc8eec3..3b64e7658 100755
--- a/share/extensions/jessyInk_mouseHandler.py
+++ b/share/extensions/jessyInk_mouseHandler.py
@@ -28,7 +28,6 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-inkex.localize()
class JessyInk_CustomMouseHandler(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/jessyInk_summary.py b/share/extensions/jessyInk_summary.py
index feff79b37..c5be47a49 100755
--- a/share/extensions/jessyInk_summary.py
+++ b/share/extensions/jessyInk_summary.py
@@ -26,7 +26,6 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-inkex.localize()
def propStrToList(str):
list = []
diff --git a/share/extensions/jessyInk_transitions.py b/share/extensions/jessyInk_transitions.py
index bfd75584c..f463b2fb5 100755
--- a/share/extensions/jessyInk_transitions.py
+++ b/share/extensions/jessyInk_transitions.py
@@ -26,7 +26,6 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-inkex.localize()
class JessyInk_Transitions(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/jessyInk_video.py b/share/extensions/jessyInk_video.py
index bca98e9a7..bd20d837f 100755
--- a/share/extensions/jessyInk_video.py
+++ b/share/extensions/jessyInk_video.py
@@ -30,8 +30,6 @@ import re
from lxml import etree
from copy import deepcopy
-inkex.localize()
-
class JessyInk_Effects(inkex.Effect):
def __init__(self):
# Call the base class constructor.
diff --git a/share/extensions/jessyInk_view.py b/share/extensions/jessyInk_view.py
index ee71a1d35..37a30758f 100755
--- a/share/extensions/jessyInk_view.py
+++ b/share/extensions/jessyInk_view.py
@@ -26,7 +26,6 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-inkex.localize()
def propStrToList(str):
list = []
diff --git a/share/extensions/radiusrand.inx b/share/extensions/jitternodes.inx
index 38e7d6c4c..817fbd276 100644
--- a/share/extensions/radiusrand.inx
+++ b/share/extensions/jitternodes.inx
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>Jitter nodes</_name>
- <id>org.ekips.filter.radiusrand</id>
- <dependency type="executable" location="extensions">radiusrand.py</dependency>
+ <id>org.ekips.filter.jitternodes</id>
+ <dependency type="executable" location="extensions">jitternodes.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
<param name="tab" type="notebook">
<page name="Options" _gui-text="Options">
@@ -10,7 +10,12 @@
<param name="radiusy" type="float" min="0.0" max="1000.0" _gui-text="Maximum displacement in Y (px):">10.0</param>
<param name="end" type="boolean" _gui-text="Shift nodes">true</param>
<param name="ctrl" type="boolean" _gui-text="Shift node handles">false</param>
- <param name="norm" type="boolean" _gui-text="Use normal distribution">true</param>
+ <param name="dist" type="enum" _gui-text="Distribution of the displacements:">
+ <_item value="Uniform">Uniform</_item>
+ <_item value="Pareto">Pareto</_item>
+ <_item value="Gaussian">Gaussian</_item>
+ <_item value="Lognorm">Log-normal</_item>
+ </param>
</page>
<page name="Help" _gui-text="Help">
<_param name="title" type="description">This effect randomly shifts the nodes (and optionally node handles) of the selected path.</_param>
@@ -23,6 +28,6 @@
</effects-menu>
</effect>
<script>
- <command reldir="extensions" interpreter="python">radiusrand.py</command>
+ <command reldir="extensions" interpreter="python">jitternodes.py</command>
</script>
</inkscape-extension>
diff --git a/share/extensions/radiusrand.py b/share/extensions/jitternodes.py
index e4585ccd4..d6f5ce36d 100755
--- a/share/extensions/radiusrand.py
+++ b/share/extensions/jitternodes.py
@@ -1,10 +1,11 @@
-#!/usr/bin/env python
+#!/usr/bin/env python
'''
+Copyright (C) 2012 Juan Pablo Carbajal ajuanpi-dev@gmail.com
Copyright (C) 2005 Aaron Spike, aaron@ekips.org
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -18,40 +19,63 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
'''
import random, math, inkex, cubicsuperpath
-def randomize((x, y), rx, ry, norm):
- if norm:
- r = abs(random.normalvariate(0.0,0.5*max(rx, ry)))
- else:
- r = random.uniform(0.0,max(rx, ry))
- a = random.uniform(0.0,2*math.pi)
- x += math.cos(a)*rx
- y += math.sin(a)*ry
+def randomize((x, y), rx, ry, dist):
+
+ if dist == "Gaussian":
+ r1 = random.gauss(0.0,rx)
+ r2 = random.gauss(0.0,ry)
+ elif dist == "Pareto":
+ '''
+ sign is used ot fake a double sided pareto distribution.
+ for parameter value between 1 and 2 the distribution has infinite variance
+ I truncate the distribution to a high value and then normalize it.
+ The idea is to get spiky distributions, any distribution with long-tails is
+ good (ideal would be Levy distribution).
+ '''
+ sign = random.uniform(-1.0,1.0)
+
+ r1 = min(random.paretovariate(1.0), 20.0)/20.0
+ r2 = min(random.paretovariate(1.0), 20.0)/20.0
+
+ r1 = rx * math.copysign(r1, sign)
+ r2 = ry * math.copysign(r2, sign)
+ elif dist == "Lognorm":
+ sign = random.uniform(-1.0,1.0)
+ r1 = rx * math.copysign(random.lognormvariate(0.0,1.0)/3.5,sign)
+ r2 = ry * math.copysign(random.lognormvariate(0.0,1.0)/3.5,sign)
+ elif dist == "Uniform":
+ r1 = random.uniform(-rx,rx)
+ r2 = random.uniform(-ry,ry)
+
+ x += r1
+ y += r2
+
return [x, y]
-class RadiusRandomize(inkex.Effect):
+class JitterNodes(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
self.OptionParser.add_option("--title")
self.OptionParser.add_option("-x", "--radiusx",
- action="store", type="float",
+ action="store", type="float",
dest="radiusx", default=10.0,
help="Randomly move nodes and handles within this radius, X")
self.OptionParser.add_option("-y", "--radiusy",
- action="store", type="float",
+ action="store", type="float",
dest="radiusy", default=10.0,
help="Randomly move nodes and handles within this radius, Y")
self.OptionParser.add_option("-c", "--ctrl",
- action="store", type="inkbool",
+ action="store", type="inkbool",
dest="ctrl", default=True,
help="Randomize control points")
self.OptionParser.add_option("-e", "--end",
- action="store", type="inkbool",
+ action="store", type="inkbool",
dest="end", default=True,
help="Randomize nodes")
- self.OptionParser.add_option("-n", "--norm",
- action="store", type="inkbool",
- dest="norm", default=True,
- help="Use normal distribution")
+ self.OptionParser.add_option("-d", "--dist",
+ action="store", type="string",
+ dest="dist", default="Uniform",
+ help="Choose the distribution of the displacements")
self.OptionParser.add_option("--tab",
action="store", type="string",
dest="tab",
@@ -65,20 +89,20 @@ class RadiusRandomize(inkex.Effect):
for subpath in p:
for csp in subpath:
if self.options.end:
- delta=randomize([0,0], self.options.radiusx, self.options.radiusy, self.options.norm)
- csp[0][0]+=delta[0]
- csp[0][1]+=delta[1]
- csp[1][0]+=delta[0]
- csp[1][1]+=delta[1]
- csp[2][0]+=delta[0]
- csp[2][1]+=delta[1]
+ delta=randomize([0,0], self.options.radiusx, self.options.radiusy, self.options.dist)
+ csp[0][0]+=delta[0]
+ csp[0][1]+=delta[1]
+ csp[1][0]+=delta[0]
+ csp[1][1]+=delta[1]
+ csp[2][0]+=delta[0]
+ csp[2][1]+=delta[1]
if self.options.ctrl:
- csp[0]=randomize(csp[0], self.options.radiusx, self.options.radiusy, self.options.norm)
- csp[2]=randomize(csp[2], self.options.radiusx, self.options.radiusy, self.options.norm)
+ csp[0]=randomize(csp[0], self.options.radiusx, self.options.radiusy, self.options.dist)
+ csp[2]=randomize(csp[2], self.options.radiusx, self.options.radiusy, self.options.dist)
node.set('d',cubicsuperpath.formatPath(p))
if __name__ == '__main__':
- e = RadiusRandomize()
+ e = JitterNodes()
e.affect()
diff --git a/share/extensions/launch_webbrowser.py b/share/extensions/launch_webbrowser.py
index 27a738e38..1ee6caca8 100755
--- a/share/extensions/launch_webbrowser.py
+++ b/share/extensions/launch_webbrowser.py
@@ -5,7 +5,6 @@ import threading
from optparse import OptionParser
# local library
import inkex
-inkex.localize()
class VisitWebSiteWithoutLockingInkscape(threading.Thread):
def __init__(self):
diff --git a/share/extensions/markers_strokepaint.py b/share/extensions/markers_strokepaint.py
index 76284b234..d922ef474 100755
--- a/share/extensions/markers_strokepaint.py
+++ b/share/extensions/markers_strokepaint.py
@@ -24,7 +24,6 @@ import copy
import inkex
import simplestyle
-inkex.localize()
class MyEffect(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/measure.py b/share/extensions/measure.py
index fe981e39e..2711727cf 100755
--- a/share/extensions/measure.py
+++ b/share/extensions/measure.py
@@ -41,7 +41,6 @@ import simpletransform
import cubicsuperpath
import bezmisc
-inkex.localize()
# On darwin, fall back to C in cases of
# - incorrect locale IDs (see comments in bug #406662)
diff --git a/share/extensions/pathalongpath.py b/share/extensions/pathalongpath.py
index 93bb99d6b..8c3d42016 100755
--- a/share/extensions/pathalongpath.py
+++ b/share/extensions/pathalongpath.py
@@ -42,7 +42,6 @@ import bezmisc
import pathmodifier
import simpletransform
-inkex.localize()
def flipxy(path):
for pathcomp in path:
diff --git a/share/extensions/pathmodifier.py b/share/extensions/pathmodifier.py
index d80b6eeae..bf45dd77a 100755
--- a/share/extensions/pathmodifier.py
+++ b/share/extensions/pathmodifier.py
@@ -39,8 +39,6 @@ import bezmisc
import simplestyle
from simpletransform import *
-inkex.localize()
-
####################################################################
##-- zOrder computation...
##-- this should be shipped out in a separate file. inkex.py?
diff --git a/share/extensions/pathscatter.py b/share/extensions/pathscatter.py
index 92af6ad76..361e8f8e1 100755
--- a/share/extensions/pathscatter.py
+++ b/share/extensions/pathscatter.py
@@ -44,8 +44,6 @@ import bezmisc
import pathmodifier
import simpletransform
-inkex.localize()
-
def zSort(inNode,idList):
sortedList=[]
theid = inNode.get("id")
diff --git a/share/extensions/perspective.py b/share/extensions/perspective.py
index febe34a22..ea08b98dc 100755
--- a/share/extensions/perspective.py
+++ b/share/extensions/perspective.py
@@ -34,8 +34,6 @@ import cubicsuperpath
import simpletransform
from ffgeom import *
-inkex.localize()
-
# third party
try:
from numpy import *
diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py
index 1c4a683c1..14b41df18 100755
--- a/share/extensions/plotter.py
+++ b/share/extensions/plotter.py
@@ -27,7 +27,6 @@ import gettext
import hpgl_decoder
import hpgl_encoder
import inkex
-inkex.localize()
class Plot(inkex.Effect):
@@ -268,4 +267,4 @@ if __name__ == '__main__':
e = Plot()
e.affect()
-# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
diff --git a/share/extensions/polyhedron_3d.py b/share/extensions/polyhedron_3d.py
index 7ce8b1c6d..86203d4bc 100755
--- a/share/extensions/polyhedron_3d.py
+++ b/share/extensions/polyhedron_3d.py
@@ -57,8 +57,6 @@ import inkex
import simplestyle
from simpletransform import computePointInNode
-inkex.localize()
-
# third party
try:
from numpy import *
diff --git a/share/extensions/print_win32_vector.py b/share/extensions/print_win32_vector.py
index bf8e89845..7151a3f88 100755
--- a/share/extensions/print_win32_vector.py
+++ b/share/extensions/print_win32_vector.py
@@ -35,8 +35,6 @@ import simplestyle
import simpletransform
import cubicsuperpath
-inkex.localize()
-
if not inkex.sys.platform.startswith('win'):
exit(_("sorry, this will run only on Windows, exiting..."))
diff --git a/share/extensions/render_alphabetsoup.py b/share/extensions/render_alphabetsoup.py
index 06c82cb2d..4aa6af4c7 100755
--- a/share/extensions/render_alphabetsoup.py
+++ b/share/extensions/render_alphabetsoup.py
@@ -35,8 +35,6 @@ import bezmisc
import simplepath
import simpletransform
-inkex.localize()
-
syntax = render_alphabetsoup_config.syntax
alphabet = render_alphabetsoup_config.alphabet
units = render_alphabetsoup_config.units
diff --git a/share/extensions/render_barcode_datamatrix.py b/share/extensions/render_barcode_datamatrix.py
index 82c827bb8..659e74de6 100755
--- a/share/extensions/render_barcode_datamatrix.py
+++ b/share/extensions/render_barcode_datamatrix.py
@@ -55,8 +55,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import inkex
import simplestyle
from simpletransform import computePointInNode
-
-inkex.localize()
symbols = {
'sq10': (10, 10),
diff --git a/share/extensions/render_barcode_qrcode.py b/share/extensions/render_barcode_qrcode.py
index d4cffd3e2..062488ca1 100755
--- a/share/extensions/render_barcode_qrcode.py
+++ b/share/extensions/render_barcode_qrcode.py
@@ -4,8 +4,6 @@ import math, sys
import inkex
from simpletransform import computePointInNode
-inkex.localize()
-
#QRCode for Python
#
#Ported from the Javascript library by Sam Curren
diff --git a/share/extensions/replace_font.py b/share/extensions/replace_font.py
index 090920ced..06d8a8661 100755
--- a/share/extensions/replace_font.py
+++ b/share/extensions/replace_font.py
@@ -34,8 +34,6 @@ import sys
import inkex
import simplestyle
-inkex.localize()
-
text_tags = ['{http://www.w3.org/2000/svg}tspan',
'{http://www.w3.org/2000/svg}text',
'{http://www.w3.org/2000/svg}flowRoot',
diff --git a/share/extensions/restack.py b/share/extensions/restack.py
index 67d738a13..d38e18b52 100755
--- a/share/extensions/restack.py
+++ b/share/extensions/restack.py
@@ -24,7 +24,6 @@ THE SOFTWARE.
import inkex, os, csv, math, random
from pathmodifier import zSort
-inkex.localize()
try:
from subprocess import Popen, PIPE
diff --git a/share/extensions/summersnight.py b/share/extensions/summersnight.py
index 7af4bb571..abc9327e5 100755
--- a/share/extensions/summersnight.py
+++ b/share/extensions/summersnight.py
@@ -26,8 +26,6 @@ import simplepath
import simpletransform
from ffgeom import *
-inkex.localize()
-
try:
from subprocess import Popen, PIPE
bsubprocess = True
diff --git a/share/extensions/svg_and_media_zip_output.py b/share/extensions/svg_and_media_zip_output.py
index c5963b721..fb1ddd823 100755
--- a/share/extensions/svg_and_media_zip_output.py
+++ b/share/extensions/svg_and_media_zip_output.py
@@ -51,7 +51,7 @@ import inkex
import simplestyle
locale.setlocale(locale.LC_ALL, '')
-inkex.localize()
+inkex.localize() # TODO: test if it's still needed now that localize is called from inkex.
class CompressedMediaOutput(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/svgcalendar.py b/share/extensions/svgcalendar.py
index 9f221a807..29dee262b 100755
--- a/share/extensions/svgcalendar.py
+++ b/share/extensions/svgcalendar.py
@@ -37,7 +37,6 @@ from datetime import *
import inkex
import simplestyle
-inkex.localize()
class SVGCalendar (inkex.Effect):
diff --git a/share/extensions/test/radiusrand.test.py b/share/extensions/test/jitternodes.test.py
index 99cb2972b..699752af2 100755
--- a/share/extensions/test/radiusrand.test.py
+++ b/share/extensions/test/jitternodes.test.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# This is only the automatic generated test file for ../radiusrand.py
+# This is only the automatic generated test file for ../jitternodes.py
# This must be filled with real tests and this commentary
# must be cleared.
# If you want to help, read the python unittest documentation:
@@ -10,15 +10,15 @@ import sys
sys.path.append('..') # this line allows to import the extension code
import unittest
-from radiusrand import *
+from jitternodes import *
-class RadiusRandomizeBasicTest(unittest.TestCase):
+class JitterNodesBasicTest(unittest.TestCase):
#def setUp(self):
def test_run_without_parameters(self):
args = [ 'minimal-blank.svg' ]
- e = RadiusRandomize()
+ e = JitterNodes()
e.affect( args, False )
#self.assertEqual( e.something, 'some value', 'A commentary about that.' )
diff --git a/share/extensions/uniconv-ext.py b/share/extensions/uniconv-ext.py
index f4c80b5d6..c84ee2e0a 100755
--- a/share/extensions/uniconv-ext.py
+++ b/share/extensions/uniconv-ext.py
@@ -26,8 +26,6 @@ import sys
from run_command import run
import inkex
-inkex.localize()
-
cmd = None
try:
diff --git a/share/extensions/uniconv_output.py b/share/extensions/uniconv_output.py
index 93236483d..7815137b6 100755
--- a/share/extensions/uniconv_output.py
+++ b/share/extensions/uniconv_output.py
@@ -34,7 +34,6 @@ import sys
import tempfile
# local library
import inkex
-inkex.localize()
def run(command_format, prog_name, uniconv_format):
outfile = tempfile.mktemp(uniconv_format)
diff --git a/share/extensions/voronoi2svg.py b/share/extensions/voronoi2svg.py
index d4740b7f5..5232fb81e 100644
--- a/share/extensions/voronoi2svg.py
+++ b/share/extensions/voronoi2svg.py
@@ -38,7 +38,6 @@ import simpletransform
import voronoi
import random
-inkex.localize()
class Point:
def __init__(self,x,y):
diff --git a/share/extensions/web-set-att.py b/share/extensions/web-set-att.py
index 0dafcb974..40246e2c5 100755
--- a/share/extensions/web-set-att.py
+++ b/share/extensions/web-set-att.py
@@ -20,8 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import inkwebeffect
import inkex
-inkex.localize()
-
class InkWebTransmitAtt(inkwebeffect.InkWebEffect):
def __init__(self):
diff --git a/share/extensions/web-transmit-att.py b/share/extensions/web-transmit-att.py
index bae6956b2..34c97cff3 100755
--- a/share/extensions/web-transmit-att.py
+++ b/share/extensions/web-transmit-att.py
@@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import inkwebeffect
import inkex
-inkex.localize()
class InkWebTransmitAtt(inkwebeffect.InkWebEffect):
diff --git a/share/extensions/webslicer_create_group.py b/share/extensions/webslicer_create_group.py
index 47e5f706f..567c911aa 100755
--- a/share/extensions/webslicer_create_group.py
+++ b/share/extensions/webslicer_create_group.py
@@ -20,8 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from webslicer_effect import *
import inkex
-inkex.localize()
-
class WebSlicer_CreateGroup(WebSlicer_Effect):
def __init__(self):
diff --git a/share/extensions/webslicer_create_rect.py b/share/extensions/webslicer_create_rect.py
index b68cd9ad8..865b74304 100755
--- a/share/extensions/webslicer_create_rect.py
+++ b/share/extensions/webslicer_create_rect.py
@@ -20,8 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from webslicer_effect import *
import inkex
-inkex.localize()
-
class WebSlicer_CreateRect(WebSlicer_Effect):
def __init__(self):
diff --git a/share/extensions/webslicer_export.py b/share/extensions/webslicer_export.py
index 47db5369c..9acb9d6c3 100755
--- a/share/extensions/webslicer_export.py
+++ b/share/extensions/webslicer_export.py
@@ -24,8 +24,6 @@ import tempfile
from webslicer_effect import *
import inkex
-inkex.localize()
-
class WebSlicer_Export(WebSlicer_Effect):
diff --git a/share/extensions/wireframe_sphere.py b/share/extensions/wireframe_sphere.py
index 64a1266b6..9a8d646e3 100755
--- a/share/extensions/wireframe_sphere.py
+++ b/share/extensions/wireframe_sphere.py
@@ -61,7 +61,6 @@ import inkex
import simplestyle
from simpletransform import computePointInNode
-inkex.localize()
#SVG OUTPUT FUNCTIONS ================================================
def draw_SVG_ellipse((rx, ry), (cx, cy), width, parent, start_end=(0,2*pi),transform='' ):