mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
...
This commit is contained in:
parent
ec583f232d
commit
9bd44ed078
@ -181,6 +181,10 @@ class Source(Plugin):
|
||||
#: construct the configuration widget for this plugin
|
||||
options = ()
|
||||
|
||||
#: A string that is displayed at the top of the config widget for this
|
||||
#: plugin
|
||||
config_help_message = None
|
||||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
Plugin.__init__(self, *args, **kwargs)
|
||||
|
@ -39,6 +39,12 @@ class ISBNDB(Source):
|
||||
'at isbndb.com and get an access key.')),
|
||||
)
|
||||
|
||||
config_help_message = '<p>'+_('To use metadata from isbndb.com you must sign'
|
||||
' up for a free account and get an isbndb key and enter it below.'
|
||||
' Instructions to get the key are '
|
||||
'<a href="http://isbndb.com/docs/api/30-keys.html">here</a>.')
|
||||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
Source.__init__(self, *args, **kwargs)
|
||||
|
||||
|
@ -56,7 +56,12 @@ class ConfigWidget(QWidget):
|
||||
self.setLayout(l)
|
||||
|
||||
self.gb = QGroupBox(_('Downloaded metadata fields'), self)
|
||||
l.addWidget(self.gb, 0, 0, 1, 2)
|
||||
if plugin.config_help_message:
|
||||
self.pchm = QLabel(plugin.config_help_message)
|
||||
self.pchm.setWordWrap(True)
|
||||
self.pchm.setOpenExternalLinks(True)
|
||||
l.addWidget(self.pchm, 0, 0, 1, 2)
|
||||
l.addWidget(self.gb, l.rowCount(), 0, 1, 2)
|
||||
self.gb.l = QGridLayout()
|
||||
self.gb.setLayout(self.gb.l)
|
||||
self.fields_view = v = QListView(self)
|
||||
@ -81,7 +86,7 @@ class ConfigWidget(QWidget):
|
||||
widget.setValue(val)
|
||||
elif opt.type == 'string':
|
||||
widget = QLineEdit(self)
|
||||
widget.setText(val)
|
||||
widget.setText(val if val else '')
|
||||
elif opt.type == 'bool':
|
||||
widget = QCheckBox(opt.label, self)
|
||||
widget.setChecked(bool(val))
|
||||
|
@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en'
|
||||
from operator import attrgetter
|
||||
|
||||
from PyQt4.Qt import (QAbstractTableModel, Qt, QAbstractListModel, QWidget,
|
||||
pyqtSignal, QVBoxLayout, QDialogButtonBox, QFrame, QLabel)
|
||||
pyqtSignal, QVBoxLayout, QDialogButtonBox, QFrame, QLabel, QIcon)
|
||||
|
||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
||||
from calibre.gui2.preferences.metadata_sources_ui import Ui_Form
|
||||
@ -67,6 +67,13 @@ class SourcesModel(QAbstractTableModel): # {{{
|
||||
return self.enabled_overrides.get(plugin, orig)
|
||||
elif role == Qt.UserRole:
|
||||
return plugin
|
||||
elif (role == Qt.DecorationRole and col == 0 and not
|
||||
plugin.is_configured()):
|
||||
return QIcon(I('list_remove.png'))
|
||||
elif role == Qt.ToolTipRole:
|
||||
if plugin.is_configured():
|
||||
return _('This source is configured and ready to go')
|
||||
return _('This source needs configuration')
|
||||
return NONE
|
||||
|
||||
def setData(self, index, val, role):
|
||||
|
@ -48,6 +48,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Sources with a red X next to their names must be configured before they will be used. </string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="configure_plugin_button">
|
||||
<property name="text">
|
||||
|
Loading…
x
Reference in New Issue
Block a user