summaryrefslogtreecommitdiffstats
path: root/share/extensions
diff options
context:
space:
mode:
authorMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:56:11 +0000
committerMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:56:11 +0000
commit132e83fd6f6124731dc773ae2978d115ca492ef2 (patch)
treeb561a4dbbacd7eecbdbae3fa220a353375ccecf8 /share/extensions
parentupdated to trunk (diff)
parent[Bug #1695016] Xaml export misses some radialGradients. (diff)
downloadinkscape-132e83fd6f6124731dc773ae2978d115ca492ef2.tar.gz
inkscape-132e83fd6f6124731dc773ae2978d115ca492ef2.zip
merged with latest version of lpe-bool and trunk
(bzr r14862.2.3)
Diffstat (limited to 'share/extensions')
-rw-r--r--share/extensions/Barcode/Makefile.am23
-rw-r--r--share/extensions/CMakeLists.txt28
-rw-r--r--share/extensions/Makefile.am42
-rw-r--r--share/extensions/Poly3DObjects/Makefile.am33
-rw-r--r--share/extensions/ai_input.inx2
-rw-r--r--share/extensions/alphabet_soup/Makefile.am78
-rw-r--r--share/extensions/cgm_input.inx2
-rwxr-xr-xshare/extensions/convert2dashes.py18
-rwxr-xr-xshare/extensions/dimension.py1
-rw-r--r--share/extensions/docinfo.inx21
-rw-r--r--share/extensions/dpi90to96.inx23
-rw-r--r--share/extensions/dpi96to90.inx23
-rwxr-xr-xshare/extensions/dpiswitcher.py425
-rwxr-xr-xshare/extensions/draw_from_triangle.py26
-rwxr-xr-xshare/extensions/dxf_input.py4
-rwxr-xr-xshare/extensions/dxf_outlines.py14
-rwxr-xr-xshare/extensions/embedimage.py1
-rw-r--r--share/extensions/empty_desktop.inx3
-rwxr-xr-xshare/extensions/export_gimp_palette.py2
-rwxr-xr-xshare/extensions/extractimage.py2
-rwxr-xr-xshare/extensions/extrude.py20
-rw-r--r--share/extensions/frame.inx32
-rw-r--r--share/extensions/frame.py175
-rwxr-xr-xshare/extensions/funcplot.py2
-rwxr-xr-xshare/extensions/gcodetools.py6
-rw-r--r--share/extensions/gcodetools_about.inx6
-rw-r--r--share/extensions/gcodetools_area.inx10
-rw-r--r--share/extensions/gcodetools_check_for_updates.inx2
-rw-r--r--share/extensions/gcodetools_dxf_points.inx4
-rw-r--r--share/extensions/gcodetools_engraving.inx4
-rw-r--r--share/extensions/gcodetools_graffiti.inx4
-rw-r--r--share/extensions/gcodetools_lathe.inx14
-rw-r--r--share/extensions/gcodetools_orientation_points.inx4
-rw-r--r--share/extensions/gcodetools_path_to_gcode.inx6
-rw-r--r--share/extensions/gcodetools_prepare_path_for_plasma.inx4
-rw-r--r--share/extensions/gcodetools_tools_library.inx4
-rwxr-xr-xshare/extensions/generate_voronoi.py2
-rwxr-xr-xshare/extensions/gimp_xcf.py4
-rw-r--r--share/extensions/grid_cartesian.inx45
-rwxr-xr-xshare/extensions/grid_cartesian.py3
-rw-r--r--share/extensions/grid_polar.inx33
-rwxr-xr-xshare/extensions/grid_polar.py3
-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.py5
-rwxr-xr-xshare/extensions/image_attributes.py6
-rw-r--r--share/extensions/ink2canvas/Makefile.am9
-rwxr-xr-xshare/extensions/inkex.py2
-rw-r--r--share/extensions/inkscape_help_askaquestion.inx22
-rw-r--r--share/extensions/inkscape_help_keys.inx2
-rw-r--r--share/extensions/inkscape_help_relnotes.inx2
-rwxr-xr-xshare/extensions/interp.py5
-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.py4
-rwxr-xr-xshare/extensions/markers_strokepaint.py1
-rwxr-xr-xshare/extensions/measure.py7
-rwxr-xr-xshare/extensions/pathalongpath.py1
-rwxr-xr-xshare/extensions/pathmodifier.py2
-rwxr-xr-xshare/extensions/pathscatter.py2
-rwxr-xr-xshare/extensions/perspective.py4
-rwxr-xr-xshare/extensions/plotter.py13
-rw-r--r--share/extensions/plt_input.inx2
-rw-r--r--share/extensions/plt_output.inx2
-rwxr-xr-xshare/extensions/polyhedron_3d.py3
-rw-r--r--share/extensions/prepare_file_save_as.inx16
-rwxr-xr-xshare/extensions/prepare_file_save_as.py58
-rw-r--r--share/extensions/prepare_print_win32_vector.inx16
-rwxr-xr-xshare/extensions/prepare_print_win32_vector.py64
-rwxr-xr-xshare/extensions/print_win32_vector.py16
-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
-rw-r--r--share/extensions/restack.inx4
-rwxr-xr-xshare/extensions/restack.py1
-rwxr-xr-xshare/extensions/run_command.py7
-rwxr-xr-xshare/extensions/scour.inkscape.py40
-rw-r--r--share/extensions/scour.inx16
-rw-r--r--share/extensions/seamless_pattern.inx2
-rw-r--r--share/extensions/sk1_input.inx2
-rw-r--r--share/extensions/sk1_output.inx2
-rwxr-xr-xshare/extensions/summersnight.py2
-rw-r--r--share/extensions/svg2xaml.xsl2
-rwxr-xr-xshare/extensions/svg_and_media_zip_output.py4
-rwxr-xr-xshare/extensions/svgcalendar.py1
-rwxr-xr-xshare/extensions/synfig_output.py1
-rw-r--r--share/extensions/test/Makefile.am60
-rwxr-xr-xshare/extensions/test/frame_test.py120
-rwxr-xr-xshare/extensions/test/jitternodes.test.py (renamed from share/extensions/test/radiusrand.test.py)8
-rwxr-xr-xshare/extensions/test/run-all-extension-tests27
-rwxr-xr-xshare/extensions/test/simpletransform.test.py28
-rw-r--r--share/extensions/test/svg/simpletransform.test.svg8
-rw-r--r--share/extensions/test/svg/single_box.svg62
-rwxr-xr-x[-rw-r--r--]share/extensions/test/test_template.py.txt0
-rwxr-xr-xshare/extensions/text_sentencecase.py2
-rwxr-xr-xshare/extensions/text_titlecase.py2
-rw-r--r--share/extensions/ungroup_deep.inx19
-rwxr-xr-xshare/extensions/ungroup_deep.py281
-rwxr-xr-xshare/extensions/uniconv-ext.py7
-rwxr-xr-xshare/extensions/uniconv_output.py6
-rwxr-xr-x[-rw-r--r--]share/extensions/voronoi.py0
-rwxr-xr-x[-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
-rw-r--r--share/extensions/wmf_input.inx2
-rw-r--r--share/extensions/wmf_output.inx2
-rw-r--r--share/extensions/xaml2svg/Makefile.am19
124 files changed, 1747 insertions, 549 deletions
diff --git a/share/extensions/Barcode/Makefile.am b/share/extensions/Barcode/Makefile.am
deleted file mode 100644
index 08e2f58b4..000000000
--- a/share/extensions/Barcode/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-
-barcodedir = $(datadir)/inkscape/extensions/Barcode
-
-barcode_DATA = \
- Base.py \
- BaseEan.py \
- Code128.py \
- Code39Ext.py \
- Code39.py \
- Code25i.py \
- Code93.py \
- Ean13.py \
- Ean8.py \
- Ean5.py \
- Ean2.py \
- __init__.py \
- Rm4scc.py \
- Upca.py \
- Upce.py
-
-EXTRA_DIST = \
- $(barcode_DATA)
-
diff --git a/share/extensions/CMakeLists.txt b/share/extensions/CMakeLists.txt
index 74819309d..47dfbe0a0 100644
--- a/share/extensions/CMakeLists.txt
+++ b/share/extensions/CMakeLists.txt
@@ -17,7 +17,7 @@ file(GLOB _FILES
"*.inx"
)
-install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions)
+install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions)
# Install the executable scripts
file(GLOB _SCRIPTS
@@ -26,17 +26,27 @@ file(GLOB _SCRIPTS
"*.sh"
"*.rb"
)
-
-install(PROGRAMS ${_SCRIPTS} DESTINATION ${SHARE_INSTALL}/inkscape/extensions)
+# These files don't need the +x bit
+set(_SCRIPTS_NOEXEC
+ "hersheydata.py"
+ "hpgl_decoder.py"
+ "hpgl_encoder.py"
+ "simplepath.py"
+ "simplestyle.py"
+ "simpletransform.py"
+)
+list(REMOVE_ITEM _SCRIPTS ${_SCRIPTS_NOEXEC})
+install(PROGRAMS ${_SCRIPTS} DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions)
+install(FILES ${_SCRIPTS_NOEXEC} DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions)
file(GLOB _FILES "alphabet_soup/*.svg")
-install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/alphabet_soup)
+install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions/alphabet_soup)
file(GLOB _FILES "Barcode/*.py")
-install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/Barcode)
+install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions/Barcode)
file(GLOB _FILES "Poly3DObjects/*.obj")
-install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/Poly3DObjects)
+install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions/Poly3DObjects)
# file(GLOB _FILES
# "test/*.svg"
@@ -45,10 +55,10 @@ install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/Poly3DO
# "test/*.js"
# "test/run-all-extension-tests"
# )
-# install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/test)
+# install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions/test)
file(GLOB _FILES "ink2canvas/*.py")
-install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/ink2canvas)
+install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions/ink2canvas)
file(GLOB _FILES "xaml2svg/*.xsl")
-install(FILES ${_FILES} DESTINATION ${SHARE_INSTALL}/inkscape/extensions/xaml2svg)
+install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions/xaml2svg)
diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am
deleted file mode 100644
index f247cd8bb..000000000
--- a/share/extensions/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-
-SUBDIRS = \
- alphabet_soup \
- Barcode \
- ink2canvas \
- Poly3DObjects \
- test \
- xaml2svg
-
-extensiondir = $(datadir)/inkscape/extensions
-
-otherstuffdir = $(datadir)/inkscape/extensions
-
-moduledir = $(datadir)/inkscape/extensions
-
-extension_SCRIPTS = \
- $(wildcard $(srcdir)/*.py) \
- $(wildcard $(srcdir)/*.pl) \
- $(wildcard $(srcdir)/*.sh) \
- $(wildcard $(srcdir)/*.rb)
-
-otherstuff_DATA = \
- fontfix.conf \
- inkweb.js \
- jessyInk.js \
- jessyInk_core_mouseHandler_noclick.js \
- jessyInk_core_mouseHandler_zoomControl.js \
- aisvg.xslt \
- colors.xml \
- jessyInk_video.svg \
- seamless_pattern.svg \
- svg2fxg.xsl \
- svg2xaml.xsl \
- xaml2svg.xsl \
- inkscape.extension.rng
-
-module_DATA = $(wildcard $(srcdir)/*.inx)
-
-EXTRA_DIST = \
- $(extension_SCRIPTS) $(otherstuff_DATA) $(module_DATA)
-
-
diff --git a/share/extensions/Poly3DObjects/Makefile.am b/share/extensions/Poly3DObjects/Makefile.am
deleted file mode 100644
index 82a81af42..000000000
--- a/share/extensions/Poly3DObjects/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-
-Poly3DObjectsdir = $(datadir)/inkscape/extensions/Poly3DObjects
-
-Poly3DObjects_DATA = \
- cube.obj \
- cuboct.obj \
- dodec.obj \
- great_dodec.obj \
- great_rhombicosidodec.obj \
- great_rhombicuboct.obj \
- great_stel_dodec.obj \
- icos.obj \
- icosidodec.obj \
- jessens_orthog_icos.obj \
- methane.obj \
- oct.obj \
- rhomb_dodec.obj \
- rhomb_triacont.obj \
- rh_axes.obj \
- small_rhombicosidodec.obj \
- small_rhombicuboct.obj \
- small_triam_icos.obj \
- snub_cube.obj \
- snub_dodec.obj \
- szilassi.obj \
- tet.obj \
- trunc_cube.obj \
- trunc_dodec.obj \
- trunc_icos.obj \
- trunc_oct.obj \
- trunc_tet.obj
-
-EXTRA_DIST = $(Poly3DObjects_DATA)
diff --git a/share/extensions/ai_input.inx b/share/extensions/ai_input.inx
index a48825840..bc4919500 100644
--- a/share/extensions/ai_input.inx
+++ b/share/extensions/ai_input.inx
@@ -6,7 +6,7 @@
<input>
<extension>.ai</extension>
<mimetype>image/x-adobe-illustrator</mimetype>
- <_filetypename>Adobe Illustrator 8.0 and below (*.ai)</_filetypename>
+ <_filetypename>Adobe Illustrator 8.0 and below (UC) (*.ai)</_filetypename>
<_filetypetooltip>Open files saved with Adobe Illustrator 8.0 or
older</_filetypetooltip>
</input>
diff --git a/share/extensions/alphabet_soup/Makefile.am b/share/extensions/alphabet_soup/Makefile.am
deleted file mode 100644
index 004da4e8c..000000000
--- a/share/extensions/alphabet_soup/Makefile.am
+++ /dev/null
@@ -1,78 +0,0 @@
-
-alphabet_soupdir = $(datadir)/inkscape/extensions/alphabet_soup
-
-alphabet_soup_DATA = \
- 2.svg \
- 3.svg \
- 6.svg \
- 7.svg \
- abase.svg \
- a.svg \
- acap.svg \
- bar2.svg \
- barcap.svg \
- bar.svg \
- b.svg \
- Cblob.svg \
- Chook.svg \
- cross.svg \
- cserif.svg \
- c.svg \
- Ctail.svg \
- Delta.svg \
- Eb.svg \
- epsilon.svg \
- Eserif.svg \
- e.svg \
- Et.svg \
- f.svg \
- gamma.svg \
- G.svg \
- h2.svg \
- hcap.svg \
- h.svg \
- IBSerif.svg \
- idot.svg \
- ITSerif.svg \
- j.svg \
- k.svg \
- Lb.svg \
- lserif.svg \
- l.svg \
- Lt.svg \
- mcap.svg \
- m.svg \
- n.svg \
- ocap.svg \
- Ocross.svg \
- o.svg \
- Oterm.svg \
- P.svg \
- Q.svg \
- question.svg \
- Rblock.svg \
- rcap.svg \
- r.svg \
- serif.svg \
- s.svg \
- Tb.svg \
- tserif.svg \
- t.svg \
- Tt.svg \
- U.svg \
- vcap.svg \
- vserl.svg \
- vserr.svg \
- Vser.svg \
- v.svg \
- Xh.svg \
- Xne.svg \
- Xnw.svg \
- x.svg \
- Xvb.svg \
- Xvt.svg \
- yogh.svg \
- y.svg \
- z.svg
-
-EXTRA_DIST = $(alphabet_soup_DATA)
diff --git a/share/extensions/cgm_input.inx b/share/extensions/cgm_input.inx
index e6fee4860..5c1ccd937 100644
--- a/share/extensions/cgm_input.inx
+++ b/share/extensions/cgm_input.inx
@@ -6,7 +6,7 @@
<input>
<extension>.cgm</extension>
<mimetype>application/x-xcgm</mimetype>
- <_filetypename>Computer Graphics Metafile files (*.cgm)</_filetypename>
+ <_filetypename>Computer Graphics Metafile files (UC) (*.cgm)</_filetypename>
<_filetypetooltip>Open Computer Graphics Metafile files</_filetypetooltip>
</input>
<script>
diff --git a/share/extensions/convert2dashes.py b/share/extensions/convert2dashes.py
index 3910d8e82..1d1ba9736 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 i, 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/docinfo.inx b/share/extensions/docinfo.inx
new file mode 100644
index 000000000..c3d76a960
--- /dev/null
+++ b/share/extensions/docinfo.inx
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+ <_name>DOC Info</_name>
+ <id>org.inkscape.docinfo</id>
+ <dependency type="executable" location="extensions">dpiswitcher.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+ <param name="action" type="notebook" gui-hidden="true">
+ <page name="page_info" _gui-text="Show page info">
+ <_param name="d" type="description">Choose this tab if you would like to see page info previously to apply DPI Switcher.</_param>
+ </page>
+ </param>
+ <effect needs-live-preview="false">
+ <object-type>all</object-type>
+ <effects-menu>
+ <submenu _name="Document"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">dpiswitcher.py</command>
+ </script>
+</inkscape-extension>
diff --git a/share/extensions/dpi90to96.inx b/share/extensions/dpi90to96.inx
new file mode 100644
index 000000000..e7ad4a895
--- /dev/null
+++ b/share/extensions/dpi90to96.inx
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+ <_name>DPI 90 to 96</_name>
+ <id>org.inkscape.dpi90to96</id>
+ <dependency type="executable" location="extensions">dpiswitcher.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+ <param name="action" type="notebook" gui-hidden="true">
+ <page name="dpi_swicher" >
+ <param name="switcher" type="enum" gui-hidden="true">
+ <item value="0">DPI Switch from 90 to 96</item>
+ </param>
+ </page>
+ </param>
+ <effect needs-live-preview="false">
+ <object-type>all</object-type>
+ <effects-menu>
+ <submenu _name="Document"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">dpiswitcher.py</command>
+ </script>
+</inkscape-extension>
diff --git a/share/extensions/dpi96to90.inx b/share/extensions/dpi96to90.inx
new file mode 100644
index 000000000..11d1cb40b
--- /dev/null
+++ b/share/extensions/dpi96to90.inx
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+ <_name>DPI 96 to 90</_name>
+ <id>org.inkscape.dpi96to90</id>
+ <dependency type="executable" location="extensions">dpiswitcher.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+ <param name="action" type="notebook" gui-hidden="true">
+ <page name="dpi_swicher" >
+ <param name="switcher" type="enum" gui-hidden="true">
+ <item value="1">DPI Switch from 96 to 90</item>
+ </param>
+ </page>
+ </param>
+ <effect needs-live-preview="false">
+ <object-type>all</object-type>
+ <effects-menu>
+ <submenu _name="Document"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">dpiswitcher.py</command>
+ </script>
+</inkscape-extension>
diff --git a/share/extensions/dpiswitcher.py b/share/extensions/dpiswitcher.py
new file mode 100755
index 000000000..317616db5
--- /dev/null
+++ b/share/extensions/dpiswitcher.py
@@ -0,0 +1,425 @@
+#!/usr/bin/env python
+'''
+This extension scales a document to fit different SVG DPI -90/96-
+
+Copyright (C) 2012 Jabiertxo Arraiza, jabier.arraiza@marker.es
+Copyright (C) 2016 su_v, <suv-sf@users.sf.net>
+
+Version 0.6 - DPI Switcher
+
+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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Changes since v0.5:
+ - transform all top-level containers and graphics elements
+ - support scientific notation in SVG lengths
+ - fix scaling with existing matrix() (use functions from simpletransform.py)
+ - support different units for document width, height attributes
+ - improve viewBox support (syntax, offset)
+ - support common cases of text-put-on-path in SVG root
+ - support common cases of <use> references in SVG root
+ - examples from http://tavmjong.free.fr/INKSCAPE/UNITS/ tested
+
+TODO:
+ - check grids/guides created with 0.91:
+ http://tavmjong.free.fr/INKSCAPE/UNITS/units_mm_nv_90dpi.svg
+ - check <symbol> instances
+ - check more <use> and text-on-path cases (reverse scaling needed?)
+ - scale perspective of 3dboxes
+
+'''
+# standard libraries
+import sys
+import re
+import string
+import math
+from lxml import etree
+# local libraries
+import inkex
+import simpletransform
+import simplestyle
+
+
+# globals
+SKIP_CONTAINERS = [
+ 'defs',
+ 'glyph',
+ 'marker',
+ 'mask',
+ 'missing-glyph',
+ 'pattern',
+ 'symbol',
+]
+CONTAINER_ELEMENTS = [
+ 'a',
+ 'g',
+ 'switch',
+]
+GRAPHICS_ELEMENTS = [
+ 'circle',
+ 'ellipse',
+ 'image',
+ 'line',
+ 'path',
+ 'polygon',
+ 'polyline',
+ 'rect',
+ 'text',
+ 'use',
+]
+
+def is_3dbox(element):
+ """Check whether element is an Inkscape 3dbox type."""
+ return element.get(inkex.addNS('type', 'sodipodi')) == 'inkscape:box3d'
+
+
+def is_use(element):
+ """Check whether element is of type <text>."""
+ return element.tag == inkex.addNS('use', 'svg')
+
+
+def is_text(element):
+ """Check whether element is of type <text>."""
+ return element.tag == inkex.addNS('text', 'svg')
+
+
+def is_text_on_path(element):
+ """Check whether text element is put on a path."""
+ if is_text(element):
+ text_path = element.find(inkex.addNS('textPath', 'svg'))
+ if text_path is not None and len(text_path):
+ return True
+ return False
+
+
+def is_sibling(element1, element2):
+ """Check whether element1 and element2 are siblings of same parent."""
+ return element2 in element1.getparent()
+
+
+def is_in_defs(doc, element):
+ """Check whether element is in defs."""
+ if element is not None:
+ defs = doc.find('defs', namespaces=inkex.NSS)
+ if defs is not None:
+ return linked_node in defs.iterdescendants()
+ return False
+
+
+def get_linked(doc, element):
+ """Return linked element or None."""
+ if element is not None:
+ href = element.get(inkex.addNS('href', 'xlink'), None)
+ if href is not None:
+ linked_id = href[href.find('#')+1:]
+ path = '//*[@id="%s"]' % linked_id
+ el_list = doc.xpath(path, namespaces=inkex.NSS)
+ if isinstance(el_list, list) and len(el_list):
+ return el_list[0]
+ else:
+ return None
+
+
+def check_3dbox(svg, element, scale_x, scale_y):
+ """Check transformation for 3dbox element."""
+ skip = False
+ if skip:
+ # 3dbox elements ignore preserved transforms
+ # FIXME: manually update geometry of 3dbox?
+ pass
+ return skip
+
+
+def check_text_on_path(svg, element, scale_x, scale_y):
+ """Check whether to skip scaling a text put on a path."""
+ skip = False
+ path = get_linked(svg, element.find(inkex.addNS('textPath', 'svg')))
+ if not is_in_defs(svg, path):
+ if is_sibling(element, path):
+ # skip common element scaling if both text and path are siblings
+ skip = True
+ # scale offset
+ if 'transform' in element.attrib:
+ mat = simpletransform.parseTransform(element.get('transform'))
+ mat[0][2] *= scale_x
+ mat[1][2] *= scale_y
+ element.set('transform', simpletransform.formatTransform(mat))
+ # scale font size
+ mat = simpletransform.parseTransform(
+ 'scale({},{})'.format(scale_x, scale_y))
+ det = abs(mat[0][0]*mat[1][1] - mat[0][1]*mat[1][0])
+ descrim = math.sqrt(abs(det))
+ prop = 'font-size'
+ # outer text
+ sdict = simplestyle.parseStyle(element.get('style'))
+ if prop in sdict:
+ sdict[prop] = float(sdict[prop]) * descrim
+ element.set('style', simplestyle.formatStyle(sdict))
+ # inner tspans
+ for child in element.iterdescendants():
+ if child.tag == inkex.addNS('tspan', 'svg'):
+ sdict = simplestyle.parseStyle(child.get('style'))
+ if prop in sdict:
+ sdict[prop] = float(sdict[prop]) * descrim
+ child.set('style', simplestyle.formatStyle(sdict))
+ return skip
+
+
+def check_use(svg, element, scale_x, scale_y):
+ """Check whether to skip scaling an instanciated element (<use>)."""
+ skip = False
+ path = get_linked(svg, element)
+ if not is_in_defs(svg, path):
+ if is_sibling(element, path):
+ skip = True
+ # scale offset
+ if 'transform' in element.attrib:
+ mat = simpletransform.parseTransform(element.get('transform'))
+ mat[0][2] *= scale_x
+ mat[1][2] *= scale_y
+ element.set('transform', simpletransform.formatTransform(mat))
+ return skip
+
+
+class DPISwitcher(inkex.Effect):
+
+ def __init__(self):
+ inkex.Effect.__init__(self)
+ self.OptionParser.add_option("--switcher", action="store",
+ type="string", dest="switcher", default="0",
+ help="Select the DPI switch you want")
+ self.OptionParser.add_option("--action", action="store",
+ type="string", dest="action",
+ default=None, help="")
+ self.factor_a = 90.0/96.0
+ self.factor_b = 96.0/90.0
+ self.units = "px"
+ self.unitExponent = 1.0
+
+ # dictionaries of unit to user unit conversion factors
+ __uuconvLegacy = {
+ 'in': 90.0,
+ 'pt': 1.25,
+ 'px': 1.0,
+ 'mm': 3.5433070866,
+ 'cm': 35.433070866,
+ 'm': 3543.3070866,
+ 'km': 3543307.0866,
+ 'pc': 15.0,
+ 'yd': 3240.0,
+ 'ft': 1080.0,
+ }
+ __uuconv = {
+ 'in': 96.0,
+ 'pt': 1.33333333333,
+ 'px': 1.0,
+ 'mm': 3.77952755913,
+ 'cm': 37.7952755913,
+ 'm': 3779.52755913,
+ 'km': 3779527.55913,
+ 'pc': 16.0,
+ 'yd': 3456.0,
+ 'ft': 1152.0,
+ }
+
+ def parse_length(self, length, percent=False):
+ """Parse SVG length."""
+ if self.options.switcher == "0": # dpi90to96
+ known_units = self.__uuconvLegacy.keys()
+ else: # dpi96to90
+ known_units = self.__uuconv.keys()
+ if percent:
+ unitmatch = re.compile('(%s)$' % '|'.join(known_units + ['%']))
+ else:
+ unitmatch = re.compile('(%s)$' % '|'.join(known_units))
+ param = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)')
+ p = param.match(length)
+ u = unitmatch.search(length)
+ val = 100 # fallback: assume default length of 100
+ unit = 'px' # fallback: assume 'px' unit
+ if p:
+ val = float(p.string[p.start():p.end()])
+ if u:
+ unit = u.string[u.start():u.end()]
+ return (val, unit)
+
+ def convert_length(self, val, unit):
+ """Convert length to self.units if unit differs."""
+ doc_unit = self.units or 'px'
+ if unit != doc_unit:
+ if self.options.switcher == "0": # dpi90to96
+ val_px = val * self.__uuconvLegacy[unit]
+ val = val_px / (self.__uuconvLegacy[doc_unit] / self.__uuconvLegacy['px'])
+ unit = doc_unit
+ else: # dpi96to90
+ val_px = val * self.__uuconv[unit]
+ val = val_px / (self.__uuconv[doc_unit] / self.__uuconv['px'])
+ unit = doc_unit
+ return (val, unit)
+
+ def check_attr_unit(self, element, attr, unit_list):
+ """Check unit of attribute value, match to units in *unit_list*."""
+ if attr in element.attrib:
+ unit = self.parse_length(element.get(attr), percent=True)[1]
+ return unit in unit_list
+
+ def scale_attr_val(self, element, attr, unit_list, factor):
+ """Scale attribute value if unit matches one in *unit_list*."""
+ if attr in element.attrib:
+ val, unit = self.parse_length(element.get(attr), percent=True)
+ if unit in unit_list:
+ element.set(attr, '{}{}'.format(val * factor, unit))
+
+ def scaleRoot(self, svg):
+ """Scale all top-level elements in SVG root."""
+
+ # update viewport
+ widthNumber = self.parse_length(svg.get('width'))[0]
+ heightNumber = self.convert_length(*self.parse_length(svg.get('height')))[0]
+ widthDoc = widthNumber * self.factor_a * self.unitExponent
+ heightDoc = heightNumber * self.factor_a * self.unitExponent
+
+ if svg.get('height'):
+ svg.set('height', str(heightDoc))
+ if svg.get('width'):
+ svg.set('width', str(widthDoc))
+
+ # update viewBox
+ if svg.get('viewBox'):
+ viewboxstring = re.sub(' +|, +|,',' ', svg.get('viewBox'))
+ viewboxlist = [float(i) for i in viewboxstring.strip().split(' ', 4)]
+ svg.set('viewBox','{} {} {} {}'.format(*[(val * self.factor_a) for val in viewboxlist]))
+
+ # update guides, grids
+ if self.options.switcher == "1":
+ # FIXME: dpi96to90 only?
+ self.scaleGuides(svg)
+ self.scaleGrid(svg)
+
+ for element in svg: # iterate all top-level elements of SVGRoot
+
+ # init variables
+ tag = etree.QName(element).localname
+ width_scale = self.factor_a
+ height_scale = self.factor_a
+
+ if tag in GRAPHICS_ELEMENTS or tag in CONTAINER_ELEMENTS:
+
+ # test for specific elements to skip from scaling
+ if is_3dbox(element):
+ if check_3dbox(svg, element, width_scale, height_scale):
+ continue
+ if is_text_on_path(element):
+ if check_text_on_path(svg, element, width_scale, height_scale):
+ continue
+ if is_use(element):
+ if check_use(svg, element, width_scale, height_scale):
+ continue
+
+ # relative units ('%') in presentation attributes
+ for attr in ['width', 'height']:
+ self.scale_attr_val(element, attr, ['%'], 1.0 / self.factor_a)
+ for attr in ['x', 'y']:
+ self.scale_attr_val(element, attr, ['%'], 1.0 / self.factor_a)
+
+ # set preserved transforms on top-level elements
+ if width_scale != 1.0 and height_scale != 1.0:
+ mat = simpletransform.parseTransform(
+ 'scale({},{})'.format(width_scale, height_scale))
+ simpletransform.applyTransformToNode(mat, element)
+
+ def scaleElement(self, m):
+ pass # TODO: optionally scale graphics elements only?
+
+ def scaleGuides(self, svg):
+ xpathStr = '//sodipodi:guide'
+ guides = svg.xpath(xpathStr, namespaces=inkex.NSS)
+ for guide in guides:
+ point = string.split(guide.get("position"), ",")
+ guide.set("position", str(float(point[0].strip()) * self.factor_a ) + "," + str(float(point[1].strip()) * self.factor_a ))
+
+ def scaleGrid(self, svg):
+ xpathStr = '//inkscape:grid'
+ grids = svg.xpath(xpathStr, namespaces=inkex.NSS)
+ for grid in grids:
+ grid.set("units", "px")
+ if grid.get("spacingx"):
+ spacingx = str(float(re.sub("[a-zA-Z]", "", grid.get("spacingx"))) * self.factor_a) + "px"
+ grid.set("spacingx", str(spacingx))
+ if grid.get("spacingy"):
+ spacingy = str(float(re.sub("[a-zA-Z]", "", grid.get("spacingy"))) * self.factor_a) + "px"
+ grid.set("spacingy", str(spacingy))
+ if grid.get("originx"):
+ originx = str(float(re.sub("[a-zA-Z]", "", grid.get("originx"))) * self.factor_a) + "px"
+ grid.set("originx", str(originx))
+ if grid.get("originy"):
+ originy = str(float(re.sub("[a-zA-Z]", "", grid.get("originy"))) * self.factor_a) + "px"
+ grid.set("originy", str(originy))
+
+ def effect(self):
+ saveout = sys.stdout
+ sys.stdout = sys.stderr
+ svg = self.document.getroot()
+ if self.options.action == '"page_info"':
+ print ":::SVG document related info:::"
+ print "version: " + str(svg.get(inkex.addNS('version',u'inkscape')))
+ width = svg.get('width')
+ if width:
+ print "width: " + width
+ height = svg.get('height')
+ if height:
+ print "height: " + height
+ viewBox = svg.get('viewBox')
+ if viewBox:
+ print "viewBox: " + viewBox
+ namedview = svg.find(inkex.addNS('namedview', 'sodipodi'))
+ docunits= namedview.get(inkex.addNS('document-units', 'inkscape'))
+ if docunits:
+ print "document-units: " + docunits
+ units = namedview.get('units')
+ if units:
+ print "units: " + units
+ xpathStr = '//sodipodi:guide'
+ guides = svg.xpath(xpathStr, namespaces=inkex.NSS)
+ xpathStr = '//inkscape:grid'
+ if guides:
+ numberGuides = len(guides)
+ print "Document has " + str(numberGuides) + " guides"
+ grids = svg.xpath(xpathStr, namespaces=inkex.NSS)
+ i = 1
+ for grid in grids:
+ print "Grid number " + str(i) + ": Units: " + grid.get("units")
+ i = i+1
+ else:
+ if self.options.switcher == "0":
+ self.factor_a = 96.0/90.0
+ self.factor_b = 90.0/96.0
+ namedview = svg.find(inkex.addNS('namedview', 'sodipodi'))
+ namedview.set(inkex.addNS('document-units', 'inkscape'), "px")
+ self.units = self.parse_length(svg.get('width'))[1]
+ if self.units and self.units <> "px" and self.units <> "" and self.units <> "%":
+ if self.options.switcher == "0":
+ self.unitExponent = 1.0/(self.factor_a/self.__uuconv[self.units])
+ else:
+ self.unitExponent = 1.0/(self.factor_a/self.__uuconvLegacy[self.units])
+ self.scaleRoot(svg);
+ sys.stdout = saveout
+
+
+if __name__ == '__main__':
+ effect = DPISwitcher()
+ effect.affect()
+
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
diff --git a/share/extensions/draw_from_triangle.py b/share/extensions/draw_from_triangle.py
index 5efabfbba..fd966b1d1 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
@@ -148,8 +147,6 @@ def get_n_points_from_path( node, n):#returns a list of first n points (x,y) in
if len(xi) == n and len(yi) == n:
points = [] # returned pairs of points
for i in range(n):
- xi[i] = Draw_From_Triangle.unittouu(e, str(xi[i]) + 'px')
- yi[i] = Draw_From_Triangle.unittouu(e, str(yi[i]) + 'px')
points.append( [ xi[i], yi[i] ] )
else:
#inkex.errormsg(_('Error: Not enough nodes to gather coordinates.')) #fail silently and exit, rather than invoke an error console
@@ -177,21 +174,24 @@ def cot(x):#cotangent(x)
return 1/tan(x)
def report_properties( params ):#report to the Inkscape console using errormsg
- inkex.errormsg(_("Side Length 'a' (px): " + str( params[0][0] ) ))
- inkex.errormsg(_("Side Length 'b' (px): " + str( params[0][1] ) ))
- inkex.errormsg(_("Side Length 'c' (px): " + str( params[0][2] ) ))
- inkex.errormsg(_("Angle 'A' (radians): " + str( params[1][0] ) ))
- inkex.errormsg(_("Angle 'B' (radians): " + str( params[1][1] ) ))
- inkex.errormsg(_("Angle 'C' (radians): " + str( params[1][2] ) ))
- inkex.errormsg(_("Semiperimeter (px): " + str( params[4][1] ) ))
- inkex.errormsg(_("Area (px^2): " + str( params[4][0] ) ))
+ # TODO: unit identifier needs solution for arbitrary document scale
+ unit = Draw_From_Triangle.getDocumentUnit(e)
+
+ inkex.errormsg(_("Side Length 'a' ({0}): {1}").format(unit, str(params[0][0])) )
+ inkex.errormsg(_("Side Length 'b' ({0}): {1}").format(unit, str(params[0][1])) )
+ inkex.errormsg(_("Side Length 'c' ({0}): {1}").format(unit, str(params[0][2])) )
+ inkex.errormsg(_("Angle 'A' (radians): {}").format(str(params[1][0])) )
+ inkex.errormsg(_("Angle 'B' (radians): {}").format(str(params[1][1])) )
+ inkex.errormsg(_("Angle 'C' (radians): {}").format(params[1][2]) )
+ inkex.errormsg(_("Semiperimeter (px): {}").format(params[4][1]) )
+ inkex.errormsg(_("Area ({0}^2): {1}").format(unit, str(params[4][0])) )
return
-
+
class Style(object): #container for style information
def __init__(self, options):
#dot markers
- self.d_rad = 4 #dot marker radius
+ self.d_rad = Draw_From_Triangle.unittouu(e, '4px') #dot marker radius
self.d_th = Draw_From_Triangle.unittouu(e, '2px') #stroke width
self.d_fill= '#aaaaaa' #fill colour
self.d_col = '#000000' #stroke colour
diff --git a/share/extensions/dxf_input.py b/share/extensions/dxf_input.py
index 30adb73f9..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)
@@ -482,6 +481,9 @@ while line[0] and (line[1] != 'ENDSEC' or not inENTITIES):
elif vals[groups['8']]: # use Common Layer Name
if not vals[groups['8']][0]:
vals[groups['8']][0] = '0' # use default name
+ if not layer_nodes.has_key(vals[groups['8']][0]):
+ attribs = {inkex.addNS('groupmode','inkscape'): 'layer', inkex.addNS('label','inkscape'): '%s' % vals[groups['8']][0]}
+ layer_nodes[vals[groups['8']][0]] = inkex.etree.SubElement(doc.getroot(), 'g', attribs)
layer = layer_nodes[vals[groups['8']][0]]
color = '#000000' # default color
if vals[groups['8']]:
diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py
index 0e8cb7f62..74b4ed465 100755
--- a/share/extensions/dxf_outlines.py
+++ b/share/extensions/dxf_outlines.py
@@ -40,12 +40,12 @@ import cubicsuperpath
import coloreffect
import dxf_templates
-inkex.localize()
-
try:
from numpy import *
from numpy.linalg import solve
except:
+ # Initialize gettext for messages outside an inkex derived class
+ inkex.localize()
inkex.errormsg(_("Failed to import the numpy or numpy.linalg modules. These modules are required by this extension. Please install them and try again."))
inkex.sys.exit()
@@ -340,9 +340,17 @@ class MyEffect(inkex.Effect):
scale = eval(self.options.units)
if not scale:
scale = 25.4/96 # if no scale is specified, assume inch as baseunit
+ scale /= self.unittouu('1px')
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()
+ # process viewBox height attribute to correct page scaling
+ viewBox = doc.get('viewBox')
+ if viewBox:
+ viewBox2 = viewBox.split(',')
+ if len(viewBox2) < 4:
+ viewBox2 = viewBox.split(' ')
+ scale *= h / self.unittouu(self.addDocumentUnit(viewBox2[3]))
+ self.groupmat = [[[scale, 0.0, 0.0], [0.0, -scale, h*scale]]]
self.process_group(doc)
if self.options.ROBO == 'true':
self.ROBO_output()
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/empty_desktop.inx b/share/extensions/empty_desktop.inx
index 75762b660..449f2ec66 100644
--- a/share/extensions/empty_desktop.inx
+++ b/share/extensions/empty_desktop.inx
@@ -16,6 +16,9 @@
<item value="1920x1080">1920x1080 (FHD)</item>
<item value="1920x1200">1920x1200 (WUXGA)</item>
<item value="2560x1600">2560x1600 (WQXGA)</item>
+ <item value="3840x2160">3840x2160 (4K)</item>
+ <item value="5120x2880">5120x2880 (5K)</item>
+ <item value="7680x4320">7680x4320 (8K)</item>
</param>
<!-- Maximum size is '16k' -->
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..b11d0d36c 100755
--- a/share/extensions/extrude.py
+++ b/share/extensions/extrude.py
@@ -19,11 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# local library
import inkex
import simplepath
+import simplestyle
import simpletransform
import cubicsuperpath
-inkex.localize()
-
class Extrude(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
@@ -70,10 +69,23 @@ class Extrude(inkex.Effect):
ele = inkex.etree.Element('{http://www.w3.org/2000/svg}path')
paths[0].xpath('..')[0].append(ele)
ele.set('d', simplepath.formatPath(line))
- ele.set('style', 'fill:none;stroke:#000000;stroke-opacity:1;stroke-width:1;')
+ style = {
+ 'fill': 'none',
+ 'stroke': '#000000',
+ 'stroke-opacity': 1,
+ 'stroke-width': self.unittouu('1px'),
+ }
+ ele.set('style', simplestyle.formatStyle(style))
elif self.options.mode.lower() == 'polygons':
g = inkex.etree.Element('{http://www.w3.org/2000/svg}g')
- g.set('style', 'fill:#000000;stroke:#000000;fill-opacity:0.3;stroke-width:2;stroke-opacity:0.6;')
+ style = {
+ 'fill': '#000000',
+ 'fill-opacity': 0.3,
+ 'stroke': '#000000',
+ 'stroke-opacity': 0.6,
+ 'stroke-width': self.unittouu('2px'),
+ }
+ g.set('style', simplestyle.formatStyle(style))
paths[0].xpath('..')[0].append(g)
for comp in verts:
for n,v in enumerate(comp):
diff --git a/share/extensions/frame.inx b/share/extensions/frame.inx
new file mode 100644
index 000000000..a2b011430
--- /dev/null
+++ b/share/extensions/frame.inx
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+ <_name>Frame</_name>
+ <id>frame</id>
+ <dependency type="executable" location="extensions">frame.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+ <param name="tab" type="notebook">
+ <page name="stroke" gui-text="Stroke">
+ <param name="stroke_color" type="color" gui-text="Stroke Color:">000000FF</param>
+ </page>
+ <page name="fill" gui-text="Fill">
+ <param name="fill_color" type="color" gui-text="Fill Color:">00000000</param>
+ </page>
+ </param>
+ <param name="position" type="optiongroup" appearance="minimal" gui-text="Position">
+ <option value="outside">Outside</option>
+ <option value="inside">Inside</option>
+ </param>
+ <param name="clip" type="boolean" gui-text="Clip"></param>
+ <param name="group" type="boolean" gui-text="Group"></param>
+ <param name="width" type="float" min="0" max="100" gui-text="Width(px)">2</param>
+ <param name="corner_radius" type="int" min="0" max="1000" gui-text="Corner Radius">0</param>
+ <effect>
+ <object-type>all</object-type>
+ <effects-menu>
+ <submenu _name="Render"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">frame.py</command>
+ </script>
+</inkscape-extension> \ No newline at end of file
diff --git a/share/extensions/frame.py b/share/extensions/frame.py
new file mode 100644
index 000000000..f6d54e180
--- /dev/null
+++ b/share/extensions/frame.py
@@ -0,0 +1,175 @@
+#!/usr/bin/env python
+"""
+An Inkscape extension that creates a frame around a selected object.
+
+Copyright (C) 2016 Richard White, rwhite8282@gmail.com
+
+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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+
+# These two lines are only needed if you don't put the script directly into
+# the installation directory
+import sys
+sys.path.append('/usr/share/inkscape/extensions')
+
+import inkex
+import simplestyle
+from simpletransform import *
+from simplestyle import *
+
+
+def get_picker_data(value):
+ """ Returns color data in style string format.
+ value -- The value returned from the color picker.
+ Returns an object with color and opacity properties.
+ """
+ v = '%08X' % (value & 0xFFFFFFFF)
+ color = '#' + v[0:-2].rjust(6, '0')
+ opacity = '%1.2f' % (float(int(v[6:].rjust(2, '0'), 16))/255)
+ return type('', (object,), {'color':color, 'opacity':opacity})()
+
+
+def size_box(box, delta):
+ """ Returns a box with an altered size.
+ delta -- The amount the box should grow.
+ Returns a box with an altered size.
+ """
+ return ((box[0]-delta), (box[1]+delta), (box[2]-delta), (box[3]+delta))
+
+
+# Frame maker Inkscape effect extension
+class Frame(inkex.Effect):
+ """ An Inkscape extension that creates a frame around a selected object.
+ """
+ def __init__(self):
+ inkex.Effect.__init__(self)
+ self.defs = None
+
+ # Parse the options.
+ self.OptionParser.add_option('--clip',
+ action='store', type='inkbool',
+ dest='clip', default=False)
+ self.OptionParser.add_option('--corner_radius',
+ action='store', type='int',
+ dest='corner_radius', default=0)
+ self.OptionParser.add_option('--fill_color',
+ action='store', type='int',
+ dest='fill_color', default='00000000')
+ self.OptionParser.add_option('--group',
+ action='store', type='inkbool',
+ dest='group', default=False)
+ self.OptionParser.add_option('--position',
+ action='store', type='string',
+ dest='position', default='outside')
+ self.OptionParser.add_option('--stroke_color',
+ action='store', type='int',
+ dest='stroke_color', default='00000000')
+ self.OptionParser.add_option('--tab',
+ action='store', type='string',
+ dest='tab', default='object')
+ self.OptionParser.add_option('--width',
+ action='store', type='float',
+ dest='width', default=2)
+
+
+ def add_clip(self, node, clip_path):
+ """ Adds a new clip path node to the defs and sets
+ the clip-path on the node.
+ node -- The node that will be clipped.
+ clip_path -- The clip path object.
+ """
+ if self.defs is None:
+ defs_nodes = self.document.getroot().xpath('//svg:defs', namespaces=inkex.NSS)
+ if defs_nodes:
+ self.defs = defs_nodes[0]
+ else:
+ inkex.errormsg('Could not locate defs node for clip.')
+ return
+ clip = inkex.etree.SubElement(self.defs, inkex.addNS('clipPath','svg'))
+ clip.append(copy.deepcopy(clip_path))
+ clip_id = self.uniqueId('clipPath')
+ clip.set('id', clip_id)
+ node.set('clip-path', 'url(#%s)' % str(clip_id))
+
+
+ def add_frame(self, parent, name, box, style, radius=0):
+ """ Adds a new frame to the parent object.
+ parent -- The parent that the frame will be added to.
+ name -- The name of the new frame object.
+ box -- The boundary box of the node.
+ style -- The style used to draw the path.
+ radius -- The corner radius of the frame.
+ returns a new frame node.
+ """
+ r = min([radius, (abs(box[1]-box[0])/2), (abs(box[3]-box[2])/2)])
+ if (radius > 0):
+ d = ' '.join(str(x) for x in
+ ['M', box[0], (box[2]+r)
+ ,'A', r, r, '0 0 1', (box[0]+r), box[2]
+ ,'L', (box[1]-r), box[2]
+ ,'A', r, r, '0 0 1', box[1], (box[2]+r)
+ ,'L', box[1], (box[3]-r)
+ ,'A', r, r, '0 0 1', (box[1]-r), box[3]
+ ,'L', (box[0]+r), box[3]
+ ,'A', r, r, '0 0 1', box[0], (box[3]-r), 'Z'])
+ else:
+ d = ' '.join(str(x) for x in
+ ['M', box[0], box[2]
+ ,'L', box[1], box[2]
+ ,'L', box[1], box[3]
+ ,'L', box[0], box[3], 'Z'])
+
+ attributes = {'style':style, inkex.addNS('label','inkscape'):name, 'd':d}
+ return inkex.etree.SubElement(parent, inkex.addNS('path','svg'), attributes )
+
+
+ def effect(self):
+ """ Performs the effect.
+ """
+ # Get the style values.
+ corner_radius = self.options.corner_radius
+ stroke_data = get_picker_data(self.options.stroke_color)
+ fill_data = get_picker_data(self.options.fill_color)
+
+ # Determine common properties.
+ parent = self.current_layer
+ position = self.options.position
+ width = self.options.width
+ style = simplestyle.formatStyle({'stroke':stroke_data.color
+ , 'stroke-opacity':stroke_data.opacity
+ , 'stroke-width':str(width)
+ , 'fill':(fill_data.color if (fill_data.opacity > 0) else 'none')
+ , 'fill-opacity':fill_data.opacity})
+
+ for id, node in self.selected.iteritems():
+ box = computeBBox([node])
+ if 'outside' == position:
+ box = size_box(box, (width/2))
+ else:
+ box = size_box(box, -(width/2))
+ name = 'Frame'
+ frame = self.add_frame(parent, name, box, style, corner_radius)
+ if self.options.clip:
+ self.add_clip(node, frame)
+ if self.options.group:
+ group = inkex.etree.SubElement(node.getparent(),inkex.addNS('g','svg'))
+ group.append(node)
+ group.append(frame)
+
+
+if __name__ == '__main__': #pragma: no cover
+ # Create effect instance and apply it.
+ effect = Frame()
+ effect.affect() \ No newline at end of file
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..23a3e1a1c 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):
@@ -3435,7 +3433,7 @@ class Gcodetools(inkex.Effect):
for subpath in csp :
for sp1, sp2 in zip(subpath,subpath[1:]) :
polygon.add([csp_segment_convex_hull(sp1,sp2)])
- #print_("Redused edges count from", sum([len(poly) for poly in polygon.polygon ]) )
+ #print_("Reduced edges count from", sum([len(poly) for poly in polygon.polygon ]) )
polygon.hull()
original_paths += [path]
polygons += [polygon]
@@ -3576,7 +3574,7 @@ class Gcodetools(inkex.Effect):
self.OptionParser.add_option("", "--biarc-max-split-depth", action="store", type="int", dest="biarc_max_split_depth", default="4", help="Defines maximum depth of splitting while approximating using biarcs.")
self.OptionParser.add_option("", "--path-to-gcode-order", action="store", type="string", dest="path_to_gcode_order", default="path by path", help="Defines cutting order path by path or layer by layer.")
self.OptionParser.add_option("", "--path-to-gcode-depth-function",action="store", type="string", dest="path_to_gcode_depth_function", default="zd", help="Path to gcode depth function.")
- self.OptionParser.add_option("", "--path-to-gcode-sort-paths", action="store", type="inkbool", dest="path_to_gcode_sort_paths", default=True, help="Sort paths to reduse rapid distance.")
+ self.OptionParser.add_option("", "--path-to-gcode-sort-paths", action="store", type="inkbool", dest="path_to_gcode_sort_paths", default=True, help="Sort paths to reduce rapid distance.")
self.OptionParser.add_option("", "--comment-gcode", action="store", type="string", dest="comment_gcode", default="", help="Comment Gcode")
self.OptionParser.add_option("", "--comment-gcode-from-properties",action="store", type="inkbool", dest="comment_gcode_from_properties", default=False,help="Get additional comments from Object Properties")
diff --git a/share/extensions/gcodetools_about.inx b/share/extensions/gcodetools_about.inx
index c1016477d..4a1579181 100644
--- a/share/extensions/gcodetools_about.inx
+++ b/share/extensions/gcodetools_about.inx
@@ -8,9 +8,9 @@
<param name='active-tab' type="notebook">
<page name='about' _gui-text='About'>
- <_param name="help" type="description">Gcodetools was developed to make simple Gcode from Inkscape's paths. Gcode is a special format which is used in most of CNC machines. So Gcodetools allows you to use Inkscape as CAM program.
+ <_param name="help" type="description" xml:space="preserve">Gcodetools was developed to make simple Gcode from Inkscape's paths. Gcode is a special format which is used in most of CNC machines. So Gcodetools allows you to use Inkscape as CAM program.
-It can be use with a lot of machine types:
+It can be used with a lot of machine types:
Mills
Lathes
Laser and Plasma cutters and engravers
@@ -22,7 +22,7 @@ To get more info visit developers page at http://www.cnc-club.ru/gcodetools</_pa
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
diff --git a/share/extensions/gcodetools_area.inx b/share/extensions/gcodetools_area.inx
index b487f2c54..8dbcb1e1f 100644
--- a/share/extensions/gcodetools_area.inx
+++ b/share/extensions/gcodetools_area.inx
@@ -12,7 +12,7 @@
<param name="area-inkscape-radius" type="float" min="-1000" max="1000" _gui-text="Area width:">-10</param>
<param name="area-tool-overlap" type="float" min="0" max="1" _gui-text="Area tool overlap (0..0.9):">0</param>
- <_param name="help" type="description">
+ <_param name="help" type="description" xml:space="preserve">
"Create area offset": creates several Inkscape path offsets to fill original path's area up to "Area radius" value.
Outlines start from "1/2 D" up to "Area width" total width with "D" steps where D is taken from the nearest tool definition ("Tool diameter" value).
@@ -37,7 +37,7 @@ Only one offset will be created if the "Area width" is equal to "1/2 D".
<_option value="mark with style">mark with style</_option>
<_option value="delete">delete</_option>
</param>
- <_param name="help" type="description">
+ <_param name="help" type="description" xml:space="preserve">
Usage:
1. Select all Area Offsets (gray outlines)
2. Object/Ungroup (Shift+Ctrl+G)
@@ -57,9 +57,9 @@ Suspected small objects will be marked out by colored arrows.
</param>
<param name="path-to-gcode-depth-function" type="string" _gui-text="Depth function:">d</param>
- <param name="path-to-gcode-sort-paths" type="boolean" _gui-text="Sort paths to reduse rapid distance">True</param>
+ <param name="path-to-gcode-sort-paths" type="boolean" _gui-text="Sort paths to reduce rapid distance">True</param>
- <_param name="help" type="description">
+ <_param name="help" type="description" xml:space="preserve">
Biarc interpolation tolerance is the maximum distance between path and its approximation.
The segment will be split into two segments if the distance between path's segment and its approximation exceeds biarc interpolation tolerance.
For depth function c=color intensity from 0.0 (white) to 1.0 (black), d is the depth defined by orientation points, s - surface defined by orientation points.
@@ -103,7 +103,7 @@ For depth function c=color intensity from 0.0 (white) to 1.0 (black), d is the d
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
diff --git a/share/extensions/gcodetools_check_for_updates.inx b/share/extensions/gcodetools_check_for_updates.inx
index 6eaa098a5..05cc97b1d 100644
--- a/share/extensions/gcodetools_check_for_updates.inx
+++ b/share/extensions/gcodetools_check_for_updates.inx
@@ -12,7 +12,7 @@
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
diff --git a/share/extensions/gcodetools_dxf_points.inx b/share/extensions/gcodetools_dxf_points.inx
index 4367353b9..06d655624 100644
--- a/share/extensions/gcodetools_dxf_points.inx
+++ b/share/extensions/gcodetools_dxf_points.inx
@@ -8,7 +8,7 @@
<param name='active-tab' type="notebook">
<page name='dxfpoints' _gui-text='DXF points'>
- <_param name="help" type="description">
+ <_param name="help" type="description" xml:space="preserve">
Convert selected objects to drill points (as dxf_import plugin does). Also you can save original shape. Only the start point of each curve will be used.
@@ -49,7 +49,7 @@ Also you can manually select object, open XML editor (Shift+Ctrl+X) and add or r
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
diff --git a/share/extensions/gcodetools_engraving.inx b/share/extensions/gcodetools_engraving.inx
index a488f45a1..6dd1a3c73 100644
--- a/share/extensions/gcodetools_engraving.inx
+++ b/share/extensions/gcodetools_engraving.inx
@@ -13,7 +13,7 @@
<param name="engraving-newton-iterations" type="int" min="2" max="10" _gui-text="Accuracy factor (2 low to 10 high):">4</param>
<param name="engraving-draw-calculation-paths" type="boolean" _gui-text="Draw additional graphics to see engraving path">false</param>
- <_param name="help" type="description">
+ <_param name="help" type="description" xml:space="preserve">
This function creates path to engrave letters or any shape with sharp angles.
Cutter's depth as a function of radius is defined by the tool.
Depth may be any Python expression. For instance:
@@ -61,7 +61,7 @@ ellipse.(minor axis r, major 4r).....: math.sqrt(max(0,r**2-w**2))*4</_param>
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
diff --git a/share/extensions/gcodetools_graffiti.inx b/share/extensions/gcodetools_graffiti.inx
index bcaec76d4..c2ea161d9 100644
--- a/share/extensions/gcodetools_graffiti.inx
+++ b/share/extensions/gcodetools_graffiti.inx
@@ -37,7 +37,7 @@ different X/Y scale)</_option>
<_item value="G20 (All units in inches)">in</_item>
</param>
- <_param name="help" type="description">
+ <_param name="help" type="description" xml:space="preserve">
Orientation points are used to calculate transformation (offset,scale,mirror,rotation in XY plane) of the path.
3-points mode only: do not put all three into one line (use 2-points mode instead).
@@ -88,7 +88,7 @@ Now press apply to create control points (independent set for each layer).
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
diff --git a/share/extensions/gcodetools_lathe.inx b/share/extensions/gcodetools_lathe.inx
index c74ae267c..4bb9888a6 100644
--- a/share/extensions/gcodetools_lathe.inx
+++ b/share/extensions/gcodetools_lathe.inx
@@ -19,15 +19,15 @@
<param name="lathe-z-axis-remap" type="string" _gui-text="Lathe Z axis remap:">Z</param>
</page>
- <page name='lathe_modify_path' _gui-text='Lathe modify path'>
- <_param name="help" type="description">
- This function modifies path so it will be able to be cut with the rectangular cutter.
+ <page name='lathe_modify_path' _gui-text='Lathe modify path'>
+ <_param name="help" type="description" xml:space="preserve">
+ This function modifies path so it will be possible to be cut it with a rectangular cutter.
</_param>
<param name="lathe-rectangular-cutter-width" type="float" precision="5" min="0" max="1000" _gui-text="Lathe width:">4</param>
</page>
- <page name='path-to-gcode' _gui-text='Path to Gcode'>
+ <page name='path-to-gcode' _gui-text='Path to Gcode'>
<param name="biarc-tolerance" type='float' precision="5" _gui-text='Biarc interpolation tolerance:'>1</param>
<param name="biarc-max-split-depth" type="int" _gui-text="Maximum splitting depth:">4</param>
<param name="path-to-gcode-order" _gui-text="Cutting order:" type="optiongroup" appearance="minimal">
@@ -37,9 +37,9 @@
</param>
<param name="path-to-gcode-depth-function" type="string" _gui-text="Depth function:">d</param>
- <param name="path-to-gcode-sort-paths" type="boolean" _gui-text="Sort paths to reduse rapid distance">True</param>
+ <param name="path-to-gcode-sort-paths" type="boolean" _gui-text="Sort paths to reduce rapid distance">True</param>
- <_param name="help" type="description">
+ <_param name="help" type="description" xml:space="preserve">
Biarc interpolation tolerance is the maximum distance between path and its approximation.
The segment will be split into two segments if the distance between path's segment and its approximation exceeds biarc interpolation tolerance.
For depth function c=color intensity from 0.0 (white) to 1.0 (black), d is the depth defined by orientation points, s - surface defined by orientation points.
@@ -83,7 +83,7 @@ For depth function c=color intensity from 0.0 (white) to 1.0 (black), d is the d
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
diff --git a/share/extensions/gcodetools_orientation_points.inx b/share/extensions/gcodetools_orientation_points.inx
index 604369881..9f07ff219 100644
--- a/share/extensions/gcodetools_orientation_points.inx
+++ b/share/extensions/gcodetools_orientation_points.inx
@@ -27,7 +27,7 @@ different X/Y scale)</_option>
<_item value="G20 (All units in inches)">in</_item>
</param>
- <_param name="help" type="description">
+ <_param name="help" type="description" xml:space="preserve">
Orientation points are used to calculate transformation (offset,scale,mirror,rotation in XY plane) of the path.
3-points mode only: do not put all three into one line (use 2-points mode instead).
@@ -42,7 +42,7 @@ Now press apply to create control points (independent set for each layer).
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
diff --git a/share/extensions/gcodetools_path_to_gcode.inx b/share/extensions/gcodetools_path_to_gcode.inx
index 39cc6571b..6862a40a4 100644
--- a/share/extensions/gcodetools_path_to_gcode.inx
+++ b/share/extensions/gcodetools_path_to_gcode.inx
@@ -17,9 +17,9 @@
</param>
<param name="path-to-gcode-depth-function" type="string" _gui-text="Depth function:">d</param>
- <param name="path-to-gcode-sort-paths" type="boolean" _gui-text="Sort paths to reduse rapid distance">True</param>
+ <param name="path-to-gcode-sort-paths" type="boolean" _gui-text="Sort paths to reduce rapid distance">True</param>
- <_param name="help" type="description">
+ <_param name="help" type="description" xml:space="preserve">
Biarc interpolation tolerance is the maximum distance between path and its approximation.
The segment will be split into two segments if the distance between path's segment and its approximation exceeds biarc interpolation tolerance.
For depth function c=color intensity from 0.0 (white) to 1.0 (black), d is the depth defined by orientation points, s - surface defined by orientation points.
@@ -63,7 +63,7 @@ For depth function c=color intensity from 0.0 (white) to 1.0 (black), d is the d
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
diff --git a/share/extensions/gcodetools_prepare_path_for_plasma.inx b/share/extensions/gcodetools_prepare_path_for_plasma.inx
index ab054714e..c6d77e7db 100644
--- a/share/extensions/gcodetools_prepare_path_for_plasma.inx
+++ b/share/extensions/gcodetools_prepare_path_for_plasma.inx
@@ -7,7 +7,7 @@
<dependency type="executable" location="extensions">inkex.py</dependency>
<param name='active-tab' type="notebook">
- <page name='plasma-prepare-path' _gui-text='Prepare path for plasma or laser cuters'>
+ <page name='plasma-prepare-path' _gui-text='Prepare path for plasma or laser cutters'>
<param name='in-out-path' type="boolean" _gui-text="Create in-out paths" >True</param>
<param name='in-out-path-len' type="float" precision="5" min="0" max="1000000" _gui-text='In-out path length:'>10</param>
<param name='in-out-path-point-max-dist' type="float" precision="5" min="0" max="1000000" _gui-text='In-out path max distance to reference point:'>10</param>
@@ -30,7 +30,7 @@
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
diff --git a/share/extensions/gcodetools_tools_library.inx b/share/extensions/gcodetools_tools_library.inx
index e7be0d996..7841c3130 100644
--- a/share/extensions/gcodetools_tools_library.inx
+++ b/share/extensions/gcodetools_tools_library.inx
@@ -23,7 +23,7 @@
</param>
- <_param name="help" type="description">
+ <_param name="help" type="description" xml:space="preserve">
Selected tool type fills appropriate default values. You can change these values using the Text tool later on.
The topmost (z order) tool in the active layer is used. If there is no tool inside the current layer it is taken from the upper layer.
@@ -33,7 +33,7 @@ Press Apply to create new tool.
</page>
<page name='help' _gui-text='Help'>
- <_param name="fullhelp" type="description">
+ <_param name="fullhelp" type="description" xml:space="preserve">
Gcodetools plug-in: converts paths to Gcode (using circular interpolation), makes offset paths and engraves sharp corners using cone cutters.
This plug-in calculates Gcode for paths using circular interpolation or linear motion when needed.
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..d79717828 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
@@ -178,7 +176,7 @@ class MyEffect(inkex.Effect):
if os.name == 'nt':
filename = filename.replace("\\", "/")
pngs.append(filename)
- names.append(name.encode('utf-8'))
+ names.append(name)
if (self.valid == 0):
self.clear_tmp()
diff --git a/share/extensions/grid_cartesian.inx b/share/extensions/grid_cartesian.inx
index 494aabf76..f053d80bb 100644
--- a/share/extensions/grid_cartesian.inx
+++ b/share/extensions/grid_cartesian.inx
@@ -4,27 +4,32 @@
<id>grid.cartesian</id>
<dependency type="executable" location="extensions">grid_cartesian.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
+
<param name="border_th" type="float" min="0" max="1000" _gui-text="Border Thickness (px):">3</param>
- <_param name="x_axis" type="description" appearance="header">X Axis</_param>
- <param name="x_divs" type="int" min="1" max="1000" _gui-text="Major X Divisions:">6</param>
- <param name="dx" type="float" min="1" max="1000" _gui-text="Major X Division Spacing (px):">100.0</param>
- <param name="x_subdivs" type="int" min="1" max="1000" _gui-text="Subdivisions per Major X Division:">2</param>
- <param name="x_log" type="boolean" _gui-text="Logarithmic X Subdiv. (Base given by entry above)">false</param>
- <param name="x_subsubdivs" type="int" min="1" max="1000" _gui-text="Subsubdivs. per X Subdivision:">5</param>
- <param name="x_half_freq" type="int" min="1" max="1000" _gui-text="Halve X Subsubdiv. Frequency after 'n' Subdivs. (log only):">4</param>
- <param name="x_divs_th" type="float" min="0" max="1000" _gui-text="Major X Division Thickness (px):">2</param>
- <param name="x_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor X Division Thickness (px):">1</param>
- <param name="x_subsubdivs_th" type="float" min="0" max="1000" _gui-text="Subminor X Division Thickness (px):">0.3</param>
- <_param name="y_axis" type="description" appearance="header">Y Axis</_param>
- <param name="y_divs" type="int" min="1" max="1000" _gui-text="Major Y Divisions:">5</param>
- <param name="dy" type="float" min="1" max="1000" _gui-text="Major Y Division Spacing (px):">100.0</param>
- <param name="y_subdivs" type="int" min="1" max="1000" _gui-text="Subdivisions per Major Y Division:">1</param>
- <param name="y_log" type="boolean" _gui-text="Logarithmic Y Subdiv. (Base given by entry above)">false</param>
- <param name="y_subsubdivs" type="int" min="1" max="1000" _gui-text="Subsubdivs. per Y Subdivision:">5</param>
- <param name="y_half_freq" type="int" min="1" max="1000" _gui-text="Halve Y Subsubdiv. Frequency after 'n' Subdivs. (log only):">4</param>
- <param name="y_divs_th" type="float" min="0" max="1000" _gui-text="Major Y Division Thickness (px):">2</param>
- <param name="y_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor Y Division Thickness (px):">1</param>
- <param name="y_subsubdivs_th" type="float" min="0" max="1000" _gui-text="Subminor Y Division Thickness (px):">0.3</param>
+ <param name="tab" type="notebook">
+ <page name="x_tab" _gui-text="X Axis">
+ <param name="x_divs" type="int" min="1" max="1000" _gui-text="Major X Divisions:">6</param>
+ <param name="dx" type="float" min="1" max="1000" _gui-text="Major X Division Spacing (px):">100.0</param>
+ <param name="x_subdivs" type="int" min="1" max="1000" _gui-text="Subdivisions per Major X Division:">2</param>
+ <param name="x_log" type="boolean" _gui-text="Logarithmic X Subdiv. (Base given by entry above)">false</param>
+ <param name="x_subsubdivs" type="int" min="1" max="1000" _gui-text="Subsubdivs. per X Subdivision:">5</param>
+ <param name="x_half_freq" type="int" min="1" max="1000" _gui-text="Halve X Subsubdiv. Frequency after 'n' Subdivs. (log only):">4</param>
+ <param name="x_divs_th" type="float" min="0" max="1000" _gui-text="Major X Division Thickness (px):">2</param>
+ <param name="x_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor X Division Thickness (px):">1</param>
+ <param name="x_subsubdivs_th" type="float" min="0" max="1000" _gui-text="Subminor X Division Thickness (px):">0.3</param>
+ </page>
+ <page name="y_tab" _gui-text="Y Axis">
+ <param name="y_divs" type="int" min="1" max="1000" _gui-text="Major Y Divisions:">5</param>
+ <param name="dy" type="float" min="1" max="1000" _gui-text="Major Y Division Spacing (px):">100.0</param>
+ <param name="y_subdivs" type="int" min="1" max="1000" _gui-text="Subdivisions per Major Y Division:">1</param>
+ <param name="y_log" type="boolean" _gui-text="Logarithmic Y Subdiv. (Base given by entry above)">false</param>
+ <param name="y_subsubdivs" type="int" min="1" max="1000" _gui-text="Subsubdivs. per Y Subdivision:">5</param>
+ <param name="y_half_freq" type="int" min="1" max="1000" _gui-text="Halve Y Subsubdiv. Frequency after 'n' Subdivs. (log only):">4</param>
+ <param name="y_divs_th" type="float" min="0" max="1000" _gui-text="Major Y Division Thickness (px):">2</param>
+ <param name="y_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor Y Division Thickness (px):">1</param>
+ <param name="y_subsubdivs_th" type="float" min="0" max="1000" _gui-text="Subminor Y Division Thickness (px):">0.3</param>
+ </page>
+ </param>
<effect>
<object-type>all</object-type>
diff --git a/share/extensions/grid_cartesian.py b/share/extensions/grid_cartesian.py
index 26270002d..e92509505 100755
--- a/share/extensions/grid_cartesian.py
+++ b/share/extensions/grid_cartesian.py
@@ -44,6 +44,9 @@ def draw_SVG_rect(x,y,w,h, width, fill, name, parent):
class Grid_Polar(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
+ self.OptionParser.add_option("--tab",
+ action="store", type="string",
+ dest="tab", default="x_tab")
self.OptionParser.add_option("--x_divs",
action="store", type="int",
dest="x_divs", default=5,
diff --git a/share/extensions/grid_polar.inx b/share/extensions/grid_polar.inx
index ffc64a3d5..2fbd190e5 100644
--- a/share/extensions/grid_polar.inx
+++ b/share/extensions/grid_polar.inx
@@ -4,6 +4,7 @@
<id>grids.polar</id>
<dependency type="executable" location="extensions">grid_polar.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency>
+
<param name="c_dot_dia" type="float" min="1" max="1000" _gui-text="Centre Dot Diameter (px):">5.0</param>
<param name="a_labels" type="enum" _gui-text="Circumferential Labels:">
<_item msgctxt="Label" value="none">None</_item>
@@ -11,20 +12,24 @@
</param>
<param name="a_label_size" type="int" min="1" max="1000" _gui-text="Circumferential Label Size (px):">18</param>
<param name="a_label_outset" type="float" min="0" max="1000" _gui-text="Circumferential Label Outset (px):">24</param>
- <_param name="circ_divs_label" type="description" appearance="header">Circular Divisions</_param>
- <param name="r_divs" type="int" min="1" max="1000" _gui-text="Major Circular Divisions:">5</param>
- <param name="dr" type="float" min="1" max="1000" _gui-text="Major Circular Division Spacing (px):">50.0</param>
- <param name="r_subdivs" type="int" min="1" max="1000" _gui-text="Subdivisions per Major Circular Division:">3</param>
- <param name="r_log" type="boolean" _gui-text="Logarithmic Subdiv. (Base given by entry above)">false</param>
- <param name="r_divs_th" type="float" min="0" max="1000" _gui-text="Major Circular Division Thickness (px):">2</param>
- <param name="r_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor Circular Division Thickness (px):">1</param>
- <_param name="ang_divs_label" type="description" appearance="header">Angular Divisions</_param>
- <param name="a_divs" type="int" min="1" max="1000" _gui-text="Angle Divisions:">24</param>
- <param name="a_divs_cent" type="int" min="1" max="1000" _gui-text="Angle Divisions at Centre:">4</param>
- <param name="a_subdivs" type="int" min="1" max="1000" _gui-text="Subdivisions per Major Angular Division:">1</param>
- <param name="a_subdivs_cent" type="int" min="0" max="1000" _gui-text="Minor Angle Division End 'n' Divs. Before Centre:">2</param>
- <param name="a_divs_th" type="float" min="0" max="1000" _gui-text="Major Angular Division Thickness (px):">2</param>
- <param name="a_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor Angular Division Thickness (px):">1</param>
+ <param name="tab" type="notebook">
+ <page name="circular_div" _gui-text="Circular Divisions">
+ <param name="r_divs" type="int" min="1" max="1000" _gui-text="Major Circular Divisions:">5</param>
+ <param name="dr" type="float" min="1" max="1000" _gui-text="Major Circular Division Spacing (px):">50.0</param>
+ <param name="r_subdivs" type="int" min="1" max="1000" _gui-text="Subdivisions per Major Circular Division:">3</param>
+ <param name="r_log" type="boolean" _gui-text="Logarithmic Subdiv. (Base given by entry above)">false</param>
+ <param name="r_divs_th" type="float" min="0" max="1000" _gui-text="Major Circular Division Thickness (px):">2</param>
+ <param name="r_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor Circular Division Thickness (px):">1</param>
+ </page>
+ <page name="angular_div" _gui-text="Angular Divisions">
+ <param name="a_divs" type="int" min="1" max="1000" _gui-text="Angle Divisions:">24</param>
+ <param name="a_divs_cent" type="int" min="1" max="1000" _gui-text="Angle Divisions at Centre:">4</param>
+ <param name="a_subdivs" type="int" min="1" max="1000" _gui-text="Subdivisions per Major Angular Division:">1</param>
+ <param name="a_subdivs_cent" type="int" min="0" max="1000" _gui-text="Minor Angle Division End 'n' Divs. Before Centre:">2</param>
+ <param name="a_divs_th" type="float" min="0" max="1000" _gui-text="Major Angular Division Thickness (px):">2</param>
+ <param name="a_subdivs_th" type="float" min="0" max="1000" _gui-text="Minor Angular Division Thickness (px):">1</param>
+ </page>
+ </param>
<effect>
<object-type>all</object-type>
diff --git a/share/extensions/grid_polar.py b/share/extensions/grid_polar.py
index f3d5dbf41..c5a7e7062 100755
--- a/share/extensions/grid_polar.py
+++ b/share/extensions/grid_polar.py
@@ -54,6 +54,9 @@ def draw_SVG_label_centred(x, y, string, font_size, name, parent):
class Grid_Polar(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
+ self.OptionParser.add_option("--tab",
+ action="store", type="string",
+ dest="tab", default="circular_div")
self.OptionParser.add_option("--r_divs",
action="store", type="int",
dest="r_divs", default=5,
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..13d6d00ec 100755
--- a/share/extensions/hpgl_input.py
+++ b/share/extensions/hpgl_input.py
@@ -25,8 +25,8 @@ from StringIO import StringIO
import hpgl_decoder
import inkex
import sys
-inkex.localize()
+inkex.localize()
# parse options
parser = inkex.optparse.OptionParser(usage='usage: %prog [options] HPGLfile', option_class=inkex.InkOption)
@@ -68,4 +68,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..d4a23743f 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):
@@ -67,7 +66,7 @@ class HpglOutput(inkex.Effect):
hpglInit += ';FS%d' % self.options.force
if self.options.speed > 0:
hpglInit += ';VS%d' % self.options.speed
- self.hpgl = hpglInit + self.hpgl + ';SP0;PU0,0;IN; '
+ self.hpgl = hpglInit + self.hpgl + ';PU0,0;SP0;IN; '
def output(self):
# print to file
@@ -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/ink2canvas/Makefile.am b/share/extensions/ink2canvas/Makefile.am
deleted file mode 100644
index ab6e7661d..000000000
--- a/share/extensions/ink2canvas/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-
-ink2canvasdir = $(datadir)/inkscape/extensions/ink2canvas
-
-ink2canvas_DATA = \
- __init__.py \
- canvas.py \
- svg.py
-
-EXTRA_DIST = $(ink2canvas_DATA)
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/inkscape_help_askaquestion.inx b/share/extensions/inkscape_help_askaquestion.inx
index 74462bf07..b093558cb 100644
--- a/share/extensions/inkscape_help_askaquestion.inx
+++ b/share/extensions/inkscape_help_askaquestion.inx
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
- <_name>Ask Us a Question</_name>
- <id>org.inkscape.help.askaquestion</id>
- <dependency type="executable" location="extensions">launch_webbrowser.py</dependency>
- <param name="url" gui-hidden="true" type="string">http://answers.launchpad.net/inkscape/+addquestion</param>
- <effect needs-document="false">
- <object-type>all</object-type>
- <effects-menu hidden="true"/>
- </effect>
- <script>
- <command reldir="extensions" interpreter="python">launch_webbrowser.py</command>
- </script>
+ <_name>Ask Us a Question</_name>
+ <id>org.inkscape.help.askaquestion</id>
+ <dependency type="executable" location="extensions">launch_webbrowser.py</dependency>
+ <_param name="url" gui-hidden="true" type="string">https://inkscape.org/en/ask/</_param>
+ <effect needs-document="false">
+ <object-type>all</object-type>
+ <effects-menu hidden="true"/>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">launch_webbrowser.py</command>
+ </script>
</inkscape-extension>
diff --git a/share/extensions/inkscape_help_keys.inx b/share/extensions/inkscape_help_keys.inx
index 612524517..5aabbea41 100644
--- a/share/extensions/inkscape_help_keys.inx
+++ b/share/extensions/inkscape_help_keys.inx
@@ -4,7 +4,7 @@
<id>org.inkscape.help.keys</id>
<dependency type="executable" location="extensions">launch_webbrowser.py</dependency>
<!-- i18n. Please don't translate it unless a page exists in your language -->
- <_param name="url" gui-hidden="true" type="string">http://inkscape.org/doc/keys091.html</_param>
+ <_param name="url" gui-hidden="true" type="string">http://inkscape.org/doc/keys092.html</_param>
<effect needs-document="false">
<object-type>all</object-type>
<effects-menu hidden="true" />
diff --git a/share/extensions/inkscape_help_relnotes.inx b/share/extensions/inkscape_help_relnotes.inx
index d032eb7e0..5c5b1b4e8 100644
--- a/share/extensions/inkscape_help_relnotes.inx
+++ b/share/extensions/inkscape_help_relnotes.inx
@@ -4,7 +4,7 @@
<id>org.inkscape.help.relnotes</id>
<dependency type="executable" location="extensions">launch_webbrowser.py</dependency>
<!-- i18n. Please don't translate it unless a page exists in your language -->
- <_param name="url" gui-hidden="true" type="string">http://wiki.inkscape.org/wiki/index.php/Release_notes/0.91</_param>
+ <_param name="url" gui-hidden="true" type="string">http://wiki.inkscape.org/wiki/index.php/Release_notes/0.92</_param>
<effect needs-document="false">
<object-type>all</object-type>
<effects-menu hidden="true" />
diff --git a/share/extensions/interp.py b/share/extensions/interp.py
index 9dbb996e4..fd80ab412 100755
--- a/share/extensions/interp.py
+++ b/share/extensions/interp.py
@@ -109,8 +109,9 @@ class Interp(inkex.Effect):
help="use z-order instead of selection order")
def tweenstyleunit(self, property, start, end, time): # moved here so we can call 'unittouu'
- sp = self.unittouu(start[property])
- ep = self.unittouu(end[property])
+ scale = self.unittouu('1px')
+ sp = self.unittouu(start.get(property, '1px')) / scale
+ ep = self.unittouu(end.get(property, '1px')) / scale
return str(sp + (time * (ep - sp)))
def effect(self):
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..fb2ccfd87 100755
--- a/share/extensions/launch_webbrowser.py
+++ b/share/extensions/launch_webbrowser.py
@@ -5,18 +5,18 @@ import threading
from optparse import OptionParser
# local library
import inkex
-inkex.localize()
class VisitWebSiteWithoutLockingInkscape(threading.Thread):
def __init__(self):
threading.Thread.__init__ (self)
parser = OptionParser()
parser.add_option("-u", "--url", action="store", type="string",
- default="http://www.inkscape.org/",
+ default="https://www.inkscape.org/",
dest="url", help="The URL to open in web browser")
(self.options, args) = parser.parse_args()
def run(self):
+ inkex.localize()
webbrowser.open(_(self.options.url))
vwswli = VisitWebSiteWithoutLockingInkscape()
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..d025f142c 100755
--- a/share/extensions/measure.py
+++ b/share/extensions/measure.py
@@ -34,6 +34,7 @@ TODO:
'''
# standard library
import locale
+import re
# local library
import inkex
import simplestyle
@@ -41,7 +42,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)
@@ -51,6 +51,9 @@ try:
except locale.Error:
locale.setlocale(locale.LC_ALL, 'C')
+# Initialize gettext for messages outside an inkex derived class
+inkex.localize()
+
# third party
try:
import numpy
@@ -212,7 +215,7 @@ class Length(inkex.Effect):
factor = 1.0
doc = self.document.getroot()
if doc.get('viewBox'):
- [viewx, viewy, vieww, viewh] = doc.get('viewBox').split(' ')
+ (viewx, viewy, vieww, viewh) = re.sub(' +|, +|,',' ',doc.get('viewBox')).strip().split(' ', 4)
factor = self.unittouu(doc.get('width'))/float(vieww)
if self.unittouu(doc.get('height'))/float(viewh) < factor:
factor = self.unittouu(doc.get('height'))/float(viewh)
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..f15deaad5 100755
--- a/share/extensions/perspective.py
+++ b/share/extensions/perspective.py
@@ -34,13 +34,13 @@ import cubicsuperpath
import simpletransform
from ffgeom import *
-inkex.localize()
-
# third party
try:
from numpy import *
from numpy.linalg import *
except:
+ # Initialize gettext for messages outside an inkex derived class
+ inkex.localize()
inkex.errormsg(_("Failed to import the numpy or numpy.linalg modules. These modules are required by this extension. Please install them and try again. On a Debian-like system this can be done with the command, sudo apt-get install python-numpy."))
exit()
diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py
index 1c4a683c1..1d8e8f79e 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):
@@ -105,7 +104,7 @@ class Plot(inkex.Effect):
hpglInit += ';FS%d' % self.options.force
if self.options.speed > 0:
hpglInit += ';VS%d' % self.options.speed
- self.hpgl = hpglInit + self.hpgl + ';SP0;PU0,0;IN; '
+ self.hpgl = hpglInit + self.hpgl + ';PU0,0;SP0;IN; '
def convertToDmpl(self):
# convert HPGL to DMPL
@@ -128,7 +127,7 @@ class Plot(inkex.Effect):
if self.options.speed > 0:
dmplInit += 'V%d' % self.options.speed
dmplInit += 'EC1'
- self.hpgl = dmplInit + self.hpgl[1:] + ',P0,U0,0,Z '
+ self.hpgl = dmplInit + self.hpgl[1:] + ',U0,0,P0,Z '
def convertToKNK(self):
# convert HPGL to KNK Plotter Language
@@ -137,7 +136,7 @@ class Plot(inkex.Effect):
hpglInit += ';FS%d' % self.options.force
if self.options.speed > 0:
hpglInit += ';VS%d' % self.options.speed
- self.hpgl = hpglInit + self.hpgl + ';SP0;PU0,0;@ '
+ self.hpgl = hpglInit + self.hpgl + ';PU0,0;SP0;@ '
def sendHpglToSerial(self):
# gracefully exit script when pySerial is missing
@@ -148,7 +147,7 @@ class Plot(inkex.Effect):
+ "\n\n" + _("1. Download and extract (unzip) this file to your local harddisk:")
+ "\n" + " https://pypi.python.org/packages/source/p/pyserial/pyserial-2.7.tar.gz"
+ "\n" + _("2. Copy the \"serial\" folder (Can be found inside the just extracted folder)")
- + "\n" + _(" into the following Inkscape folder: C:\\<Program files>\\inkscape\\python\\Lib\\")
+ + "\n" + _(" into the following Inkscape folder: C:\\[Program files]\\inkscape\\python\\Lib\\")
+ "\n" + _("3. Close and restart Inkscape."))
return
# init serial framework
@@ -197,7 +196,7 @@ class Plot(inkex.Effect):
try:
mySerial.open()
except Exception as inst:
- if 'ould not open port' in inst.args[0]:
+ if inst.strerror is not None and 'ould not open port' in inst.strerror:
inkex.errormsg(_("Could not open port. Please check that your plotter is running, connected and the settings are correct."))
return
else:
@@ -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/plt_input.inx b/share/extensions/plt_input.inx
index ed3007fcd..743754469 100644
--- a/share/extensions/plt_input.inx
+++ b/share/extensions/plt_input.inx
@@ -6,7 +6,7 @@
<input>
<extension>.plt</extension>
<mimetype>image/x-plt</mimetype>
- <_filetypename>HP Graphics Language Plot file [AutoCAD] (*.plt)</_filetypename>
+ <_filetypename>HP Graphics Language Plot file [AutoCAD] (UC) (*.plt)</_filetypename>
<_filetypetooltip>Open HPGL plotter files</_filetypetooltip>
<output_extension>org.inkscape.output.plt</output_extension>
</input>
diff --git a/share/extensions/plt_output.inx b/share/extensions/plt_output.inx
index f7000cd79..8bbbaa1b8 100644
--- a/share/extensions/plt_output.inx
+++ b/share/extensions/plt_output.inx
@@ -6,7 +6,7 @@
<output>
<extension>.plt</extension>
<mimetype>image/x-plt</mimetype>
- <_filetypename>HP Graphics Language Plot file [AutoCAD] (*.plt)</_filetypename>
+ <_filetypename>HP Graphics Language Plot file [AutoCAD] (UC) (*.plt)</_filetypename>
<_filetypetooltip>Save a file for plotters</_filetypetooltip>
</output>
<script>
diff --git a/share/extensions/polyhedron_3d.py b/share/extensions/polyhedron_3d.py
index 7ce8b1c6d..a74a64e69 100755
--- a/share/extensions/polyhedron_3d.py
+++ b/share/extensions/polyhedron_3d.py
@@ -57,7 +57,8 @@ import inkex
import simplestyle
from simpletransform import computePointInNode
-inkex.localize()
+# Initialize gettext for messages outside an inkex derived class
+inkex.localize()
# third party
try:
diff --git a/share/extensions/prepare_file_save_as.inx b/share/extensions/prepare_file_save_as.inx
new file mode 100644
index 000000000..1556713aa
--- /dev/null
+++ b/share/extensions/prepare_file_save_as.inx
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+ <_name>Pre-Process File Save As...</_name>
+ <id>com.vaxxine.file.saveas.preprocess</id>
+ <dependency type="executable" location="extensions">prepare_file_save_as.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+ <effect>
+ <object-type>path</object-type>
+ <effects-menu>
+ <submenu _name="Export"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">prepare_file_save_as.py</command>
+ </script>
+</inkscape-extension>
diff --git a/share/extensions/prepare_file_save_as.py b/share/extensions/prepare_file_save_as.py
new file mode 100755
index 000000000..d0c660fcf
--- /dev/null
+++ b/share/extensions/prepare_file_save_as.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+'''
+file: prepare_file_save_as.py
+
+This extension will pre-process a vector image by applying the operations:
+'EditSelectAllInAllLayers' and 'ObjectToPath'
+before calling the dialog File->Save As....
+
+Copyright (C) 2014 Ryan Lerch (multiple difference)
+ 2016 Maren Hachmann <marenhachmannATyahoo.com> (refactoring, extend to multibool)
+ 2017 Alvin Penner <penner@vaxxine.com> (apply to 'File Save As...')
+
+This code is based on 'inkscape-extension-multiple-difference' by Ryan Lerch
+see : https://github.com/ryanlerch/inkscape-extension-multiple-difference
+also: https://github.com/Moini/inkscape-extensions-multi-bool
+It will call up a new instance of Inkscape and process the image there,
+so that the original file is left intact.
+
+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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+'''
+# standard library
+from subprocess import Popen, PIPE
+from shutil import copy2
+# local library
+import inkex
+
+class MyEffect(inkex.Effect):
+ def __init__(self):
+ inkex.Effect.__init__(self)
+
+ def effect(self):
+ file = self.args[-1]
+ tempfile = inkex.os.path.splitext(file)[0] + "-prepare.svg"
+ # tempfile is needed here only because we want to force the extension to be .svg
+ # so that we can open and close it silently
+ copy2(file, tempfile)
+ p = Popen('inkscape --verb=EditSelectAllInAllLayers --verb=EditUnlinkClone --verb=ObjectToPath --verb=FileSaveACopy --verb=FileSave --verb=FileQuit '+tempfile, shell=True, stdout=PIPE, stderr=PIPE)
+ err = p.stderr
+ f = p.communicate()[0]
+ err.close()
+
+if __name__ == '__main__':
+ e = MyEffect()
+ e.affect()
+
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
diff --git a/share/extensions/prepare_print_win32_vector.inx b/share/extensions/prepare_print_win32_vector.inx
new file mode 100644
index 000000000..b8d87cec8
--- /dev/null
+++ b/share/extensions/prepare_print_win32_vector.inx
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+ <_name>Pre-Process Win32 Vector Print</_name>
+ <id>com.vaxxine.print.win32.preprocess</id>
+ <dependency type="executable" location="extensions">prepare_print_win32_vector.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+ <effect>
+ <object-type>path</object-type>
+ <effects-menu>
+ <submenu _name="Export"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">prepare_print_win32_vector.py</command>
+ </script>
+</inkscape-extension>
diff --git a/share/extensions/prepare_print_win32_vector.py b/share/extensions/prepare_print_win32_vector.py
new file mode 100755
index 000000000..e13670931
--- /dev/null
+++ b/share/extensions/prepare_print_win32_vector.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+'''
+file: prepare_print_win32_vector.py
+
+This extension will pre-process a vector image by applying the operations:
+'EditSelectAllInAllLayers' and 'ObjectToPath'
+before applying the extension: 'Win32 Vector Print'.
+
+Generate vector graphics printout, specifically for Windows GDI32.
+
+Copyright (C) 2014 Ryan Lerch (multiple difference)
+ 2016 Maren Hachmann <marenhachmannATyahoo.com> (refactoring, extend to multibool)
+ 2017 Alvin Penner <penner@vaxxine.com> (apply to 'Win32 Vector Print')
+
+This code is based on 'inkscape-extension-multiple-difference' by Ryan Lerch
+see : https://github.com/ryanlerch/inkscape-extension-multiple-difference
+also: https://github.com/Moini/inkscape-extensions-multi-bool
+It will call up a new instance of Inkscape and process the image there,
+so that the original file is left intact.
+
+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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+'''
+# standard library
+from subprocess import Popen, PIPE
+from shutil import copy2
+# local library
+import inkex
+
+inkex.localize() # Initialize gettext
+if not inkex.sys.platform.startswith('win'):
+ exit(_("sorry, this will run only on Windows, exiting..."))
+
+class MyEffect(inkex.Effect):
+ def __init__(self):
+ inkex.Effect.__init__(self)
+
+ def effect(self):
+ file = self.args[-1]
+ tempfile = inkex.os.path.splitext(file)[0] + "-prepare.svg"
+ # tempfile is needed here only because we want to force the extension to be .svg
+ # so that we can open and close it silently
+ copy2(file, tempfile)
+ p = Popen('inkscape --verb=EditSelectAllInAllLayers --verb=EditUnlinkClone --verb=ObjectToPath --verb=com.vaxxine.print.win32 --verb=FileSave --verb=FileQuit '+tempfile, shell=True, stdout=PIPE, stderr=PIPE)
+ err = p.stderr
+ f = p.communicate()[0]
+ err.close()
+
+if __name__ == '__main__':
+ e = MyEffect()
+ e.affect()
+
+# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99
diff --git a/share/extensions/print_win32_vector.py b/share/extensions/print_win32_vector.py
index bf8e89845..99365fc5e 100755
--- a/share/extensions/print_win32_vector.py
+++ b/share/extensions/print_win32_vector.py
@@ -35,8 +35,7 @@ import simplestyle
import simpletransform
import cubicsuperpath
-inkex.localize()
-
+inkex.localize() # Initialize gettext
if not inkex.sys.platform.startswith('win'):
exit(_("sorry, this will run only on Windows, exiting..."))
@@ -63,7 +62,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 = self.unittouu(style['stroke-width'])
+ stroke = self.unittouu(style['stroke-width'])/self.unittouu('1px')
stroke = int(stroke*self.scale)
if style.has_key('fill'):
if style['fill'] and style['fill'] != 'none' and style['fill'][0:3] != 'url':
@@ -200,8 +199,17 @@ class MyEffect(inkex.Effect):
exit() # user clicked Cancel
self.scale = (ord(pDevMode[58]) + 256.0*ord(pDevMode[59]))/96 # use PrintQuality from DEVMODE
- self.groupmat = [[[self.scale, 0.0, 0.0], [0.0, self.scale, 0.0]]]
+ self.scale /= self.unittouu('1px')
+ h = self.unittouu(self.document.getroot().xpath('@height', namespaces=inkex.NSS)[0])
doc = self.document.getroot()
+ # process viewBox height attribute to correct page scaling
+ viewBox = doc.get('viewBox')
+ if viewBox:
+ viewBox2 = viewBox.split(',')
+ if len(viewBox2) < 4:
+ viewBox2 = viewBox.split(' ')
+ self.scale *= h / self.unittouu(self.addDocumentUnit(viewBox2[3]))
+ self.groupmat = [[[self.scale, 0.0, 0.0], [0.0, self.scale, 0.0]]]
self.process_group(doc)
mygdi.EndDoc(self.hDC)
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.inx b/share/extensions/restack.inx
index 4f5f577cb..e14d2d5d5 100644
--- a/share/extensions/restack.inx
+++ b/share/extensions/restack.inx
@@ -9,7 +9,7 @@
<_param name="desc_dir" type="description" appearance="header">Restack Direction</_param>
<param name="nb_direction" type="notebook">
<page name="presets" _gui-text="Presets">
- <param name="direction" type="enum" _gui-text="">
+ <param name="direction" type="enum" gui-text="">
<_item value="lr">Left to Right (0)</_item>
<_item value="bt">Bottom to Top (90)</_item>
<_item value="rl">Right to Left (180)</_item>
@@ -36,7 +36,7 @@
</page>
<page name="z_order" _gui-text="Based on Z-Order">
<_param name="desc_zsort" type="description" appearance="header">Restack Mode</_param>
- <param name="zsort" type="enum" _gui-text="">
+ <param name="zsort" type="enum" gui-text="">
<_item value="rev">Reverse Z-Order</_item>
<_item value="rand">Shuffle Z-Order</_item>
</param>
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/run_command.py b/share/extensions/run_command.py
index 7012c4274..950e9ed7c 100755
--- a/share/extensions/run_command.py
+++ b/share/extensions/run_command.py
@@ -61,8 +61,11 @@ def run(command_format, prog_name):
except ImportError:
# shouldn't happen...
msg = "Neither subprocess.Popen nor popen2.Popen3 is available"
- if rc and msg is None:
- msg = "%s failed:\n%s\n%s\n" % (prog_name, out, err)
+ if msg is None:
+ if rc:
+ msg = "%s failed:\n%s\n%s\n" % (prog_name, out, err)
+ elif err:
+ sys.stderr.write("%s executed but logged the following error:\n%s\n%s\n" % (prog_name, out, err))
except Exception, inst:
msg = "Error attempting to run %s: %s" % (prog_name, str(inst))
diff --git a/share/extensions/scour.inkscape.py b/share/extensions/scour.inkscape.py
index eb31f308f..3d3f35bdb 100755
--- a/share/extensions/scour.inkscape.py
+++ b/share/extensions/scour.inkscape.py
@@ -1,10 +1,23 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-import sys, platform, inkex
+
+import platform
+import sys
+
+from distutils.version import StrictVersion
+
+import inkex
try:
import scour
- from scour.scour import scourString
+ try:
+ from scour.scour import scourString
+ except ImportError: # compatibility for very old Scour (<= 0.26) - deprecated!
+ try:
+ from scour import scourString
+ scour.__version__ = scour.VER
+ except:
+ raise
except Exception as e:
inkex.errormsg("Failed to import Python module 'scour'.\nPlease make sure it is installed (e.g. using 'pip install scour' or 'sudo apt-get install python-scour') and try again.")
inkex.errormsg("\nDetails:\n" + str(e))
@@ -17,10 +30,13 @@ except Exception as e:
inkex.errormsg("\nDetails:\n" + str(e))
sys.exit()
+
class ScourInkscape (inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
+
+ # Scour options
self.OptionParser.add_option("--tab", type="string", action="store", dest="tab")
self.OptionParser.add_option("--simplify-colors", type="inkbool", action="store", dest="simple_colors")
self.OptionParser.add_option("--style-to-xml", type="inkbool", action="store", dest="style_to_xml")
@@ -46,7 +62,26 @@ class ScourInkscape (inkex.Effect):
self.OptionParser.add_option("--enable-comment-stripping", type="inkbool", action="store", dest="strip_comments")
self.OptionParser.add_option("--renderer-workaround", type="inkbool", action="store", dest="renderer_workaround")
+ # options for internal use of the extension
+ self.OptionParser.add_option("--scour-version", type="string", action="store", dest="scour_version")
+ self.OptionParser.add_option("--scour-version-warn-old", type="inkbool", action="store", dest="scour_version_warn_old")
+
def effect(self):
+ # version check if enabled in options
+ if (self.options.scour_version_warn_old):
+ scour_version = scour.__version__
+ scour_version_min = self.options.scour_version
+ if (StrictVersion(scour_version) < StrictVersion(scour_version_min)):
+ inkex.errormsg("The extension 'Optimized SVG Output' is designed for Scour " + scour_version_min + " and later "
+ "but you're using the older version Scour " + scour_version + ".")
+ inkex.errormsg("This usually works just fine but not all options available in the UI might be supported "
+ "by the version of Scour installed on your system "
+ "(see https://github.com/scour-project/scour/blob/master/HISTORY.md for release notes of Scour).")
+ inkex.errormsg("Note: You can permanently disable this message on the 'About' tab of the extension window.")
+ del self.options.scour_version
+ del self.options.scour_version_warn_old
+
+ # do the scouring
try:
input = file(self.args[0], "r")
self.options.infilename = self.args[0]
@@ -61,6 +96,7 @@ class ScourInkscape (inkex.Effect):
inkex.errormsg("Scour version: " + scour.__version__)
sys.exit()
+
if __name__ == '__main__':
e = ScourInkscape()
e.affect(output=False)
diff --git a/share/extensions/scour.inx b/share/extensions/scour.inx
index f7b8aedf7..7d7555664 100644
--- a/share/extensions/scour.inx
+++ b/share/extensions/scour.inx
@@ -92,6 +92,22 @@
_gui-description="Preserve all IDs that start with the specified prefix (e.g. specify &quot;flag&quot; to preserve &quot;flag-mx&quot;, &quot;flag-pt&quot;, etc.)."
name="protect-ids-prefix" type="string"></param>
</page>
+ <page name="About" _gui-text="About">
+ <param name="spacer" type="description">&#160;</param>
+ <_param name="about_name_desc" type="description">Optimized SVG Output is provided by</_param>
+ <param name="about_name" type="description" appearance="header" indent="1">Scour - An SVG Scrubber</param>
+ <param name="spacer" type="description">&#160;</param>
+ <_param name="about_link_desc" type="description">For details please refer to</_param>
+ <param name="about_link" type="description" appearance="url" indent="1">https://github.com/scour-project/scour</param>
+ <param name="spacer" type="description">&#160;</param>
+ <param name="spacer" type="description">&#160;</param>
+ <param name="spacer" type="description">&#160;</param>
+ <_param name="about_version_desc" type="description">This version of the extension is designed for</_param>
+ <param name="about_version" type="description">Scour 0.31+</param>
+ <param name="scour-version" type="string" gui-hidden="true">0.31</param> <!-- this parameter is checked programatically in the extension to show a warning -->
+ <param _gui-text="Show warnings for older versions of Scour"
+ name="scour-version-warn-old" type="boolean">true</param>
+ </page>
</param>
<output>
<extension>.svg</extension>
diff --git a/share/extensions/seamless_pattern.inx b/share/extensions/seamless_pattern.inx
index f63872272..219319b85 100644
--- a/share/extensions/seamless_pattern.inx
+++ b/share/extensions/seamless_pattern.inx
@@ -6,7 +6,7 @@
<dependency type="executable" location="extensions">inkex.py</dependency>
<param name="width" _gui-text="Custom Width (px):" type="int" min="1" max="99999999">100</param>
<param name="height" _gui-text="Custom Height (px):" type="int" min="1" max="99999999">100</param>
- <_param name="help-info" type="description">This extension overwrite current document</_param>
+ <_param name="help-info" type="description">This extension overwrites the current document</_param>
<effect needs-live-preview="false">
<object-type>All</object-type>
diff --git a/share/extensions/sk1_input.inx b/share/extensions/sk1_input.inx
index 64218b186..4483c2e13 100644
--- a/share/extensions/sk1_input.inx
+++ b/share/extensions/sk1_input.inx
@@ -6,7 +6,7 @@
<input>
<extension>.sk1</extension>
<mimetype>application/x-xsk1</mimetype>
- <_filetypename>sK1 vector graphics files (*.sk1)</_filetypename>
+ <_filetypename>sK1 vector graphics files (UC) (*.sk1)</_filetypename>
<_filetypetooltip>Open files saved in sK1 vector graphics editor</_filetypetooltip>
</input>
<script>
diff --git a/share/extensions/sk1_output.inx b/share/extensions/sk1_output.inx
index c6f021839..1aeedb6c7 100644
--- a/share/extensions/sk1_output.inx
+++ b/share/extensions/sk1_output.inx
@@ -6,7 +6,7 @@
<output>
<extension>.sk1</extension>
<mimetype>application/x-xsk1</mimetype>
- <_filetypename>sK1 vector graphics files (*.sk1)</_filetypename>
+ <_filetypename>sK1 vector graphics files (UC) (*.sk1)</_filetypename>
<_filetypetooltip>File format for use in sK1 vector graphics editor</_filetypetooltip>
</output>
<script>
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/svg2xaml.xsl b/share/extensions/svg2xaml.xsl
index abc519065..e4a3ca3f1 100644
--- a/share/extensions/svg2xaml.xsl
+++ b/share/extensions/svg2xaml.xsl
@@ -765,7 +765,7 @@ exclude-result-prefixes="rdf xlink xs exsl libxslt inkscape">
<xsl:choose>
<xsl:when test="@xlink:href">
<xsl:variable name="reference_id" select="@xlink:href" />
- <xsl:apply-templates mode="forward" select="//*[name(.) = 'linearGradient' and $reference_id = concat('#', @id)]/*" />
+ <xsl:apply-templates mode="forward" select="//*[name(.) = 'radialGradient' and $reference_id = concat('#', @id)]/*" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="forward" />
diff --git a/share/extensions/svg_and_media_zip_output.py b/share/extensions/svg_and_media_zip_output.py
index c5963b721..e021bfd4e 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):
@@ -111,7 +111,7 @@ class CompressedMediaOutput(inkex.Effect):
url = urlparse.urlparse(xlink)
href = urllib.url2pathname(url.path)
- if (href != None):
+ if (href != None and os.path.isfile(href)):
absref = os.path.realpath(href)
absref = unicode(absref, "utf-8")
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/synfig_output.py b/share/extensions/synfig_output.py
index bcd1eeaf3..06a9c6e72 100755
--- a/share/extensions/synfig_output.py
+++ b/share/extensions/synfig_output.py
@@ -1051,7 +1051,6 @@ class SynfigExport(SynfigPrep):
def effect(self):
# Prepare the document for exporting
SynfigPrep.effect(self)
-
svg = self.document.getroot()
width = get_dimension(svg.get("width", 1024))
height = get_dimension(svg.get("height", 768))
diff --git a/share/extensions/test/Makefile.am b/share/extensions/test/Makefile.am
deleted file mode 100644
index cd1929a7f..000000000
--- a/share/extensions/test/Makefile.am
+++ /dev/null
@@ -1,60 +0,0 @@
-
-# List of all tests to be run.
-#TESTS = svgcalendar.test.py
-# that is not working :-/
-
-EXTRA_DIST = \
- addnodes.test.py \
- chardataeffect.test.py \
- color_randomize_test.py \
- coloreffect.test.py \
- create_test_from_template.sh \
- dots.test.py \
- draw_from_triangle.test.py \
- dxf_outlines.test.py \
- edge3d.test.py \
- embedimage.test.py \
- eqtexsvg.test.py \
- extractimage.test.py \
- extrude.test.py \
- flatten.test.py \
- foldablebox.test.py \
- fractalize.test.py \
- funcplot.test.py \
- gimp_xcf.test.py \
- grid_cartesian.test.py \
- grid_polar.test.py \
- guides_creator.test.py \
- handles.test.py \
- hpgl_output.test.py \
- inkweb-debug.js \
- inkwebeffect.test.py \
- inkwebjs-move.test.svg \
- interp_att_g.test.py \
- interp.test.py \
- lindenmayer.test.py \
- lorem_ipsum.test.py \
- markers_strokepaint.test.py \
- measure.test.py \
- minimal-blank.svg \
- motion.test.py \
- pathmodifier.test.py \
- perfectboundcover.test.py \
- perspective.test.py \
- polyhedron_3d.test.py \
- radiusrand.test.py \
- render_alphabetsoup.test.py \
- render_barcode.test.py \
- render_barcode.data \
- render_gears.test.py \
- restack.test.py \
- rtree.test.py \
- run-all-extension-tests \
- spirograph.test.py \
- straightseg.test.py \
- summersnight.test.py \
- svg_and_media_zip_output.test.py \
- svgcalendar.test.py \
- test_template.py.txt \
- triangle.test.py \
- whirl.test.py
diff --git a/share/extensions/test/frame_test.py b/share/extensions/test/frame_test.py
new file mode 100755
index 000000000..3d686ab25
--- /dev/null
+++ b/share/extensions/test/frame_test.py
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+
+"""
+An Inkscape frame extension test class.
+
+Copyright (C) 2016 Richard White, rwhite8282@gmail.com
+
+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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+
+import sys
+sys.path.append('/usr/share/inkscape/extensions')
+sys.path.append('..') # this line allows to import the extension code
+
+import unittest
+import inkex
+from frame import *
+
+
+class Frame_Test(unittest.TestCase):
+
+
+ def get_frame(self, document):
+ return document.xpath('//svg:g[@id="layer1"]//svg:path[@inkscape:label="Frame"]'
+ , namespaces=inkex.NSS)[0]
+
+
+ def test_empty_no_parameters(self):
+ args = [ 'svg/empty-SVG.svg' ]
+ uut = Frame()
+ uut.affect( args, False )
+
+
+ def test_single_frame(self):
+ args = [
+ '--corner_radius=20'
+ , '--fill_color=-16777124'
+ , '--id=rect3006'
+ , '--position=inside'
+ , '--stroke_color=255'
+ , '--tab="stroke"'
+ , '--width=10'
+ , 'svg/single_box.svg']
+ uut = Frame()
+ uut.affect( args, False )
+ new_frame = self.get_frame(uut.document)
+ self.assertIsNotNone(new_frame)
+ self.assertEqual('{http://www.w3.org/2000/svg}path', new_frame.tag)
+ new_frame_style = new_frame.attrib['style'].lower()
+ self.assertTrue('fill-opacity:0.36' in new_frame_style
+ , 'Invalid fill-opacity in "' + new_frame_style + '".')
+ self.assertTrue('stroke:#000000' in new_frame_style
+ , 'Invalid stroke in "' + new_frame_style + '".')
+ self.assertTrue('stroke-width:10.0' in new_frame_style
+ , 'Invalid stroke-width in "' + new_frame_style + '".')
+ self.assertTrue('stroke-opacity:1.00' in new_frame_style
+ , 'Invalid stroke-opacity in "' + new_frame_style + '".')
+ self.assertTrue('fill:#ff0000' in new_frame_style
+ , 'Invalid fill in "' + new_frame_style + '".')
+
+
+ def test_single_frame_grouped(self):
+ args = [
+ '--corner_radius=20'
+ , '--fill_color=-16777124'
+ , '--group=True'
+ , '--id=rect3006'
+ , '--position=inside'
+ , '--stroke_color=255'
+ , '--tab="stroke"'
+ , '--width=10'
+ , 'svg/single_box.svg']
+ uut = Frame()
+ uut.affect( args, False )
+ new_frame = self.get_frame(uut.document)
+ self.assertIsNotNone(new_frame)
+ self.assertEqual('{http://www.w3.org/2000/svg}path', new_frame.tag)
+ group = new_frame.getparent()
+ self.assertEqual('{http://www.w3.org/2000/svg}g', group.tag)
+ self.assertEqual('{http://www.w3.org/2000/svg}rect', group[0].tag)
+ self.assertEqual('{http://www.w3.org/2000/svg}path', group[1].tag)
+ self.assertEqual("Frame", group[1].xpath('@inkscape:label', namespaces=inkex.NSS)[0])
+
+
+ def test_single_frame_clipped(self):
+ args = [
+ '--clip=True'
+ , '--corner_radius=20'
+ , '--fill_color=-16777124'
+ , '--id=rect3006'
+ , '--position=inside'
+ , '--stroke_color=255'
+ , '--tab="stroke"'
+ , '--width=10'
+ , 'svg/single_box.svg']
+ uut = Frame()
+ uut.affect( args, False )
+ new_frame = self.get_frame(uut.document)
+ self.assertIsNotNone(new_frame)
+ self.assertEqual('{http://www.w3.org/2000/svg}path', new_frame.tag)
+ group = new_frame.getparent()
+ self.assertEqual('url(#clipPath)', group[0].get('clip-path'))
+ clip_path = uut.document.xpath('//svg:defs/svg:clipPath', namespaces=inkex.NSS)[0]
+ self.assertEqual('{http://www.w3.org/2000/svg}clipPath', clip_path.tag)
+
+
+if __name__ == '__main__':
+ unittest.main() \ No newline at end of file
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/test/run-all-extension-tests b/share/extensions/test/run-all-extension-tests
index e7faf672a..ff739c311 100755
--- a/share/extensions/test/run-all-extension-tests
+++ b/share/extensions/test/run-all-extension-tests
@@ -38,20 +38,25 @@ failed_tests=$( $MKTEMP )
if coverage.py erase >/dev/null 2>/dev/null; then
has_py_coverage=true
cover_py_cmd=coverage.py
-else
- if coverage erase >/dev/null 2>/dev/null; then
- has_py_coverage=true
- cover_py_cmd=coverage
- else
- if python-coverage erase >/dev/null 2>/dev/null; then
- has_py_coverage=true
- cover_py_cmd=python-coverage
- fi
- fi
+ else
+ if coverage erase >/dev/null 2>/dev/null; then
+ has_py_coverage=true
+ cover_py_cmd=coverage
+ else
+ if python-coverage erase >/dev/null 2>/dev/null; then
+ has_py_coverage=true
+ cover_py_cmd=python-coverage
+ else
+ if coverage-script.py erase >/dev/null 2>/dev/null; then
+ has_py_coverage=true
+ cover_py_cmd=coverage-script.py
+ fi
+ fi
+ fi
fi
if $has_py_coverage; then
- echo -e "\nRunning tests with coverage"
+ echo -e "\nRunning tests with coverage (${cover_py_cmd})"
fi
#if $has_py_coverage; then
# $cover_py_cmd -e
diff --git a/share/extensions/test/simpletransform.test.py b/share/extensions/test/simpletransform.test.py
new file mode 100755
index 000000000..9e5dbc3b2
--- /dev/null
+++ b/share/extensions/test/simpletransform.test.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import unittest
+
+sys.path.append('..') # this line allows to import the extension code
+
+import inkex
+from simpletransform import *
+
+class ComputeBBoxTest(unittest.TestCase):
+ def setUp(self):
+ args = [ 'svg/simpletransform.test.svg' ]
+ self.e = inkex.Effect()
+ self.e.affect(args, False)
+
+ def test_scaled_object(self):
+ "Object in the defs with 50,50 scaled by 0.5 when used"
+ bbox = computeBBox(self.e.document.xpath("//svg:g", namespaces=inkex.NSS))
+ text_bbox = "{} {} {} {}".format(bbox[0], bbox[1], bbox[2], bbox[3])
+ self.assertEqual(text_bbox, "0.0 25.0 0.0 25.0")
+
+
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(ComputeBBoxTest)
+ unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/share/extensions/test/svg/simpletransform.test.svg b/share/extensions/test/svg/simpletransform.test.svg
new file mode 100644
index 000000000..62876eea7
--- /dev/null
+++ b/share/extensions/test/svg/simpletransform.test.svg
@@ -0,0 +1,8 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100">
+ <g>
+ <defs>
+ <rect width="50" height="50" id="rect"/>
+ </defs>
+ <use xlink:href="#rect" transform="scale(.5)"/>
+ </g>
+</svg> \ No newline at end of file
diff --git a/share/extensions/test/svg/single_box.svg b/share/extensions/test/svg/single_box.svg
new file mode 100644
index 000000000..094233d15
--- /dev/null
+++ b/share/extensions/test/svg/single_box.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.3.1 r9886"
+ sodipodi:docname="New document 1">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.35"
+ inkscape:cx="375"
+ inkscape:cy="514.28571"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="479"
+ inkscape:window-height="379"
+ inkscape:window-x="1319"
+ inkscape:window-y="75"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:0.5;fill:#6900ff;fill-opacity:0.36000001;stroke:#cae8ef;stroke-width:7.19999981;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect3006"
+ width="237.14285"
+ height="305.71429"
+ x="285.71429"
+ y="406.64789" />
+ </g>
+</svg>
diff --git a/share/extensions/test/test_template.py.txt b/share/extensions/test/test_template.py.txt
index 9a570cd6a..9a570cd6a 100644..100755
--- a/share/extensions/test/test_template.py.txt
+++ b/share/extensions/test/test_template.py.txt
diff --git a/share/extensions/text_sentencecase.py b/share/extensions/text_sentencecase.py
index 43460efc5..e699a7efa 100755
--- a/share/extensions/text_sentencecase.py
+++ b/share/extensions/text_sentencecase.py
@@ -6,7 +6,7 @@ class C(chardataeffect.CharDataEffect):
sentence_start = True
was_punctuation = False
- def process_chardata(self,text, line, par):
+ def process_chardata(self, text, line, par):
r = ""
#inkex.debug(text+str(line)+str(par))
for c in text:
diff --git a/share/extensions/text_titlecase.py b/share/extensions/text_titlecase.py
index 1af0db26b..533ab1a39 100755
--- a/share/extensions/text_titlecase.py
+++ b/share/extensions/text_titlecase.py
@@ -5,7 +5,7 @@ class C(chardataeffect.CharDataEffect):
word_ended = True
- def process_chardata(self,text, line, par):
+ def process_chardata(self, text, line, par):
r = ""
for i in range(len(text)):
c = text[i]
diff --git a/share/extensions/ungroup_deep.inx b/share/extensions/ungroup_deep.inx
new file mode 100644
index 000000000..f0b6339e8
--- /dev/null
+++ b/share/extensions/ungroup_deep.inx
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+ <_name>Deep Ungroup</_name>
+ <id>mcepl.ungroup_deep</id>
+ <dependency type="executable" location="extensions">ungroup_deep.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+ <_param name="title" type="description">Ungroup all groups in the selected object.</_param>
+ <param name="startdepth" type="int" min="0" max="65535" _gui-text="Starting Depth">0</param>
+ <param name="maxdepth" type="int" min="0" max="65535" _gui-text="Stopping Depth (from top)">65535</param>
+ <param name="keepdepth" type="int" min="0" max="65535" _gui-text="Depth to Keep (from bottom)">0</param>
+ <effect needs-live-preview="false">
+ <effects-menu >
+ <submenu _name="Arrange" />
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">ungroup_deep.py</command>
+ </script>
+</inkscape-extension>
diff --git a/share/extensions/ungroup_deep.py b/share/extensions/ungroup_deep.py
new file mode 100755
index 000000000..359232007
--- /dev/null
+++ b/share/extensions/ungroup_deep.py
@@ -0,0 +1,281 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+see #inkscape on Freenode and
+https://github.com/nikitakit/svg2sif/blob/master/synfig_prepare.py#L370
+for an example how to do the transform of parent to children.
+"""
+
+__version__ = "0.2" # Works but in terms of maturity, still unsure
+
+from inkex import addNS
+import logging
+import simplestyle
+import simpletransform
+logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s',
+ level=logging.INFO)
+
+try:
+ import inkex
+except ImportError:
+ raise ImportError("""No module named inkex in {0}.""".format(__file__))
+
+try:
+ from numpy import matrix
+except:
+ raise ImportError("""Cannot find numpy.matrix in {0}.""".format(__file__))
+
+SVG_NS = "http://www.w3.org/2000/svg"
+INKSCAPE_NS = "http://www.inkscape.org/namespaces/inkscape"
+
+
+class Ungroup(inkex.Effect):
+
+ def __init__(self):
+ inkex.Effect.__init__(self)
+ self.OptionParser.add_option("-s", "--startdepth",
+ action="store", type="int",
+ dest="startdepth", default=0,
+ help="starting depth for ungrouping")
+ self.OptionParser.add_option("-m", "--maxdepth",
+ action="store", type="int",
+ dest="maxdepth", default=65535,
+ help="maximum ungrouping depth")
+ self.OptionParser.add_option("-k", "--keepdepth",
+ action="store", type="int",
+ dest="keepdepth", default=0,
+ help="levels of ungrouping to " +
+ "leave untouched")
+
+ def _get_dimension(s="1024"):
+ """Convert an SVG length string from arbitrary units to pixels"""
+ if s == "":
+ return 0
+ try:
+ last = int(s[-1])
+ except:
+ last = None
+
+ if type(last) == int:
+ return float(s)
+ elif s[-1] == "%":
+ return 1024
+ elif s[-2:] == "px":
+ return float(s[:-2])
+ elif s[-2:] == "pt":
+ return float(s[:-2]) * 1.33
+ elif s[-2:] == "em":
+ return float(s[:-2]) * 16
+ elif s[-2:] == "mm":
+ return float(s[:-2]) * 3.779
+ elif s[-2:] == "pc":
+ return float(s[:-2]) * 16
+ elif s[-2:] == "cm":
+ return float(s[:-2]) * 37.79
+ elif s[-2:] == "in":
+ return float(s[:-2]) * 96
+ else:
+ return 1024
+
+ def _merge_transform(self, node, transform):
+ """Propagate style and transform to remove inheritance
+ Originally from
+ https://github.com/nikitakit/svg2sif/blob/master/synfig_prepare.py#L370
+ """
+
+ # Compose the transformations
+ if node.tag == addNS("svg", "svg") and node.get("viewBox"):
+ vx, vy, vw, vh = [self._get_dimension(x)
+ for x in node.get("viewBox").split()]
+ dw = self._get_dimension(node.get("width", vw))
+ dh = self._get_dimension(node.get("height", vh))
+ t = ("translate(%f, %f) scale(%f, %f)" %
+ (-vx, -vy, dw / vw, dh / vh))
+ this_transform = simpletransform.parseTransform(
+ t, transform)
+ this_transform = simpletransform.parseTransform(
+ node.get("transform"), this_transform)
+ del node.attrib["viewBox"]
+ else:
+ this_transform = simpletransform.parseTransform(node.get(
+ "transform"), transform)
+
+ # Set the node's transform attrib
+ node.set("transform",
+ simpletransform.formatTransform(this_transform))
+
+ def _merge_style(self, node, style):
+ """Propagate style and transform to remove inheritance
+ Originally from
+ https://github.com/nikitakit/svg2sif/blob/master/synfig_prepare.py#L370
+ """
+
+ # Compose the style attribs
+ this_style = simplestyle.parseStyle(node.get("style", ""))
+ remaining_style = {} # Style attributes that are not propagated
+
+ # Filters should remain on the top ancestor
+ non_propagated = ["filter"]
+ for key in non_propagated:
+ if key in this_style.keys():
+ remaining_style[key] = this_style[key]
+ del this_style[key]
+
+ # Create a copy of the parent style, and merge this style into it
+ parent_style_copy = style.copy()
+ parent_style_copy.update(this_style)
+ this_style = parent_style_copy
+
+ # Merge in any attributes outside of the style
+ style_attribs = ["fill", "stroke"]
+ for attrib in style_attribs:
+ if node.get(attrib):
+ this_style[attrib] = node.get(attrib)
+ del node.attrib[attrib]
+
+ if (node.tag == addNS("svg", "svg")
+ or node.tag == addNS("g", "svg")
+ or node.tag == addNS("a", "svg")
+ or node.tag == addNS("switch", "svg")):
+ # Leave only non-propagating style attributes
+ if len(remaining_style) == 0:
+ if "style" in node.keys():
+ del node.attrib["style"]
+ else:
+ node.set("style", simplestyle.formatStyle(remaining_style))
+
+ else:
+ # This element is not a container
+
+ # Merge remaining_style into this_style
+ this_style.update(remaining_style)
+
+ # Set the element's style attribs
+ node.set("style", simplestyle.formatStyle(this_style))
+
+ def _merge_clippath(self, node, clippathurl):
+
+ if (clippathurl):
+ node_transform = simpletransform.parseTransform(
+ node.get("transform"))
+ if (node_transform):
+ # Clip-paths on nodes with a transform have the transform
+ # applied to the clipPath as well, which we don't want. So, we
+ # create new clipPath element with references to all existing
+ # clippath subelements, but with the inverse transform applied
+ inverse_node_transform = simpletransform.formatTransform(
+ self._invert_transform(node_transform))
+ new_clippath = inkex.etree.SubElement(
+ self.xpathSingle('//svg:defs'), 'clipPath',
+ {'clipPathUnits': 'userSpaceOnUse',
+ 'id': self.uniqueId("clipPath")})
+ clippath = self.getElementById(clippathurl[5:-1])
+ for c in (clippath.iterchildren()):
+ inkex.etree.SubElement(
+ new_clippath, 'use',
+ {inkex.addNS('href', 'xlink'): '#' + c.get("id"),
+ 'transform': inverse_node_transform,
+ 'id': self.uniqueId("use")})
+
+ # Set the clippathurl to be the one with the inverse transform
+ clippathurl = "url(#" + new_clippath.get("id") + ")"
+
+ # Reference the parent clip-path to keep clipping intersection
+ # Find end of clip-path chain and add reference there
+ node_clippathurl = node.get("clip-path")
+ while (node_clippathurl):
+ node = self.getElementById(node_clippathurl[5:-1])
+ node_clippathurl = node.get("clip-path")
+ node.set("clip-path", clippathurl)
+
+ def _invert_transform(self, transform):
+ # duplicate list to avoid modifying it
+ return matrix(transform + [[0, 0, 1]]).I.tolist()[0:2]
+
+ # Flatten a group into same z-order as parent, propagating attribs
+ def _ungroup(self, node):
+ node_parent = node.getparent()
+ node_index = list(node_parent).index(node)
+ node_style = simplestyle.parseStyle(node.get("style"))
+ node_transform = simpletransform.parseTransform(node.get("transform"))
+ node_clippathurl = node.get('clip-path')
+ for c in reversed(list(node)):
+ self._merge_transform(c, node_transform)
+ self._merge_style(c, node_style)
+ self._merge_clippath(c, node_clippathurl)
+ node_parent.insert(node_index, c)
+ node_parent.remove(node)
+
+ # Put all ungrouping restrictions here
+ def _want_ungroup(self, node, depth, height):
+ if (node.tag == addNS("g", "svg") and
+ node.getparent() is not None and
+ height > self.options.keepdepth and
+ depth >= self.options.startdepth and
+ depth <= self.options.maxdepth):
+ return True
+ return False
+
+ def _deep_ungroup(self, node):
+ # using iteration instead of recursion to avoid hitting Python
+ # max recursion depth limits, which is a problem in converted PDFs
+
+ # Seed the queue (stack) with initial node
+ q = [{'node': node,
+ 'depth': 0,
+ 'prev': {'height': None},
+ 'height': None}]
+
+ while q:
+ current = q[-1]
+ node = current['node']
+ depth = current['depth']
+ height = current['height']
+
+ # Recursion path
+ if (height is None):
+ # Don't enter non-graphical portions of the document
+ if (node.tag == addNS("namedview", "sodipodi")
+ or node.tag == addNS("defs", "svg")
+ or node.tag == addNS("metadata", "svg")
+ or node.tag == addNS("foreignObject", "svg")):
+ q.pop()
+
+ # Base case: Leaf node
+ if (node.tag != addNS("g", "svg") or not len(node)):
+ current['height'] = 0
+
+ # Recursive case: Group element with children
+ else:
+ depth += 1
+ for c in node.iterchildren():
+ q.append({'node': c, 'prev': current,
+ 'depth': depth, 'height': None})
+
+ # Return path
+ else:
+ # Ungroup if desired
+ if (self._want_ungroup(node, depth, height)):
+ self._ungroup(node)
+
+ # Propagate (max) height up the call chain
+ height += 1
+ previous = current['prev']
+ prev_height = previous['height']
+ if (prev_height is None or prev_height < height):
+ previous['height'] = height
+
+ # Only process each node once
+ q.pop()
+
+ def effect(self):
+ if len(self.selected):
+ for elem in self.selected.itervalues():
+ self._deep_ungroup(elem)
+ else:
+ for elem in self.document.getroot():
+ self._deep_ungroup(elem)
+
+if __name__ == '__main__':
+ effect = Ungroup()
+ effect.affect()
diff --git a/share/extensions/uniconv-ext.py b/share/extensions/uniconv-ext.py
index f4c80b5d6..876cc4642 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:
@@ -53,10 +51,11 @@ if cmd == None:
import imp
imp.find_module("uniconvertor")
except ImportError:
- sys.stderr.write(_('You need to install the UniConvertor software.\n'+\
+ inkex.localize()
+ inkex.errormsg(_('You need to install the UniConvertor software.\n'+\
'For GNU/Linux: install the package python-uniconvertor.\n'+\
'For Windows: download it from\n'+\
- 'http://sk1project.org/modules.php?name=Products&product=uniconvertor\n'+\
+ 'https://sk1project.net/modules.php?name=Products&product=uniconvertor&op=download\n'+\
'and install into your Inkscape\'s Python location\n'))
sys.exit(1)
cmd = 'python -c "import uniconvertor; uniconvertor.uniconv_run()"'
diff --git a/share/extensions/uniconv_output.py b/share/extensions/uniconv_output.py
index 93236483d..de6b6409f 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)
@@ -119,10 +118,11 @@ def get_command():
import imp
imp.find_module("uniconvertor")
except ImportError:
- sys.stderr.write(_('You need to install the UniConvertor software.\n'+\
+ inkex.localize()
+ inkex.errormsg(_('You need to install the UniConvertor software.\n'+\
'For GNU/Linux: install the package python-uniconvertor.\n'+\
'For Windows: download it from\n'+\
- 'http://sk1project.org/modules.php?name=Products&product=uniconvertor\n'+\
+ 'https://sk1project.net/modules.php?name=Products&product=uniconvertor&op=download\n'+\
'and install into your Inkscape\'s Python location\n'))
sys.exit(1)
cmd = 'python -c "import uniconvertor; uniconvertor.uniconv_run();"'
diff --git a/share/extensions/voronoi.py b/share/extensions/voronoi.py
index ac2c13f8f..ac2c13f8f 100644..100755
--- a/share/extensions/voronoi.py
+++ b/share/extensions/voronoi.py
diff --git a/share/extensions/voronoi2svg.py b/share/extensions/voronoi2svg.py
index d4740b7f5..5232fb81e 100644..100755
--- 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='' ):
diff --git a/share/extensions/wmf_input.inx b/share/extensions/wmf_input.inx
index 06c610d9e..db0f210e1 100644
--- a/share/extensions/wmf_input.inx
+++ b/share/extensions/wmf_input.inx
@@ -6,7 +6,7 @@
<input>
<extension>.wmf</extension>
<mimetype>application/x-wmf</mimetype>
- <_filetypename>Windows Metafile (*.wmf)</_filetypename>
+ <_filetypename>Windows Metafile (UC) (*.wmf)</_filetypename>
<_filetypetooltip>A popular graphics file format for clipart</_filetypetooltip>
</input>
<script>
diff --git a/share/extensions/wmf_output.inx b/share/extensions/wmf_output.inx
index e00721f0a..bc43a82a9 100644
--- a/share/extensions/wmf_output.inx
+++ b/share/extensions/wmf_output.inx
@@ -6,7 +6,7 @@
<output>
<extension>.wmf</extension>
<mimetype>application/x-wmf</mimetype>
- <_filetypename>Windows Metafile (*.wmf)</_filetypename>
+ <_filetypename>Windows Metafile (UC) (*.wmf)</_filetypename>
<_filetypetooltip>A popular graphics file format for clipart</_filetypetooltip>
</output>
<script>
diff --git a/share/extensions/xaml2svg/Makefile.am b/share/extensions/xaml2svg/Makefile.am
deleted file mode 100644
index 89a901fde..000000000
--- a/share/extensions/xaml2svg/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-
-xaml2svg_otherstuffdir = $(datadir)/inkscape/extensions/xaml2svg
-
-xaml2svg_otherstuff = \
- animation.xsl \
- brushes.xsl \
- canvas.xsl \
- geometry.xsl \
- Makefile.am \
- properties.xsl \
- shapes.xsl \
- transform.xsl
-
-xaml2svg_otherstuff_DATA = \
- $(xaml2svg_otherstuff)
-
-EXTRA_DIST = \
- $(xaml2svg_otherstuff_DATA)
-