'Update catalog options from current preset'

def preset_change(self, item_name):

    if (not item_name):
        return
    current_preset = self.preset_field.currentText()
    options = self.presets[current_preset]
    exclusion_rules = []
    prefix_rules = []
    self.block_all_signals(True)
    for opt in self.OPTION_FIELDS:
        (c_name, c_def, c_type) = opt
        if (c_name == 'preset_field'):
            continue
        if (c_name in options):
            opt_value = options[c_name]
        else:
            continue
        if (c_type in ['check_box']):
            getattr(self, c_name).setChecked(eval(unicode(opt_value)))
            if (c_name == 'generate_genres'):
                self.genre_source_field.setEnabled(eval(unicode(opt_value)))
        elif (c_type in ['combo_box']):
            if (opt_value is None):
                index = 0
                if (c_name == 'genre_source_field'):
                    index = self.genre_source_field.findText(_('Tags'))
            else:
                index = getattr(self, c_name).findText(opt_value)
                if (index == (-1)):
                    if (c_name == 'read_source_field'):
                        index = self.read_source_field.findText(_('Tags'))
                    elif (c_name == 'genre_source_field'):
                        index = self.genre_source_field.findText(_('Tags'))
            getattr(self, c_name).setCurrentIndex(index)
        elif (c_type in ['line_edit']):
            getattr(self, c_name).setText((opt_value if opt_value else ''))
        elif ((c_type in ['radio_button']) and (opt_value is not None)):
            getattr(self, c_name).setChecked(opt_value)
        elif (c_type in ['spin_box']):
            getattr(self, c_name).setValue(float(opt_value))
        if (c_type == 'table_widget'):
            if (c_name == 'exclusion_rules_tw'):
                if (opt_value not in exclusion_rules):
                    exclusion_rules.append(opt_value)
            if (c_name == 'prefix_rules_tw'):
                if (opt_value not in prefix_rules):
                    prefix_rules.append(opt_value)
    self.exclusion_rules_table.clearLayout()
    self.exclusion_rules_table = ExclusionRules(self, self.exclusion_rules_gb, 'exclusion_rules_tw', exclusion_rules)
    self.prefix_rules_table.clearLayout()
    self.prefix_rules_table = PrefixRules(self, self.prefix_rules_gb, 'prefix_rules_tw', prefix_rules)
    self.exclude_genre_changed()
    format = options['format']
    title = options['catalog_title']
    self.set_format_and_title(format, title)
    self.generate_descriptions_changed(self.generate_descriptions.isChecked())
    self.block_all_signals(False)
