annotate FeedEntryItemDelegate.py @ 131:3719440c8c6b backend

closing the backend branch now that it's merged into default
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 22 Aug 2011 15:35:32 +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)