'CheckBoxControls (c_type: check_box):
[\'cross_reference_authors\',
\'generate_titles\',\'generate_series\',\'generate_genres\',
\'generate_recently_added\',\'generate_descriptions\',
\'include_hr\']
ComboBoxControls (c_type: combo_box):
[\'exclude_source_field\',\'genre_source_field\',
\'header_note_source_field\',\'merge_source_field\']
LineEditControls (c_type: line_edit):
[\'exclude_genre\']
RadioButtonControls (c_type: radio_button):
[\'merge_before\',\'merge_after\',\'generate_new_cover\', \'use_existing_cover\']
SpinBoxControls (c_type: spin_box):
[\'thumb_width\']
TableWidgetControls (c_type: table_widget):
[\'exclusion_rules_tw\',\'prefix_rules_tw\']
TextEditControls (c_type: text_edit):
[\'exclude_genre_results\']'

def initialize(self, name, db):

    self.name = name
    self.db = db
    self.all_genre_tags = []
    self.fetch_eligible_custom_fields()
    self.populate_combo_boxes()
    self.blocking_all_signals = True
    exclusion_rules = []
    prefix_rules = []
    for opt in self.OPTION_FIELDS:
        (c_name, c_def, c_type) = opt
        opt_value = gprefs.get(((self.name + '_') + c_name), c_def)
        if (c_type in ['check_box']):
            getattr(self, c_name).setChecked(eval(unicode(opt_value)))
            getattr(self, c_name).clicked.connect(partial(self.settings_changed, c_name))
        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)
            if (c_name != 'preset_field'):
                getattr(self, c_name).currentIndexChanged.connect(partial(self.settings_changed, c_name))
        elif (c_type in ['line_edit']):
            getattr(self, c_name).setText((opt_value if opt_value else ''))
            getattr(self, c_name).editingFinished.connect(partial(self.settings_changed, c_name))
        elif ((c_type in ['radio_button']) and (opt_value is not None)):
            getattr(self, c_name).setChecked(opt_value)
            getattr(self, c_name).clicked.connect(partial(self.settings_changed, c_name))
        elif (c_type in ['spin_box']):
            getattr(self, c_name).setValue(float(opt_value))
            getattr(self, c_name).valueChanged.connect(partial(self.settings_changed, c_name))
        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.reset_exclude_genres_tb.setIcon(QIcon(I('trash.png')))
    self.reset_exclude_genres_tb.clicked.connect(self.exclude_genre_reset)
    self.exclude_genre.textChanged.connect(self.exclude_genre_changed)
    self.generate_descriptions.clicked.connect(self.generate_descriptions_changed)
    self.generate_descriptions_changed(self.generate_descriptions.isChecked())
    self.merge_source_field_name = ''
    cs = unicode(self.merge_source_field.currentText())
    if (cs > ''):
        merge_source_spec = self.merge_source_fields[cs]
        self.merge_source_field_name = merge_source_spec['field']
    self.header_note_source_field_name = ''
    cs = unicode(self.header_note_source_field.currentText())
    if (cs > ''):
        header_note_source_spec = self.header_note_source_fields[cs]
        self.header_note_source_field_name = header_note_source_spec['field']
    self.genre_source_field_name = _('Tags')
    cs = unicode(self.genre_source_field.currentText())
    if (cs != _('Tags')):
        genre_source_spec = self.genre_source_fields[cs]
        self.genre_source_field_name = genre_source_spec['field']
    self.generate_genres.clicked.connect(self.generate_genres_changed)
    self.generate_genres_changed(self.generate_genres.isChecked())
    self.exclusion_rules_table = ExclusionRules(self, self.exclusion_rules_gb, 'exclusion_rules_tw', exclusion_rules)
    self.prefix_rules_table = PrefixRules(self, self.prefix_rules_gb, 'prefix_rules_tw', prefix_rules)
    self.exclude_genre_changed()
    self.preset_delete_pb.clicked.connect(self.preset_remove)
    self.preset_save_pb.clicked.connect(self.preset_save)
    self.preset_field.currentIndexChanged[str].connect(self.preset_change)
    self.blocking_all_signals = False
