mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Fix bug preventing the re-enabling of disabled plugins
This commit is contained in:
parent
94e3c666d8
commit
f2fae35eb2
@ -6,7 +6,7 @@ from binascii import hexlify, unhexlify
|
||||
from PyQt4.Qt import QDialog, QMessageBox, QListWidgetItem, QIcon, \
|
||||
QDesktopServices, QVBoxLayout, QLabel, QPlainTextEdit, \
|
||||
QStringListModel, QAbstractItemModel, QFont, \
|
||||
SIGNAL, QTimer, Qt, QSize, QVariant, QUrl, \
|
||||
SIGNAL, QTimer, Qt, QSize, QVariant, QUrl, QBrush, \
|
||||
QModelIndex, QInputDialog, QAbstractTableModel
|
||||
|
||||
from calibre.constants import islinux, iswindows
|
||||
@ -30,6 +30,9 @@ class PluginModel(QAbstractItemModel):
|
||||
def __init__(self, *args):
|
||||
QAbstractItemModel.__init__(self, *args)
|
||||
self.icon = QVariant(QIcon(':/images/plugins.svg'))
|
||||
p = QIcon(self.icon).pixmap(32, 32, QIcon.Disabled, QIcon.On)
|
||||
self.disabled_icon = QVariant(QIcon(p))
|
||||
self._p = p
|
||||
self.populate()
|
||||
|
||||
def populate(self):
|
||||
@ -89,9 +92,7 @@ class PluginModel(QAbstractItemModel):
|
||||
return 0
|
||||
if index.internalId() == -1:
|
||||
return Qt.ItemIsEnabled
|
||||
flags = Qt.ItemIsSelectable
|
||||
if not is_disabled(self.data(index, Qt.UserRole)):
|
||||
flags |= Qt.ItemIsEnabled
|
||||
flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
|
||||
return flags
|
||||
|
||||
def data(self, index, role):
|
||||
@ -112,7 +113,9 @@ class PluginModel(QAbstractItemModel):
|
||||
ans += '\nCustomization: '+c
|
||||
return QVariant(ans)
|
||||
if role == Qt.DecorationRole:
|
||||
return self.icon
|
||||
return self.disabled_icon if is_disabled(plugin) else self.icon
|
||||
if role == Qt.ForegroundRole and is_disabled(plugin):
|
||||
return QVariant(QBrush(Qt.gray))
|
||||
if role == Qt.UserRole:
|
||||
return plugin
|
||||
return NONE
|
||||
|
Loading…
x
Reference in New Issue
Block a user