annotate FeedEntryItemDelegate.py @ 66:97c4e94f99cf

log when creating a new FeedEntry
author dirk@xanthippe.ping.de
date Thu, 29 Jul 2010 21:37:46 +0200
parents 0f9b3e57cff0
children babe14449162
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
1
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
2 from PyQt4 import QtGui
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
3 from PyQt4.QtGui import QFont
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
4
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
5 class FeedEntryItemDelegate(QtGui.QStyledItemDelegate):
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
6 def __init__(self):
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
7 QtGui.QStyledItemDelegate.__init__(self, None)
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
8
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
9 def paint(self, painter, style, index):
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
10 row = index.row()
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
11 entry = self.entries[row]
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
12 if entry.read:
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
13 style.font.setWeight(QFont.Normal)
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
14 else:
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
15 style.font.setWeight(QFont.Bold)
0f9b3e57cff0 pull out FeedEntryItemDelegate into its own file
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
16 QtGui.QStyledItemDelegate.paint(self, painter, style, index)