(self, new_key_set_name)
Create a new custom key set with the given name.

        Copy the bindings/keys from the previously active keyset
        to the new keyset and activate the new custom keyset.
Create a new custom key set with the given name.
Create a new custom key set with the given name .
def create_new_key_set(self, new_key_set_name):
        """Create a new custom key set with the given name.

        Copy the bindings/keys from the previously active keyset
        to the new keyset and activate the new custom keyset.
        """
        if self.keyset_source.get():
            prev_key_set_name = self.builtin_name.get()
        else:
            prev_key_set_name = self.custom_name.get()
        prev_keys = idleConf.GetCoreKeys(prev_key_set_name)
        new_keys = {}
        for event in prev_keys:  # Add key set to changed items.
            event_name = event[2:-2]  # Trim off the angle brackets.
            binding = ' '.join(prev_keys[event])
            new_keys[event_name] = binding
        # Handle any unsaved changes to prev key set.
        if prev_key_set_name in changes['keys']:
            key_set_changes = changes['keys'][prev_key_set_name]
            for event in key_set_changes:
                new_keys[event] = key_set_changes[event]
        # Save the new key set.
        self.save_new_key_set(new_key_set_name, new_keys)
        # Change GUI over to the new key set.
        custom_key_list = idleConf.GetSectionList('user', 'keys')
        custom_key_list.sort()
        self.customlist.SetMenu(custom_key_list, new_key_set_name)
        self.keyset_source.set(0)
        self.set_keys_type()
def create_new_key_set ( self , new_key_set_name ) : if self . keyset_source . get ( ) : prev_key_set_name = self . builtin_name . get ( ) else : prev_key_set_name = self . custom_name . get ( ) prev_keys = idleConf . GetCoreKeys ( prev_key_set_name ) new_keys = { } for event in prev_keys : # Add key set to changed items. event_name = event [ 2 : - 2 ] # Trim off the angle brackets. binding = ' ' . join ( prev_keys [ event ] ) new_keys [ event_name ] = binding # Handle any unsaved changes to prev key set. if prev_key_set_name in changes [ 'keys' ] : key_set_changes = changes [ 'keys' ] [ prev_key_set_name ] for event in key_set_changes : new_keys [ event ] = key_set_changes [ event ] # Save the new key set. self . save_new_key_set ( new_key_set_name , new_keys ) # Change GUI over to the new key set. custom_key_list = idleConf . GetSectionList ( 'user' , 'keys' ) custom_key_list . sort ( ) self . customlist . SetMenu ( custom_key_list , new_key_set_name ) self . keyset_source . set ( 0 ) self . set_keys_type ( )