comparison cagou/core/widgets_handler.py @ 365:9c6fe392d623

core (widgets_handler): use a StencilView + BoxLayout instead of ScrollView as wrapper: The default wrapping when no Carousel or ScreenManager was used was a ScrollView. This was causing bugs as the touch event is not propagated correctly when a ScrollView is in children of ScrollView (notably causing trouble with ModernMenu on ContactList and FileSharing widgets). To avoid that, a simple StencilView with BoxLayout is now used instead. If a ScrollView is needed, it can be added inside the widget (this is the case for WidgetSelector).
author Goffi <goffi@goffi.org>
date Mon, 27 Jan 2020 21:17:08 +0100
parents e1f56257cabc
children 4d660b252487
comparison
equal deleted inserted replaced
364:a1f3af7c0b67 365:9c6fe392d623
24 from kivy.uix.layout import Layout 24 from kivy.uix.layout import Layout
25 from kivy.uix.boxlayout import BoxLayout 25 from kivy.uix.boxlayout import BoxLayout
26 from kivy.uix.stencilview import StencilView 26 from kivy.uix.stencilview import StencilView
27 from kivy.uix.carousel import Carousel 27 from kivy.uix.carousel import Carousel
28 from kivy.uix.screenmanager import ScreenManager, Screen 28 from kivy.uix.screenmanager import ScreenManager, Screen
29 from kivy.uix.scrollview import ScrollView
30 from kivy.metrics import dp 29 from kivy.metrics import dp
31 from kivy import properties 30 from kivy import properties
32 from cagou import G 31 from cagou import G
33 from .constants import Const as C 32 from .constants import Const as C
34 from . import cagou_widget 33 from . import cagou_widget
36 log = logging.getLogger(__name__) 35 log = logging.getLogger(__name__)
37 36
38 37
39 REMOVE_WID_LIMIT = dp(50) 38 REMOVE_WID_LIMIT = dp(50)
40 MIN_WIDTH = MIN_HEIGHT = dp(70) 39 MIN_WIDTH = MIN_HEIGHT = dp(70)
40
41
42 class BoxStencil(BoxLayout, StencilView):
43 pass
41 44
42 45
43 class WHWrapper(BoxLayout): 46 class WHWrapper(BoxLayout):
44 main_container = properties.ObjectProperty(None) 47 main_container = properties.ObjectProperty(None)
45 screen_manager = properties.ObjectProperty(None, allownone=True) 48 screen_manager = properties.ObjectProperty(None, allownone=True)
369 assert len(self.children) == 0 372 assert len(self.children) == 0
370 373
371 if wid.collection_carousel or wid.global_screen_manager: 374 if wid.collection_carousel or wid.global_screen_manager:
372 self.main_container = self 375 self.main_container = self
373 else: 376 else:
374 self.main_container = ScrollView() 377 self.main_container = BoxStencil()
375 self.add_widget(self.main_container) 378 self.add_widget(self.main_container)
376 379
377 if self.carousel is not None: 380 if self.carousel is not None:
378 return self.carousel.add_widget(wid, index) 381 return self.carousel.add_widget(wid, index)
379 382