From: Javier Sancho Date: Wed, 18 Jul 2018 11:35:25 +0000 (+0200) Subject: Create boxes only when needed X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=803bbb041149f9ca3ad2739c7023bc5522e71ffd;p=kivyforms.git Create boxes only when needed --- diff --git a/kivyforms/formcanvas.py b/kivyforms/formcanvas.py index 4cd1b80..0e233fb 100644 --- a/kivyforms/formcanvas.py +++ b/kivyforms/formcanvas.py @@ -70,20 +70,19 @@ class Grabbable(BoxLayout): widget.parent.add_widget(self, index=idx + 1) elif widget.point_area == 'bottom': widget.parent.add_widget(self, index=idx) - elif widget.point_area == 'left': - parent = widget.parent - box = parent.create_box() - parent.add_widget(box, index=idx) - box.add_widget(self) - parent.remove_widget(widget) - box.add_widget(widget) else: parent = widget.parent - box = parent.create_box() - parent.add_widget(box, index=idx) - parent.remove_widget(widget) - box.add_widget(widget) - box.add_widget(self) + if not isinstance(parent, BoxLayout): + box = parent.create_box() + parent.add_widget(box, index=idx) + parent.remove_widget(widget) + box.add_widget(widget) + idx = 0 + parent = box + if widget.point_area == 'left': + parent.add_widget(self, index=idx + 1) + else: + parent.add_widget(self, index=idx) widget.point() break else: