mirror of https://github.com/kivy/kivy.git
Added forced dispatch of on_selection_change after instantiation of DetailView in examples.
This commit is contained in:
parent
672b7a223c
commit
634aabbcf6
|
@ -19,7 +19,6 @@ class DetailView(GridLayout):
|
|||
def __init__(self, **kwargs):
|
||||
kwargs['cols'] = 2
|
||||
super(DetailView, self).__init__(**kwargs)
|
||||
self.bind(fruit_name=self.redraw)
|
||||
|
||||
def redraw(self, *args):
|
||||
self.clear_widgets()
|
||||
|
@ -101,6 +100,9 @@ class CascadingView(GridLayout):
|
|||
on_selection_change=detail_view.on_selection_change)
|
||||
self.add_widget(detail_view)
|
||||
|
||||
# Force triggering of on_selection_change() for the DetailView, for
|
||||
# correct initial display.
|
||||
fruits_list_adapter.touch_selection()
|
||||
|
||||
# Data from http://www.fda.gov/Food/LabelingNutrition/\
|
||||
# FoodLabelingGuidanceRegulatoryInformation/\
|
||||
|
|
|
@ -147,6 +147,10 @@ class MasterDetailView(GridLayout):
|
|||
|
||||
list_adapter.bind(on_selection_change=detail_view.on_selection_change)
|
||||
|
||||
# Force triggering of on_selection_change() for the DetailView, for
|
||||
# correct initial display.
|
||||
list_adapter.touch_selection()
|
||||
|
||||
# Data from http://www.fda.gov/Food/LabelingNutrition/\
|
||||
# FoodLabelingGuidanceRegulatoryInformation/\
|
||||
# InformationforRestaurantsRetailEstablishments/\
|
||||
|
|
|
@ -67,6 +67,10 @@ class MasterDetailView(GridLayout):
|
|||
|
||||
list_adapter.bind(on_selection_change=detail_view.on_selection_change)
|
||||
|
||||
# Force triggering of on_selection_change() for the DetailView, for
|
||||
# correct initial display.
|
||||
list_adapter.touch_selection()
|
||||
|
||||
# Data from http://www.fda.gov/Food/LabelingNutrition/\
|
||||
# FoodLabelingGuidanceRegulatoryInformation/\
|
||||
# InformationforRestaurantsRetailEstablishments/\
|
||||
|
|
|
@ -122,6 +122,9 @@ class ListAdapter(SelectionSupport, SimpleListAdapter):
|
|||
#else:
|
||||
#print 'ERROR: No data, so cannot initialize selection.'
|
||||
|
||||
def touch_selection(self):
|
||||
self.dispatch('on_selection_change')
|
||||
|
||||
|
||||
class ListsAdapter(ListAdapter):
|
||||
'''ListsAdapter is specialized for managing a dict of lists. It has wide
|
||||
|
|
|
@ -104,8 +104,6 @@ class SelectionSupport(object):
|
|||
self.bind(selection_mode=self.check_for_empty_selection,
|
||||
allow_empty_selection=self.check_for_empty_selection)
|
||||
|
||||
#self.check_for_empty_selection()
|
||||
|
||||
def handle_selection(self, obj):
|
||||
if obj not in self.selection:
|
||||
if self.selection_mode == 'single' and len(self.selection) > 0:
|
||||
|
|
Loading…
Reference in New Issue