no message

This commit is contained in:
Mario Voigt 2020-08-12 22:47:42 +02:00
parent 06920fa1c5
commit 07e221652e
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Remove Empty Groups</name>
<id>fablabchemnitz.de.cleangroups</id>
<effect needs-live-preview="false">
<object-type>path</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz Dev"/>
</effects-menu>
</effect>
<script>
<command reldir="extensions" interpreter="python">fablabchemnitz_cleangroups.py</command>
</script>
</inkscape-extension>

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
import inkex
class CleanGroups(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
def effect(self):
groups = self.document.xpath('//svg:g',namespaces=inkex.NSS)
for group in groups:
if len(group.getchildren()) == 0:
group.getparent().remove(group)
CleanGroups().run()