BibTeX catalog: Add support for custom columns

This commit is contained in:
Kovid Goyal 2011-01-12 13:03:08 -07:00
parent 24e60cc357
commit 0c685dcfe0

View File

@ -27,14 +27,17 @@ class PluginWidget(QWidget, Ui_Form):
def __init__(self, parent=None): def __init__(self, parent=None):
QWidget.__init__(self, parent) QWidget.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
from calibre.library.catalog import FIELDS
self.all_fields = []
for x in FIELDS :
if x != 'all':
self.all_fields.append(x)
QListWidgetItem(x, self.db_fields)
def initialize(self, name, db): #not working properly to update def initialize(self, name, db): #not working properly to update
from calibre.library.catalog import FIELDS
self.all_fields = [x for x in FIELDS if x != 'all']
#add custom columns
self.all_fields.extend([x for x in sorted(db.custom_field_keys())])
#populate
for x in self.all_fields:
QListWidgetItem(x, self.db_fields)
self.name = name self.name = name
fields = gprefs.get(name+'_db_fields', self.all_fields) fields = gprefs.get(name+'_db_fields', self.all_fields)
# Restore the activated db_fields from last use # Restore the activated db_fields from last use