diff options
Diffstat (limited to 'lib/extensions/reorder.py')
| -rw-r--r-- | lib/extensions/reorder.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/extensions/reorder.py b/lib/extensions/reorder.py index 933c1d70..956c0615 100644 --- a/lib/extensions/reorder.py +++ b/lib/extensions/reorder.py @@ -3,18 +3,26 @@ # Copyright (c) 2010 Authors # Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. +from inkex import errormsg + +from ..i18n import _ from .base import InkstitchExtension class Reorder(InkstitchExtension): - # Remove selected objects from the document and readd them in the order they + # Remove selected objects from the document and re-add them in the order they # were selected. def effect(self): - objects = self.get_selected_in_order() + objects = self.svg.selection + + if not objects: + errormsg(_("Please select at least two elements to reorder.")) + return - for obj in objects[1:]: - obj.getparent().remove(obj) + for obj in objects: + if not obj == objects.first(): + obj.getparent().remove(obj) insert_parent = objects[0].getparent() insert_pos = insert_parent.index(objects[0]) |
