diff --git a/calibre-plugin/config.py b/calibre-plugin/config.py index a1fa58e2..d6984009 100644 --- a/calibre-plugin/config.py +++ b/calibre-plugin/config.py @@ -20,21 +20,6 @@ from PyQt5.Qt import (QWidget, QVBoxLayout, QHBoxLayout, QGridLayout, QLabel, QLineEdit, QComboBox, QCheckBox, QPushButton, QTabWidget, QScrollArea, QGroupBox, QButtonGroup, QRadioButton, Qt) -try: - from calibre.gui2 import QVariant - del QVariant -except ImportError: - is_qt4 = False - convert_qvariant = lambda x: x -else: - is_qt4 = True - def convert_qvariant(x): - vt = x.type() - if vt == x.String: - return unicode(x.toString()) - if vt == x.List: - return [convert_qvariant(i) for i in x.toList()] - return x.toPyObject() from calibre.gui2 import dynamic, info_dialog from calibre.gui2.complete2 import EditWithComplete @@ -350,7 +335,7 @@ class ConfigWidget(QWidget): prefs['gcnewonly'] = self.calibrecover_tab.gcnewonly.isChecked() gc_site_settings = {} for (site,combo) in six.iteritems(self.calibrecover_tab.gc_dropdowns): - val = unicode(convert_qvariant(combo.itemData(combo.currentIndex()))) + val = unicode(combo.itemData(combo.currentIndex())) if val != 'none': gc_site_settings[site] = val #print("gc_site_settings[%s]:%s"%(site,gc_site_settings[site])) @@ -393,19 +378,19 @@ class ConfigWidget(QWidget): # Custom Columns tab # error column - prefs['errorcol'] = unicode(convert_qvariant(self.cust_columns_tab.errorcol.itemData(self.cust_columns_tab.errorcol.currentIndex()))) + prefs['errorcol'] = unicode(self.cust_columns_tab.errorcol.itemData(self.cust_columns_tab.errorcol.currentIndex())) prefs['save_all_errors'] = self.cust_columns_tab.save_all_errors.isChecked() # metadata column - prefs['savemetacol'] = unicode(convert_qvariant(self.cust_columns_tab.savemetacol.itemData(self.cust_columns_tab.savemetacol.currentIndex()))) + prefs['savemetacol'] = unicode(self.cust_columns_tab.savemetacol.itemData(self.cust_columns_tab.savemetacol.currentIndex())) # lastchecked column - prefs['lastcheckedcol'] = unicode(convert_qvariant(self.cust_columns_tab.lastcheckedcol.itemData(self.cust_columns_tab.lastcheckedcol.currentIndex()))) + prefs['lastcheckedcol'] = unicode(self.cust_columns_tab.lastcheckedcol.itemData(self.cust_columns_tab.lastcheckedcol.currentIndex())) # cust cols tab colsmap = {} for (col,combo) in six.iteritems(self.cust_columns_tab.custcol_dropdowns): - val = unicode(convert_qvariant(combo.itemData(combo.currentIndex()))) + val = unicode(combo.itemData(combo.currentIndex())) if val != 'none': colsmap[col] = val #print("colsmap[%s]:%s"%(col,colsmap[col])) diff --git a/calibre-plugin/dialogs.py b/calibre-plugin/dialogs.py index fcd020ac..9c397809 100644 --- a/calibre-plugin/dialogs.py +++ b/calibre-plugin/dialogs.py @@ -24,22 +24,6 @@ from PyQt5.Qt import (QApplication, QDialog, QWidget, QTableWidget, QVBoxLayout, QScrollArea, QPixmap, Qt, QAbstractItemView, QTextEdit, pyqtSignal, QGroupBox, QFrame) -try: - from calibre.gui2 import QVariant - del QVariant -except ImportError: - is_qt4 = False - convert_qvariant = lambda x: x -else: - is_qt4 = True - def convert_qvariant(x): - vt = x.type() - if vt == x.String: - return unicode(x.toString()) - if vt == x.List: - return [convert_qvariant(i) for i in x.toList()] - return x.toPyObject() - from calibre.gui2 import gprefs show_download_options = 'fff:add new/update dialogs:show_download_options' from calibre.gui2.dialogs.confirm_delete import confirm @@ -1019,7 +1003,7 @@ class StoryListTableWidget(QTableWidget): books = [] #print("=========================\nbooks:%s"%self.books) for row in range(self.rowCount()): - rnum = convert_qvariant(self.item(row, 1).data(Qt.UserRole)) + rnum = self.item(row, 1).data(Qt.UserRole) book = self.books[rnum] books.append(book) return books @@ -1207,7 +1191,7 @@ class RejectListDialog(SizePersistedDialog): rejectrows = [] for row in range(self.rejects_table.rowCount()): url = unicode(self.rejects_table.item(row, 0).text()).strip() - book_id =convert_qvariant(self.rejects_table.item(row, 0).data(Qt.UserRole)) + book_id =self.rejects_table.item(row, 0).data(Qt.UserRole) title = unicode(self.rejects_table.item(row, 1).text()).strip() auth = unicode(self.rejects_table.item(row, 2).text()).strip() note = unicode(self.rejects_table.cellWidget(row, 3).currentText()).strip() @@ -1217,7 +1201,7 @@ class RejectListDialog(SizePersistedDialog): def get_reject_list_ids(self): rejectrows = [] for row in range(self.rejects_table.rowCount()): - book_id = convert_qvariant(self.rejects_table.item(row, 0).data(Qt.UserRole)) + book_id = self.rejects_table.item(row, 0).data(Qt.UserRole) if book_id: rejectrows.append(book_id) return rejectrows