UIX:add_widget: raise Exception instead of just a warning on multiple

parents
This commit is contained in:
Qua-non 2012-07-21 14:17:58 +05:30
parent e49a29f1e9
commit 265d9858db
1 changed files with 2 additions and 5 deletions

View File

@ -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)