Mercurial > hg > Feedworm
annotate FeedEntryItemDelegate.py @ 78:a728bbc7171e
add some todo items
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 14 Aug 2010 02:54:01 +0200 |
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) |