(self)
Handle event to delete custom theme.

        The current theme is deactivated and the default theme is
        activated.  The custom theme is permanently removed from
        the config file.

        Attributes accessed:
            custom_name

        Attributes updated:
            custom_theme_on
            customlist
            theme_source
            builtin_name

        Methods:
            deactivate_current_config
            save_all_changed_extensions
            activate_config_changes
            set_theme_type
Handle event to delete custom theme.
Handle event to delete custom theme .
def delete_custom(self):
        """Handle event to delete custom theme.

        The current theme is deactivated and the default theme is
        activated.  The custom theme is permanently removed from
        the config file.

        Attributes accessed:
            custom_name

        Attributes updated:
            custom_theme_on
            customlist
            theme_source
            builtin_name

        Methods:
            deactivate_current_config
            save_all_changed_extensions
            activate_config_changes
            set_theme_type
        """
        theme_name = self.custom_name.get()
        delmsg = 'Are you sure you wish to delete the theme %r ?'
        if not self.askyesno(
                'Delete Theme',  delmsg % theme_name, parent=self):
            return
        self.cd.deactivate_current_config()
        # Remove theme from changes, config, and file.
        changes.delete_section('highlight', theme_name)
        # Reload user theme list.
        item_list = idleConf.GetSectionList('user', 'highlight')
        item_list.sort()
        if not item_list:
            self.custom_theme_on.state(('disabled',))
            self.customlist.SetMenu(item_list, '- no custom themes -')
        else:
            self.customlist.SetMenu(item_list, item_list[0])
        # Revert to default theme.
        self.theme_source.set(idleConf.defaultCfg['main'].Get('Theme', 'default'))
        self.builtin_name.set(idleConf.defaultCfg['main'].Get('Theme', 'name'))
        # 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_theme_type()
def delete_custom ( self ) : theme_name = self . custom_name . get ( ) delmsg = 'Are you sure you wish to delete the theme %r ?' if not self . askyesno ( 'Delete Theme' , delmsg % theme_name , parent = self ) : return self . cd . deactivate_current_config ( ) # Remove theme from changes, config, and file. changes . delete_section ( 'highlight' , theme_name ) # Reload user theme list. item_list = idleConf . GetSectionList ( 'user' , 'highlight' ) item_list . sort ( ) if not item_list : self . custom_theme_on . state ( ( 'disabled' , ) ) self . customlist . SetMenu ( item_list , '- no custom themes -' ) else : self . customlist . SetMenu ( item_list , item_list [ 0 ] ) # Revert to default theme. self . theme_source . set ( idleConf . defaultCfg [ 'main' ] . Get ( 'Theme' , 'default' ) ) self . builtin_name . set ( idleConf . defaultCfg [ 'main' ] . Get ( 'Theme' , 'name' ) ) # 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_theme_type ( )