From 265d9858db3ef14ece11e9d56395ea1640f22753 Mon Sep 17 00:00:00 2001 From: Qua-non Date: Sat, 21 Jul 2012 14:17:58 +0530 Subject: [PATCH] UIX:add_widget: raise Exception instead of just a warning on multiple parents --- kivy/uix/widget.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/kivy/uix/widget.py b/kivy/uix/widget.py index 5042c2100..a3c122ea0 100644 --- a/kivy/uix/widget.py +++ b/kivy/uix/widget.py @@ -65,7 +65,6 @@ from kivy.properties import NumericProperty, StringProperty, \ from kivy.graphics import Canvas from kivy.base import EventLoop from kivy.lang import Builder -from kivy.logger import Logger class WidgetException(Exception): @@ -231,10 +230,8 @@ class Widget(EventDispatcher): parent = widget.parent # check if widget is already a child of another widget if parent: - Logger.warning(''.join(('Cannot add Widget ', str(widget),\ - ' It already has a parent ', str(parent), - ' Skipping addition'))) - return + raise WidgetException(''.join(('Cannot add ', str(widget),\ + ' It already has a parent: ', str(parent)))) widget.parent = self if index == 0 or len(self.children) == 0: self.children.insert(0, widget)