This commit is contained in:
Kovid Goyal 2010-06-15 09:29:29 -06:00
parent 82bb29424f
commit 7445bae81f

View File

@ -26,18 +26,13 @@ from calibre.gui2.dialogs.edit_authors_dialog import EditAuthorsDialog
class TagDelegate(QItemDelegate): class TagDelegate(QItemDelegate):
def __init__(self, parent):
QItemDelegate.__init__(self, parent)
self._parent = parent
self.icon = QIcon(I('star.png'))
def paint(self, painter, option, index): def paint(self, painter, option, index):
item = index.internalPointer() item = index.internalPointer()
if item.type != TagTreeItem.TAG: if item.type != TagTreeItem.TAG:
QItemDelegate.paint(self, painter, option, index) QItemDelegate.paint(self, painter, option, index)
return return
r = option.rect r = option.rect
model = self._parent.model() model = self.parent().model()
icon = model.data(index, Qt.DecorationRole).toPyObject() icon = model.data(index, Qt.DecorationRole).toPyObject()
painter.save() painter.save()
if item.tag.state != 0 or not config['show_avg_rating'] or \ if item.tag.state != 0 or not config['show_avg_rating'] or \