comparison MainWindow.py @ 55:0f9b3e57cff0

pull out FeedEntryItemDelegate into its own file
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 18 May 2010 03:17:06 +0200
parents 8cca4585eb33
children c82f5538733c
comparison
equal deleted inserted replaced
54:b535bce50626 55:0f9b3e57cff0
1 1
2 from AddFeed import AddFeed 2 from AddFeed import AddFeed
3 from DisplayModel import DisplayModel 3 from DisplayModel import DisplayModel
4 from Feed import Feed 4 from Feed import Feed
5 from FeedEntry import FeedEntry 5 from FeedEntry import FeedEntry
6 from FeedEntryItemDelegate import FeedEntryItemDelegate
6 from FeedSettings import FeedSettings 7 from FeedSettings import FeedSettings
7 from PreferencesDialog import PreferencesDialog 8 from PreferencesDialog import PreferencesDialog
8 from PyQt4 import QtGui 9 from PyQt4 import QtGui
9 from PyQt4.QtCore import QUrl 10 from PyQt4.QtCore import QUrl
10 from PyQt4.QtGui import QFont
11 from Ui_MainWindow import Ui_MainWindow 11 from Ui_MainWindow import Ui_MainWindow
12 import subprocess 12 import subprocess
13 13
14 STATUS_MESSAGE_DISPLAY_MILLIS = 20000 14 STATUS_MESSAGE_DISPLAY_MILLIS = 20000
15 15
93 def showFeedSettings(self): 93 def showFeedSettings(self):
94 feedSettings = FeedSettings(self.session, self.selectedFeed) 94 feedSettings = FeedSettings(self.session, self.selectedFeed)
95 feedSettings.exec_() 95 feedSettings.exec_()
96 96
97 97
98 class FeedEntryItemDelegate(QtGui.QStyledItemDelegate):
99 def __init__(self):
100 QtGui.QStyledItemDelegate.__init__(self, None)
101
102 def paint(self, painter, style, index):
103 row = index.row()
104 entry = self.entries[row]
105 if entry.read:
106 style.font.setWeight(QFont.Normal)
107 else:
108 style.font.setWeight(QFont.Bold)
109 QtGui.QStyledItemDelegate.paint(self, painter, style, index)