Logo Search packages:      
Sourcecode: ipython version File versions  Download package

def IPython::gui::wx::ipython_view::WxConsoleView::_onKeypress (   self,
  event,
  skip = True 
) [private]

Key press callback used for correcting behavior for console-like
interfaces. For example 'home' should go to prompt, not to begining of
line.

@param widget: Widget that key press accored in.
@type widget: gtk.Widget
@param event: Event object
@type event: gtk.gdk.Event

@return: Return True if event as been catched.
@rtype: boolean

Definition at line 449 of file ipython_view.py.

00449                                            :
        '''
        Key press callback used for correcting behavior for console-like
        interfaces. For example 'home' should go to prompt, not to begining of
        line.

        @param widget: Widget that key press accored in.
        @type widget: gtk.Widget
        @param event: Event object
        @type event: gtk.gdk.Event

        @return: Return True if event as been catched.
        @rtype: boolean
        '''
        if not self.AutoCompActive():
            if event.GetKeyCode() == wx.WXK_HOME:
                if event.Modifiers == wx.MOD_NONE:
                    self.moveCursorOnNewValidKey()
                    self.moveCursor(self.getCurrentPromptStart())
                    return True
                elif event.Modifiers == wx.MOD_SHIFT:
                    self.moveCursorOnNewValidKey()
                    self.selectFromTo(self.getCurrentPromptStart(), self.getCursorPos())
                    return True
                else:
                    return False

            elif event.GetKeyCode() == wx.WXK_LEFT:
                if event.Modifiers == wx.MOD_NONE:
                    self.moveCursorOnNewValidKey()
                    
                    self.moveCursor(self.getCursorPos()-1)
                    if self.getCursorPos() < self.getCurrentPromptStart():
                        self.moveCursor(self.getCurrentPromptStart())
                    return True

            elif event.GetKeyCode() == wx.WXK_BACK:
                self.moveCursorOnNewValidKey()
                if self.getCursorPos() > self.getCurrentPromptStart():
                    event.Skip()
                return True
            
            if skip:
                if event.GetKeyCode() not in [wx.WXK_PAGEUP, wx.WXK_PAGEDOWN]\
                and event.Modifiers == wx.MOD_NONE:
                    self.moveCursorOnNewValidKey()
                    
                event.Skip()
                return True
            return False
        else:
            event.Skip()
            
    def OnUpdateUI(self, evt):


Generated by  Doxygen 1.6.0   Back to index