update for migrategroups extension

This commit is contained in:
Mario Voigt 2020-08-13 14:47:06 +02:00
parent d15de8b64a
commit f3678d4c01
2 changed files with 4 additions and 3 deletions

View File

@ -11,6 +11,6 @@
</effects-menu> </effects-menu>
</effect> </effect>
<script> <script>
<command reldir="extensions" interpreter="python">fablabchemnitz_migrategroups.py</command> <command location="inx" interpreter="python">fablabchemnitz_migrategroups.py</command>
</script> </script>
</inkscape-extension> </inkscape-extension>

View File

@ -57,8 +57,9 @@ class MigrateGroups(inkex.Effect):
group.getparent().remove(group) group.getparent().remove(group)
#remove the selected, now empty group (if it's the case) #remove the selected, now empty group (if it's the case)
if self.svg.selected[0].tag == inkex.addNS('g','svg'): if len(self.svg.selected) > 0:
self.svg.selected[0].getparent().remove(self.svg.selected[0]) if self.svg.selected[0].tag == inkex.addNS('g','svg'):
self.svg.selected[0].getparent().remove(self.svg.selected[0])
#TODO: make newGroup selected now. How ? #TODO: make newGroup selected now. How ?
MigrateGroups().run() MigrateGroups().run()