#NEWLINE# def key_pressed( self , event ) : #NEWLINE# #INDENT# '\n        Maps pressed keys to functions\n        ' #NEWLINE# frame = self . GetParent ( ) . GetParent ( ) . GetParent ( ) #NEWLINE# frame . SetStatusText ( '' ) #NEWLINE# sh = event . ShiftDown ( ) #NEWLINE# ctrl = event . ControlDown ( ) #NEWLINE# keycode = event . GetKeyCode ( ) #NEWLINE# if ( keycode == ord ( 'P' ) ) : #NEWLINE# #INDENT# row = self . GetGridCursorRow ( ) #NEWLINE# if sh : #NEWLINE# #INDENT# col = self . GetGridCursorCol ( ) #NEWLINE# self . pickattr ( row , col ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . pick ( row ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == ord ( 'M' ) ) : #NEWLINE# #INDENT# if ctrl : #NEWLINE# #INDENT# col = self . GetGridCursorCol ( ) #NEWLINE# self . pickrowsattr ( sorted ( self . current_selection ) , col ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . pickrows ( sorted ( self . current_selection ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( keycode in ( wx . WXK_BACK , wx . WXK_DELETE , ord ( 'X' ) ) ) and ( not ( ctrl or sh ) ) ) : #NEWLINE# #INDENT# self . delete_current_notebook ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode in ( ord ( 'E' ) , ord ( '\r' ) ) ) : #NEWLINE# #INDENT# row = self . GetGridCursorRow ( ) #NEWLINE# if sh : #NEWLINE# #INDENT# col = self . GetGridCursorCol ( ) #NEWLINE# self . enterattr ( row , col ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . enter ( row ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( keycode == ord ( 'E' ) ) and ctrl ) : #NEWLINE# #INDENT# row = self . GetGridCursorRow ( ) #NEWLINE# self . SetGridCursor ( row , ( self . GetNumberCols ( ) - 1 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( keycode == wx . WXK_HOME ) or ( ( keycode == ord ( 'A' ) ) and ctrl ) ) : #NEWLINE# #INDENT# row = self . GetGridCursorRow ( ) #NEWLINE# self . SetGridCursor ( row , 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( keycode == ord ( 'C' ) ) and sh ) : #NEWLINE# #INDENT# col = self . GetGridCursorCol ( ) #NEWLINE# attr = self . table . _displayattrs [ col ] #NEWLINE# result = [ ] #NEWLINE# for i in range ( self . GetNumberRows ( ) ) : #NEWLINE# #INDENT# result . append ( self . table . _displayattrs [ col ] . value ( self . table . items [ i ] ) ) #NEWLINE# #UNINDENT# self . quit ( result ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( keycode in ( wx . WXK_ESCAPE , ord ( 'Q' ) ) ) and ( not ( ctrl or sh ) ) ) : #NEWLINE# #INDENT# self . quit ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == ord ( '<' ) ) : #NEWLINE# #INDENT# row = self . GetGridCursorRow ( ) #NEWLINE# col = self . GetGridCursorCol ( ) #NEWLINE# if ( not event . ShiftDown ( ) ) : #NEWLINE# #INDENT# newcol = ( col - 1 ) #NEWLINE# if ( newcol >= 0 ) : #NEWLINE# #INDENT# self . SetGridCursor ( row , ( col - 1 ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# newcol = ( col + 1 ) #NEWLINE# if ( newcol < self . GetNumberCols ( ) ) : #NEWLINE# #INDENT# self . SetGridCursor ( row , ( col + 1 ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == ord ( 'D' ) ) : #NEWLINE# #INDENT# col = self . GetGridCursorCol ( ) #NEWLINE# row = self . GetGridCursorRow ( ) #NEWLINE# if ( not sh ) : #NEWLINE# #INDENT# self . detail ( row , col ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . detail_attr ( row , col ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( keycode == ord ( 'F' ) ) and ctrl ) : #NEWLINE# #INDENT# if sh : #NEWLINE# #INDENT# frame . enter_searchexpression ( event ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# frame . enter_searchtext ( event ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == wx . WXK_F3 ) : #NEWLINE# #INDENT# if sh : #NEWLINE# #INDENT# frame . find_previous ( event ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# frame . find_next ( event ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == ord ( 'V' ) ) : #NEWLINE# #INDENT# if sh : #NEWLINE# #INDENT# self . sortattrdesc ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . sortattrasc ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == wx . WXK_DOWN ) : #NEWLINE# #INDENT# row = self . GetGridCursorRow ( ) #NEWLINE# try : #NEWLINE# #INDENT# item = self . table . items [ ( row + 1 ) ] #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# item = self . table . items [ row ] #NEWLINE# #UNINDENT# self . set_footer ( item ) #NEWLINE# event . Skip ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == wx . WXK_UP ) : #NEWLINE# #INDENT# row = self . GetGridCursorRow ( ) #NEWLINE# if ( row >= 1 ) : #NEWLINE# #INDENT# item = self . table . items [ ( row - 1 ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# item = self . table . items [ row ] #NEWLINE# #UNINDENT# self . set_footer ( item ) #NEWLINE# event . Skip ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == wx . WXK_RIGHT ) : #NEWLINE# #INDENT# row = self . GetGridCursorRow ( ) #NEWLINE# item = self . table . items [ row ] #NEWLINE# self . set_footer ( item ) #NEWLINE# event . Skip ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == wx . WXK_LEFT ) : #NEWLINE# #INDENT# row = self . GetGridCursorRow ( ) #NEWLINE# item = self . table . items [ row ] #NEWLINE# self . set_footer ( item ) #NEWLINE# event . Skip ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( keycode == ord ( 'R' ) ) or ( keycode == wx . WXK_F5 ) ) : #NEWLINE# #INDENT# self . table . refresh_content ( event ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( keycode == ord ( 'I' ) ) : #NEWLINE# #INDENT# row = self . GetGridCursorRow ( ) #NEWLINE# if ( not sh ) : #NEWLINE# #INDENT# self . pickinput ( row ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# col = self . GetGridCursorCol ( ) #NEWLINE# self . pickinputattr ( row , col ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# event . Skip ( )