uix:Carousel fix ref to slide container reflecting changes in RelativeLayout

This commit is contained in:
qua-non 2013-03-29 21:21:30 +05:30
parent 555d7b30aa
commit 71fe0d2ac2
1 changed files with 4 additions and 4 deletions

View File

@ -61,7 +61,7 @@ class Carousel(StencilView):
'''
def _get_slides_container(self):
return [x.parent.parent for x in self.slides]
return [x.parent for x in self.slides]
slides_container = AliasProperty(_get_slides_container, None,
bind=('slides', ))
@ -236,7 +236,7 @@ class Carousel(StencilView):
super(Carousel, self).__init__(**kwargs)
def get_slide_container(self, slide):
return slide.parent.parent
return slide.parent
def _insert_visible_slides(self):
get_slide_container = self.get_slide_container
@ -500,12 +500,12 @@ class Carousel(StencilView):
self.slides.append(widget)
def remove_widget(self, widget, *args, **kwargs):
# XXX be careful, the widget.parent.parent refer to the RelativeLayout
# XXX be careful, the widget.parent refer to the RelativeLayout
# added in add_widget(). But it will break if RelativeLayout
# implementation change.
# if we passed the real widget
if widget in self.slides:
slide = widget.parent.parent
slide = widget.parent
self.slides.remove(widget)
return slide.remove_widget(widget, *args, **kwargs)
return super(Carousel, self).remove_widget(widget, *args, **kwargs)