# HG changeset patch # User Goffi # Date 1524840418 -7200 # Node ID a0e486074d91f78749bd2f16e1ffb92887480908 # Parent a5e8833184c6c5d0db8e5497193ce3153bc054a3 widget handler: block carousel swiping when there is only one slide diff -r a5e8833184c6 -r a0e486074d91 cagou/core/widgets_handler.py --- a/cagou/core/widgets_handler.py Fri Apr 27 16:45:09 2018 +0200 +++ b/cagou/core/widgets_handler.py Fri Apr 27 16:46:58 2018 +0200 @@ -25,6 +25,7 @@ from kivy.graphics import Color, Ellipse from kivy.uix.layout import Layout from kivy.uix.boxlayout import BoxLayout +from kivy.uix.stencilview import StencilView from kivy.metrics import dp from kivy import properties from cagou import G @@ -157,7 +158,11 @@ touch.ud['ori_width'] = self.width self._draw_ellipse() else: - return super(WHWrapper, self).on_touch_down(touch) + if len(self.carousel.slides) == 1: + # we don't want swipe if there is only one slide + return StencilView.on_touch_down(self.carousel, touch) + else: + return super(WHWrapper, self).on_touch_down(touch) def on_touch_move(self, touch): """handle size change and widget creation on split"""