carousel: fix remove_widget. closes #676

This commit is contained in:
Mathieu Virbel 2012-09-25 17:55:54 +02:00
parent 0d4e5a2671
commit 775561d9b0
1 changed files with 7 additions and 4 deletions

View File

@ -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__':