def key_pressed(self, event):
        """
        Maps pressed keys to functions
        """
        frame = self.GetParent().GetParent().GetParent()
        frame.SetStatusText("")
        sh = event.ShiftDown()
        ctrl = event.ControlDown()

        keycode = event.GetKeyCode()
        if keycode == ord("P"):
            row = self.GetGridCursorRow()
            if sh:
                col = self.GetGridCursorCol()
                self.pickattr(row, col)
            else:
                self.pick(row)
        elif keycode == ord("M"):
            if ctrl:
                col = self.GetGridCursorCol()
                self.pickrowsattr(sorted(self.current_selection), col)
            else:
                self.pickrows(sorted(self.current_selection))
        elif keycode in (wx.WXK_BACK, wx.WXK_DELETE, ord("X")) and not (ctrl or sh):
            self.delete_current_notebook()
        elif keycode in (ord("E"), ord("\r")):
            row = self.GetGridCursorRow()
            if sh:
                col = self.GetGridCursorCol()
                self.enterattr(row, col)
            else:
                self.enter(row)
        elif keycode == ord("E") and ctrl:
            row = self.GetGridCursorRow()
            self.SetGridCursor(row, self.GetNumberCols()-1)
        elif keycode == wx.WXK_HOME or (keycode == ord("A") and ctrl):
            row = self.GetGridCursorRow()
            self.SetGridCursor(row, 0)
        elif keycode == ord("C") and sh:
            col = self.GetGridCursorCol()
            attr = self.table._displayattrs[col]
            result = []
            for i in range(self.GetNumberRows()):
                result.append(self.table._displayattrs[col].value(self.table.items[i]))
            self.quit(result)
        elif keycode in (wx.WXK_ESCAPE, ord("Q")) and not (ctrl or sh):
            self.quit()
        elif keycode == ord("<"):
            row = self.GetGridCursorRow()
            col = self.GetGridCursorCol()
            if not event.ShiftDown():
                newcol = col - 1
                if newcol >= 0:
                    self.SetGridCursor(row, col - 1)
            else:
                newcol = col + 1
                if newcol < self.GetNumberCols():
                    self.SetGridCursor(row, col + 1)
        elif keycode == ord("D"):
            col = self.GetGridCursorCol()
            row = self.GetGridCursorRow()
            if not sh:
                self.detail(row, col)
            else:
                self.detail_attr(row, col)
        elif keycode == ord("F") and ctrl:
            if sh:
                frame.enter_searchexpression(event)
            else:
                frame.enter_searchtext(event)
        elif keycode == wx.WXK_F3:
            if sh:
                frame.find_previous(event)
            else:
                frame.find_next(event)
        elif keycode == ord("V"):
            if sh:
                self.sortattrdesc()
            else:
                self.sortattrasc()
        elif keycode == wx.WXK_DOWN:
            row = self.GetGridCursorRow()
            try:
                item = self.table.items[row+1]
            except __HOLE__:
                item = self.table.items[row]
            self.set_footer(item)
            event.Skip()
        elif keycode == wx.WXK_UP:
            row = self.GetGridCursorRow()
            if row >= 1:
                item = self.table.items[row-1]
            else:
                item = self.table.items[row]
            self.set_footer(item)
            event.Skip()
        elif keycode == wx.WXK_RIGHT:
            row = self.GetGridCursorRow()
            item = self.table.items[row]
            self.set_footer(item)
            event.Skip()
        elif keycode == wx.WXK_LEFT:
            row = self.GetGridCursorRow()
            item = self.table.items[row]
            self.set_footer(item)
            event.Skip()
        elif keycode == ord("R") or keycode == wx.WXK_F5:
            self.table.refresh_content(event)
        elif keycode == ord("I"):
            row = self.GetGridCursorRow()
            if not sh:
                self.pickinput(row)
            else:
                col = self.GetGridCursorCol()
                self.pickinputattr(row, col)
        else:
            event.Skip()
dataset/ETHPy150Open ipython/ipython-py3k/IPython/deathrow/igrid.py/IGridGrid.key_pressed