mirror of https://github.com/kivy/kivy.git
Merge pull request #4511 from matham/dropdowns
Fix dropdown and spinner issue
This commit is contained in:
commit
e0c77c8238
|
@ -314,6 +314,8 @@ class DropDown(ScrollView):
|
|||
return True
|
||||
if 'button' in touch.profile and touch.button.startswith('scroll'):
|
||||
return
|
||||
if self.collide_point(*touch.pos):
|
||||
return True
|
||||
if self.auto_dismiss:
|
||||
self.dismiss()
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ class Spinner(Button):
|
|||
|
||||
.. versionadded:: 1.4.0
|
||||
'''
|
||||
|
||||
|
||||
sync_height = BooleanProperty(False)
|
||||
'''Each element in a dropdown list uses a default/user-supplied height.
|
||||
Set to True to propagate the Spinner's height value to each dropdown
|
||||
|
@ -138,7 +138,7 @@ class Spinner(Button):
|
|||
fbind('dropdown_cls', build_dropdown)
|
||||
fbind('option_cls', build_dropdown)
|
||||
fbind('values', self._update_dropdown)
|
||||
fbind('size', self._update_dropdown)
|
||||
fbind('size', self._update_dropdown_size)
|
||||
fbind('text_autoupdate', self._update_dropdown)
|
||||
build_dropdown()
|
||||
|
||||
|
@ -156,6 +156,19 @@ class Spinner(Button):
|
|||
self._dropdown.bind(on_dismiss=self._close_dropdown)
|
||||
self._update_dropdown()
|
||||
|
||||
def _update_dropdown_size(self, *largs):
|
||||
if not self.sync_height:
|
||||
return
|
||||
dp = self._dropdown
|
||||
if not dp:
|
||||
return
|
||||
|
||||
container = dp.container
|
||||
if not container:
|
||||
return
|
||||
for value in container.children:
|
||||
item.height = self.height
|
||||
|
||||
def _update_dropdown(self, *largs):
|
||||
dp = self._dropdown
|
||||
cls = self.option_cls
|
||||
|
|
Loading…
Reference in New Issue