From 775561d9b09a4ce32f598f47d273db8e4c9a798c Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Tue, 25 Sep 2012 17:55:54 +0200 Subject: [PATCH] carousel: fix remove_widget. closes #676 --- kivy/uix/carousel.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kivy/uix/carousel.py b/kivy/uix/carousel.py index 805949c56..114e5c97a 100644 --- a/kivy/uix/carousel.py +++ b/kivy/uix/carousel.py @@ -318,12 +318,15 @@ class Carousel(StencilView): super(Carousel, self).add_widget(slide) self.slides.append(slide) - def remove_widget(self, widget, *l, **kwargs): + def remove_widget(self, widget, *args, **kwargs): + # XXX be careful, the widget.parent.parent refer to the RelativeLayout + # added in add_widget(). But it will break if RelativeLayout + # implementation change. if widget.parent.parent in self.slides: - slide = widget.parent + slide = widget.parent.parent self.slides.remove(slide) - return slide.remove_widget(widget, *l, **kwargs) - return super(Carousel, self).remove_widget(widget, *l, **kwargs) + return slide.remove_widget(widget, *args, **kwargs) + return super(Carousel, self).remove_widget(widget, *args, **kwargs) if __name__ == '__main__':