(self, widget, event)
return False
Handler for keyboard events
Handler for keyboard events
Handler for keyboard events
def on_keypress(self, widget, event):
        """Handler for keyboard events"""
        if not event:
            dbg('Terminal::on_keypress: Called on %s with no event' % widget)
            return False

        # FIXME: Does keybindings really want to live in Terminator()?
        mapping = self.terminator.keybindings.lookup(event)

        if mapping == "hide_window":
            return False

        if mapping and mapping not in ['close_window',
                                       'full_screen']:
            dbg('Terminal::on_keypress: lookup found: %r' % mapping)
            # handle the case where user has re-bound copy to ctrl+<key>
            # we only copy if there is a selection otherwise let it fall through
            # to ^<key>
            if (mapping == "copy" and event.get_state() & Gdk.ModifierType.CONTROL_MASK):
                if self.vte.get_has_selection():
                    getattr(self, "key_" + mapping)()
                    return True
                elif not self.config['smart_copy']:
                    return True
            else:
                getattr(self, "key_" + mapping)()
                return True

        # FIXME: This is all clearly wrong. We should be doing this better
        #         maybe we can emit the key event and let Terminator() care?
        groupsend = self.terminator.groupsend
        groupsend_type = self.terminator.groupsend_type
        window_focussed = self.vte.get_toplevel().get_property('has-toplevel-focus')
        if groupsend != groupsend_type['off'] and window_focussed and self.vte.is_focus():
            if self.group and groupsend == groupsend_type['group']:
                self.terminator.group_emit(self, self.group, 'key-press-event',
                                           event)
            if groupsend == groupsend_type['all']:
                self.terminator.all_emit(self, 'key-press-event', event)

        return False
def on_keypress ( self , widget , event ) : if not event : dbg ( 'Terminal::on_keypress: Called on %s with no event' % widget ) return False # FIXME: Does keybindings really want to live in Terminator()? mapping = self . terminator . keybindings . lookup ( event ) if mapping == "hide_window" : return False if mapping and mapping not in [ 'close_window' , 'full_screen' ] : dbg ( 'Terminal::on_keypress: lookup found: %r' % mapping ) # handle the case where user has re-bound copy to ctrl+<key> # we only copy if there is a selection otherwise let it fall through # to ^<key> if ( mapping == "copy" and event . get_state ( ) & Gdk . ModifierType . CONTROL_MASK ) : if self . vte . get_has_selection ( ) : getattr ( self , "key_" + mapping ) ( ) return True elif not self . config [ 'smart_copy' ] : return True else : getattr ( self , "key_" + mapping ) ( ) return True # FIXME: This is all clearly wrong. We should be doing this better #         maybe we can emit the key event and let Terminator() care? groupsend = self . terminator . groupsend groupsend_type = self . terminator . groupsend_type window_focussed = self . vte . get_toplevel ( ) . get_property ( 'has-toplevel-focus' ) if groupsend != groupsend_type [ 'off' ] and window_focussed and self . vte . is_focus ( ) : if self . group and groupsend == groupsend_type [ 'group' ] : self . terminator . group_emit ( self , self . group , 'key-press-event' , event ) if groupsend == groupsend_type [ 'all' ] : self . terminator . all_emit ( self , 'key-press-event' , event ) return False