mirror of https://github.com/kivy/kivy.git
UIX:add_widget: raise Exception instead of just a warning on multiple
parents
This commit is contained in:
parent
e49a29f1e9
commit
265d9858db
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue