#NEWLINE# def get_key_label_from_keycode( self , keycode , extra_info = False ) : #NEWLINE# #INDENT# 'Get tag using keycode, if no match, returns None.' #NEWLINE# label = None #NEWLINE# for mask in reversed ( sorted ( self . _key_patterns . keys ( ) ) ) : #NEWLINE# #INDENT# masked_keycode = ( keycode & mask ) #NEWLINE# if ( masked_keycode in self . _key_patterns [ mask ] ) : #NEWLINE# #INDENT# label = self . _key_patterns [ mask ] [ masked_keycode ] #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if keycode : #NEWLINE# #INDENT# return ( label , [ ( keycode & mask ) for mask in reversed ( sorted ( self . _key_patterns . keys ( ) ) ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return label