#NEWLINE# def create_view( self , index ) : #NEWLINE# #INDENT# 'This method is more complicated than the ones in the\n        :class:`~kivy.adapters.adapter.Adapter` and\n        :class:`~kivy.adapters.simplelistadapter.SimpleListAdapter` classes\n        because here we create bindings for the data items and their children\n        back to the *self.handle_selection()* event. We also perform\n        other selection-related tasks to keep item views in sync with the data.\n        ' #NEWLINE# item = self . get_data_item ( index ) #NEWLINE# if ( item is None ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# item_args = self . args_converter ( index , item ) #NEWLINE# item_args [ 'index' ] = index #NEWLINE# cls = self . get_cls ( ) #NEWLINE# if cls : #NEWLINE# #INDENT# view_instance = cls ( ** item_args ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# view_instance = Builder . template ( self . template , ** item_args ) #NEWLINE# #UNINDENT# if self . propagate_selection_to_data : #NEWLINE# #INDENT# if isinstance ( item , SelectableDataItem ) : #NEWLINE# #INDENT# if item . is_selected : #NEWLINE# #INDENT# self . handle_selection ( view_instance ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( type ( item ) == dict ) and ( 'is_selected' in item ) ) : #NEWLINE# #INDENT# if item [ 'is_selected' ] : #NEWLINE# #INDENT# self . handle_selection ( view_instance ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( item , 'is_selected' ) : #NEWLINE# #INDENT# if ( inspect . isfunction ( item . is_selected ) or inspect . ismethod ( item . is_selected ) ) : #NEWLINE# #INDENT# if item . is_selected ( ) : #NEWLINE# #INDENT# self . handle_selection ( view_instance ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if item . is_selected : #NEWLINE# #INDENT# self . handle_selection ( view_instance ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# msg = 'ListAdapter: unselectable data item for {0}' #NEWLINE# raise Exception ( msg . format ( index ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# view_instance . bind ( on_release = self . handle_selection ) #NEWLINE# for child in view_instance . children : #NEWLINE# #INDENT# child . bind ( on_release = self . handle_selection ) #NEWLINE# #UNINDENT# return view_instance