#NEWLINE# def process_hit( self , shot , shot_list_item ) : #NEWLINE# #INDENT# is_hit = False #NEWLINE# x = shot . get_coords ( ) [ 0 ] #NEWLINE# y = shot . get_coords ( ) [ 1 ] #NEWLINE# regions = self . _webcam_canvas . find_overlapping ( x , y , x , y ) #NEWLINE# for region in reversed ( regions ) : #NEWLINE# #INDENT# tags = TagParser . parse_tags ( self . _webcam_canvas . gettags ( region ) ) #NEWLINE# if ( ( '_shape:image' in self . _webcam_canvas . gettags ( region ) ) and self . _canvas_manager . is_transparent_pixel ( region , x , y ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( ( '_internal_name' in tags ) and ( 'command' in tags ) ) : #NEWLINE# #INDENT# self . _canvas_manager . execute_region_commands ( region , tags [ 'command' ] , self . _protocol_operations ) #NEWLINE# #UNINDENT# if ( ( '_internal_name' in tags ) and ( self . _loaded_training != None ) ) : #NEWLINE# #INDENT# self . _loaded_training . hit_listener ( region , tags , shot , shot_list_item ) #NEWLINE# #UNINDENT# if ( '_internal_name' in tags ) : #NEWLINE# #INDENT# is_hit = True #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# for region in regions : #NEWLINE# #INDENT# tags = TagParser . parse_tags ( self . _webcam_canvas . gettags ( regions ) ) #NEWLINE# if ( ( 'visible' in tags ) and ( 'command' in tags ) and ( tags [ 'visible' ] . lower ( ) == 'false' ) ) : #NEWLINE# #INDENT# self . _canvas_manager . execute_region_commands ( region , tags [ 'command' ] , self . _protocol_operations ) #NEWLINE# #UNINDENT# #UNINDENT# if ( self . _loaded_training != None ) : #NEWLINE# #INDENT# self . _loaded_training . shot_listener ( shot , shot_list_item , is_hit )