Removed deprecations from twist extension

This commit is contained in:
leyghisbb 2020-08-30 11:50:15 +02:00
parent f705ef2575
commit 423fafd352
2 changed files with 24 additions and 42 deletions

View File

@ -1,38 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Twist</name> <name>Twist</name>
<id>fablabchemnitz.de.twist</id> <id>fablabchemnitz.de.twist</id>
<param name="Header" type="description" xml:space="preserve"> <label>Iteratively twist and self-inscribea polygon within itself. The number of twists is how many iterations to perform. The step ratio is the fractional distance along an edge to move each vertex.</label>
Iteratively twist and self-inscribe <param name="nSteps" type="int" min="1" max="100" gui-text=" Number of twists">8</param>
a polygon within itself. <param name="fRatio" type="float" min="-10" max="10" precision="5" gui-text=" Step ratio">0.15</param>
<effect needs-live-preview="true">
The number of twists is how many <object-type>all</object-type>
iterations to perform. <effects-menu>
<submenu name="FabLab Chemnitz">
The step ratio is the fractional <submenu name="Shape/Pattern from existing Path(s)"/>
distance along an edge to move each </submenu>
vertex. </effects-menu>
</effect>
*** <script>
This extension is intended as an <command location="inx" interpreter="python">fablabchemnitz_eggbot_twist.py</command>
example of how to write an Inkscape </script>
extension for use with the Eggbot.
See the eggbot_twist.py file in the
Inkscape extensions directory for
this extensions' Python code.
***
</param>
<param name="nSteps" type="int" min="1" max="100" gui-text=" Number of twists">8</param>
<param name="fRatio" type="float" min="-10" max="10" precision="5" gui-text=" Step ratio">0.15</param>
<effect needs-live-preview="true">
<object-type>all</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Shape/Pattern from existing Path(s)"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">fablabchemnitz_eggbot_twist.py</command>
</script>
</inkscape-extension> </inkscape-extension>

View File

@ -284,11 +284,11 @@ class Twist(inkex.Effect):
w = float(node.get('width', '0')) w = float(node.get('width', '0'))
h = float(node.get('height', '0')) h = float(node.get('height', '0'))
a = [] a = []
a.append(['M ', [x, y]]) a.append(['M', [x, y]])
a.append([' l ', [w, 0]]) a.append(['l', [w, 0]])
a.append([' l ', [0, h]]) a.append(['l', [0, h]])
a.append([' l ', [-w, 0]]) a.append(['l', [-w, 0]])
a.append([' Z', []]) a.append(['Z', []])
self.addPathVertices(Path(a), node, mat_new, clone_transform) self.addPathVertices(Path(a), node, mat_new, clone_transform)
elif node.tag in [inkex.addNS('line', 'svg'), 'line']: elif node.tag in [inkex.addNS('line', 'svg'), 'line']:
@ -504,7 +504,8 @@ class Twist(inkex.Effect):
if self.options.ids: if self.options.ids:
# Traverse the selected objects # Traverse the selected objects
for id_ in self.options.ids: for id_ in self.options.ids:
self.recursivelyTraverseSvg([self.svg.selected[id_]]) # self.recursivelyTraverseSvg([self.svg.selected[id_]])
self.recursivelyTraverseSvg([self.svg.getElementById(id_)])
else: else:
# Traverse the entire document # Traverse the entire document
self.recursivelyTraverseSvg(self.document.getroot()) self.recursivelyTraverseSvg(self.document.getroot())
@ -516,4 +517,4 @@ class Twist(inkex.Effect):
if __name__ == '__main__': if __name__ == '__main__':
Twist().run() Twist().run()