Moved viewbox extension to legacy tools

This commit is contained in:
leyghisbb 2020-08-30 11:19:03 +02:00
parent 6ba341e3d1
commit adbdc6d218
2 changed files with 15 additions and 15 deletions

View File

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Set View Box</name>
<id>fablabchemnitz.de.setviewbox</id>
<effect>
<object-type>rect</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Various"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">fablabchemnitz_viewbox.py</command>
</script>
<name>Set View Box</name>
<id>fablabchemnitz.de.setviewbox</id>
<effect>
<object-type>rect</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Legacy Tools"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">fablabchemnitz_viewbox.py</command>
</script>
</inkscape-extension>

View File

@ -34,7 +34,7 @@ class SetViewBoxEffect(inkex.Effect):
def effect(self):
if len(self.svg.selected) != 1:
sys.exit("Error: You must select exactly one rectangle")
elif self.svg.selected[0].tag != inkex.addNS('rect','svg'):
if list(self.svg.selected.items())[0][1].tag != inkex.addNS('rect','svg'):
sys.exit("Error: You must select exactly one rectangle")
sel = None
@ -67,4 +67,4 @@ def transformPoint(mat, pt):
Transform(mat).apply_to_point(pt2)
return (pt2[0], pt2[1])
SetViewBoxEffect().run()
SetViewBoxEffect().run()