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"?> <?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>Set View Box</name> <name>Set View Box</name>
<id>fablabchemnitz.de.setviewbox</id> <id>fablabchemnitz.de.setviewbox</id>
<effect> <effect>
<object-type>rect</object-type> <object-type>rect</object-type>
<effects-menu> <effects-menu>
<submenu name="FabLab Chemnitz"> <submenu name="FabLab Chemnitz">
<submenu name="Various"/> <submenu name="Legacy Tools"/>
</submenu> </submenu>
</effects-menu> </effects-menu>
</effect> </effect>
<script> <script>
<command location="inx" interpreter="python">fablabchemnitz_viewbox.py</command> <command location="inx" interpreter="python">fablabchemnitz_viewbox.py</command>
</script> </script>
</inkscape-extension> </inkscape-extension>

View File

@ -34,7 +34,7 @@ class SetViewBoxEffect(inkex.Effect):
def effect(self): def effect(self):
if len(self.svg.selected) != 1: if len(self.svg.selected) != 1:
sys.exit("Error: You must select exactly one rectangle") 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") sys.exit("Error: You must select exactly one rectangle")
sel = None sel = None
@ -67,4 +67,4 @@ def transformPoint(mat, pt):
Transform(mat).apply_to_point(pt2) Transform(mat).apply_to_point(pt2)
return (pt2[0], pt2[1]) return (pt2[0], pt2[1])
SetViewBoxEffect().run() SetViewBoxEffect().run()