mirror of https://github.com/kivy/kivy.git
carousel: fix remove_widget. closes #676
This commit is contained in:
parent
0d4e5a2671
commit
775561d9b0
|
@ -318,12 +318,15 @@ class Carousel(StencilView):
|
||||||
super(Carousel, self).add_widget(slide)
|
super(Carousel, self).add_widget(slide)
|
||||||
self.slides.append(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:
|
if widget.parent.parent in self.slides:
|
||||||
slide = widget.parent
|
slide = widget.parent.parent
|
||||||
self.slides.remove(slide)
|
self.slides.remove(slide)
|
||||||
return slide.remove_widget(widget, *l, **kwargs)
|
return slide.remove_widget(widget, *args, **kwargs)
|
||||||
return super(Carousel, self).remove_widget(widget, *l, **kwargs)
|
return super(Carousel, self).remove_widget(widget, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue