Mercurial > hg > Feedworm
annotate FeedEntryItemDelegate.py @ 99:e59d722439b5
filter out read entries first before sorting
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Wed, 29 Dec 2010 04:27:58 +0100 |
parents | 0f9b3e57cff0 |
children | babe14449162 |
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) |