(self)
Handle event to change key binding for selected line.

        A selection of a key/binding in the list of current
        bindings pops up a dialog to enter a new binding.  If
        the current key set is builtin and a binding has
        changed, then a name for a custom key set needs to be
        entered for the change to be applied.
Handle event to change key binding for selected line.
Handle event to change key binding for selected line .
def get_new_keys(self):
        """Handle event to change key binding for selected line.

        A selection of a key/binding in the list of current
        bindings pops up a dialog to enter a new binding.  If
        the current key set is builtin and a binding has
        changed, then a name for a custom key set needs to be
        entered for the change to be applied.
        """
        list_index = self.bindingslist.index(ANCHOR)
        binding = self.bindingslist.get(list_index)
        bind_name = binding.split()[0]
        if self.keyset_source.get():
            current_key_set_name = self.builtin_name.get()
        else:
            current_key_set_name = self.custom_name.get()
        current_bindings = idleConf.GetCurrentKeySet()
        if current_key_set_name in changes['keys']:  # unsaved changes
            key_set_changes = changes['keys'][current_key_set_name]
            for event in key_set_changes:
                current_bindings[event] = key_set_changes[event].split()
        current_key_sequences = list(current_bindings.values())
        new_keys = GetKeysDialog(self, 'Get New Keys', bind_name,
                current_key_sequences).result
        if new_keys:
            if self.keyset_source.get():  # Current key set is a built-in.
                message = ('Your changes will be saved as a new Custom Key Set.'
                           ' Enter a name for your new Custom Key Set below.')
                new_keyset = self.get_new_keys_name(message)
                if not new_keyset:  # User cancelled custom key set creation.
                    self.bindingslist.select_set(list_index)
                    self.bindingslist.select_anchor(list_index)
                    return
                else:  # Create new custom key set based on previously active key set.
                    self.create_new_key_set(new_keyset)
            self.bindingslist.delete(list_index)
            self.bindingslist.insert(list_index, bind_name+' - '+new_keys)
            self.bindingslist.select_set(list_index)
            self.bindingslist.select_anchor(list_index)
            self.keybinding.set(new_keys)
        else:
            self.bindingslist.select_set(list_index)
            self.bindingslist.select_anchor(list_index)
def get_new_keys ( self ) : list_index = self . bindingslist . index ( ANCHOR ) binding = self . bindingslist . get ( list_index ) bind_name = binding . split ( ) [ 0 ] if self . keyset_source . get ( ) : current_key_set_name = self . builtin_name . get ( ) else : current_key_set_name = self . custom_name . get ( ) current_bindings = idleConf . GetCurrentKeySet ( ) if current_key_set_name in changes [ 'keys' ] : # unsaved changes key_set_changes = changes [ 'keys' ] [ current_key_set_name ] for event in key_set_changes : current_bindings [ event ] = key_set_changes [ event ] . split ( ) current_key_sequences = list ( current_bindings . values ( ) ) new_keys = GetKeysDialog ( self , 'Get New Keys' , bind_name , current_key_sequences ) . result if new_keys : if self . keyset_source . get ( ) : # Current key set is a built-in. message = ( 'Your changes will be saved as a new Custom Key Set.' ' Enter a name for your new Custom Key Set below.' ) new_keyset = self . get_new_keys_name ( message ) if not new_keyset : # User cancelled custom key set creation. self . bindingslist . select_set ( list_index ) self . bindingslist . select_anchor ( list_index ) return else : # Create new custom key set based on previously active key set. self . create_new_key_set ( new_keyset ) self . bindingslist . delete ( list_index ) self . bindingslist . insert ( list_index , bind_name + ' - ' + new_keys ) self . bindingslist . select_set ( list_index ) self . bindingslist . select_anchor ( list_index ) self . keybinding . set ( new_keys ) else : self . bindingslist . select_set ( list_index ) self . bindingslist . select_anchor ( list_index )