(self)
Handle event to delete a custom key set.

        Applying the delete deactivates the current configuration and
        reverts to the default.  The custom key set is permanently
        deleted from the config file.
Handle event to delete a custom key set.
Handle event to delete a custom key set .
def delete_custom_keys(self):
        """Handle event to delete a custom key set.

        Applying the delete deactivates the current configuration and
        reverts to the default.  The custom key set is permanently
        deleted from the config file.
        """
        keyset_name = self.custom_name.get()
        delmsg = 'Are you sure you wish to delete the key set %r ?'
        if not self.askyesno(
                'Delete Key Set',  delmsg % keyset_name, parent=self):
            return
        self.cd.deactivate_current_config()
        # Remove key set from changes, config, and file.
        changes.delete_section('keys', keyset_name)
        # Reload user key set list.
        item_list = idleConf.GetSectionList('user', 'keys')
        item_list.sort()
        if not item_list:
            self.custom_keyset_on.state(('disabled',))
            self.customlist.SetMenu(item_list, '- no custom keys -')
        else:
            self.customlist.SetMenu(item_list, item_list[0])
        # Revert to default key set.
        self.keyset_source.set(idleConf.defaultCfg['main']
                               .Get('Keys', 'default'))
        self.builtin_name.set(idleConf.defaultCfg['main'].Get('Keys', 'name')
                              or idleConf.default_keys())
        # User can't back out of these changes, they must be applied now.
        changes.save_all()
        self.extpage.save_all_changed_extensions()
        self.cd.activate_config_changes()
        self.set_keys_type()
def delete_custom_keys ( self ) : keyset_name = self . custom_name . get ( ) delmsg = 'Are you sure you wish to delete the key set %r ?' if not self . askyesno ( 'Delete Key Set' , delmsg % keyset_name , parent = self ) : return self . cd . deactivate_current_config ( ) # Remove key set from changes, config, and file. changes . delete_section ( 'keys' , keyset_name ) # Reload user key set list. item_list = idleConf . GetSectionList ( 'user' , 'keys' ) item_list . sort ( ) if not item_list : self . custom_keyset_on . state ( ( 'disabled' , ) ) self . customlist . SetMenu ( item_list , '- no custom keys -' ) else : self . customlist . SetMenu ( item_list , item_list [ 0 ] ) # Revert to default key set. self . keyset_source . set ( idleConf . defaultCfg [ 'main' ] . Get ( 'Keys' , 'default' ) ) self . builtin_name . set ( idleConf . defaultCfg [ 'main' ] . Get ( 'Keys' , 'name' ) or idleConf . default_keys ( ) ) # User can't back out of these changes, they must be applied now. changes . save_all ( ) self . extpage . save_all_changed_extensions ( ) self . cd . activate_config_changes ( ) self . set_keys_type ( )