This commit is contained in:
Kovid Goyal 2014-09-02 13:48:00 +05:30
parent a74e6eda06
commit 116ad0ac06

View File

@ -51,19 +51,19 @@ class PluginWidget(QWidget,Ui_Form):
for item in self.__dict__: for item in self.__dict__:
if type(self.__dict__[item]) is QCheckBox: if type(self.__dict__[item]) is QCheckBox:
CheckBoxControls.append(str(self.__dict__[item].objectName())) CheckBoxControls.append(self.__dict__[item].objectName())
elif type(self.__dict__[item]) is QComboBox: elif type(self.__dict__[item]) is QComboBox:
ComboBoxControls.append(str(self.__dict__[item].objectName())) ComboBoxControls.append(self.__dict__[item].objectName())
elif type(self.__dict__[item]) is QDoubleSpinBox: elif type(self.__dict__[item]) is QDoubleSpinBox:
DoubleSpinBoxControls.append(str(self.__dict__[item].objectName())) DoubleSpinBoxControls.append(self.__dict__[item].objectName())
elif type(self.__dict__[item]) is QLineEdit: elif type(self.__dict__[item]) is QLineEdit:
LineEditControls.append(str(self.__dict__[item].objectName())) LineEditControls.append(self.__dict__[item].objectName())
elif type(self.__dict__[item]) is QRadioButton: elif type(self.__dict__[item]) is QRadioButton:
RadioButtonControls.append(str(self.__dict__[item].objectName())) RadioButtonControls.append(self.__dict__[item].objectName())
elif type(self.__dict__[item]) is QTableWidget: elif type(self.__dict__[item]) is QTableWidget:
TableWidgetControls.append(str(self.__dict__[item].objectName())) TableWidgetControls.append(self.__dict__[item].objectName())
elif type(self.__dict__[item]) is QTextEdit: elif type(self.__dict__[item]) is QTextEdit:
TextEditControls.append(str(self.__dict__[item].objectName())) TextEditControls.append(self.__dict__[item].objectName())
option_fields = zip(CheckBoxControls, option_fields = zip(CheckBoxControls,
[True for i in CheckBoxControls], [True for i in CheckBoxControls],
@ -79,7 +79,7 @@ class PluginWidget(QWidget,Ui_Form):
option_fields += zip(['exclude_genre'],['\[.+\]|^\+$'],['line_edit']) option_fields += zip(['exclude_genre'],['\[.+\]|^\+$'],['line_edit'])
# TextEditControls # TextEditControls
#option_fields += zip(['exclude_genre_results'],['excluded genres will appear here'],['text_edit']) # option_fields += zip(['exclude_genre_results'],['excluded genres will appear here'],['text_edit'])
# SpinBoxControls # SpinBoxControls
option_fields += zip(['thumb_width'],[1.00],['spin_box']) option_fields += zip(['thumb_width'],[1.00],['spin_box'])
@ -208,7 +208,7 @@ class PluginWidget(QWidget,Ui_Form):
all_genre_tags = list(self.db.all_custom(self.db.field_metadata.key_to_label(self.genre_source_field_name))) all_genre_tags = list(self.db.all_custom(self.db.field_metadata.key_to_label(self.genre_source_field_name)))
try: try:
pattern = re.compile((str(regex))) pattern = re.compile(regex)
except: except:
results = _("regex error: %s") % sys.exc_info()[1] results = _("regex error: %s") % sys.exc_info()[1]
else: else:
@ -267,7 +267,7 @@ class PluginWidget(QWidget,Ui_Form):
Process changes in the genre_source_field combo box Process changes in the genre_source_field combo box
Update Excluded genres preview Update Excluded genres preview
''' '''
new_source = str(self.genre_source_field.currentText()) new_source = self.genre_source_field.currentText()
self.genre_source_field_name = new_source self.genre_source_field_name = new_source
if new_source != _('Tags'): if new_source != _('Tags'):
genre_source_spec = self.genre_source_fields[unicode(new_source)] genre_source_spec = self.genre_source_fields[unicode(new_source)]
@ -284,7 +284,7 @@ class PluginWidget(QWidget,Ui_Form):
elif peer.children(): elif peer.children():
for child in peer.children(): for child in peer.children():
if child.objectName() == 'format': if child.objectName() == 'format':
current_format = str(child.currentText()).strip() current_format = child.currentText().strip()
elif child.objectName() == 'title': elif child.objectName() == 'title':
current_title = unicode(child.text()).strip() current_title = unicode(child.text()).strip()
self.parentWidget().blockSignals(False) self.parentWidget().blockSignals(False)
@ -294,7 +294,7 @@ class PluginWidget(QWidget,Ui_Form):
''' '''
Process changes in the header_note_source_field combo box Process changes in the header_note_source_field combo box
''' '''
new_source = str(self.header_note_source_field.currentText()) new_source = self.header_note_source_field.currentText()
self.header_note_source_field_name = new_source self.header_note_source_field_name = new_source
if new_source > '': if new_source > '':
header_note_source_spec = self.header_note_source_fields[unicode(new_source)] header_note_source_spec = self.header_note_source_fields[unicode(new_source)]
@ -338,7 +338,7 @@ class PluginWidget(QWidget,Ui_Form):
c_name, c_def, c_type = opt c_name, c_def, c_type = opt
opt_value = gprefs.get(self.name + '_' + c_name, c_def) opt_value = gprefs.get(self.name + '_' + c_name, c_def)
if c_type in ['check_box']: if c_type in ['check_box']:
getattr(self, c_name).setChecked(eval(str(opt_value))) getattr(self, c_name).setChecked(eval(unicode(opt_value)))
getattr(self, c_name).clicked.connect(partial(self.settings_changed, c_name)) getattr(self, c_name).clicked.connect(partial(self.settings_changed, c_name))
elif c_type in ['combo_box']: elif c_type in ['combo_box']:
if opt_value is None: if opt_value is None:
@ -430,7 +430,7 @@ class PluginWidget(QWidget,Ui_Form):
''' '''
Process changes in the merge_source_field combo box Process changes in the merge_source_field combo box
''' '''
new_source = str(self.merge_source_field.currentText()) new_source = self.merge_source_field.currentText()
self.merge_source_field_name = new_source self.merge_source_field_name = new_source
if new_source > '': if new_source > '':
merge_source_spec = self.merge_source_fields[unicode(new_source)] merge_source_spec = self.merge_source_fields[unicode(new_source)]
@ -602,7 +602,7 @@ class PluginWidget(QWidget,Ui_Form):
if not item_name: if not item_name:
return return
current_preset = str(self.preset_field.currentText()) current_preset = self.preset_field.currentText()
options = self.presets[current_preset] options = self.presets[current_preset]
exclusion_rules = [] exclusion_rules = []
@ -619,9 +619,9 @@ class PluginWidget(QWidget,Ui_Form):
else: else:
continue continue
if c_type in ['check_box']: if c_type in ['check_box']:
getattr(self, c_name).setChecked(eval(str(opt_value))) getattr(self, c_name).setChecked(eval(unicode(opt_value)))
if c_name == 'generate_genres': if c_name == 'generate_genres':
self.genre_source_field.setEnabled(eval(str(opt_value))) self.genre_source_field.setEnabled(eval(unicode(opt_value)))
elif c_type in ['combo_box']: elif c_type in ['combo_box']:
if opt_value is None: if opt_value is None:
index = 0 index = 0
@ -1127,7 +1127,7 @@ class GenericRulesTable(QTableWidget):
def source_index_changed(self, combo, row, pattern=''): def source_index_changed(self, combo, row, pattern=''):
# Populate the Pattern field based upon the Source field # Populate the Pattern field based upon the Source field
source_field = str(combo.currentText()) source_field = combo.currentText()
if source_field == '': if source_field == '':
values = [] values = []
@ -1490,4 +1490,3 @@ class PrefixRules(GenericRulesTable):
self.source_index_changed(source_combo, row, pattern=data['pattern']) self.source_index_changed(source_combo, row, pattern=data['pattern'])
self.blockSignals(False) self.blockSignals(False)