# HG changeset patch # User Dirk Olmes # Date 1274145426 -7200 # Node ID 0f9b3e57cff0b476120aa8289bf7a4ab1bd8ef7a # Parent b535bce50626dd5808c4733fc9d60360d94c7e5b pull out FeedEntryItemDelegate into its own file diff -r b535bce50626 -r 0f9b3e57cff0 FeedEntryItemDelegate.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FeedEntryItemDelegate.py Tue May 18 03:17:06 2010 +0200 @@ -0,0 +1,16 @@ + +from PyQt4 import QtGui +from PyQt4.QtGui import QFont + +class FeedEntryItemDelegate(QtGui.QStyledItemDelegate): + def __init__(self): + QtGui.QStyledItemDelegate.__init__(self, None) + + def paint(self, painter, style, index): + row = index.row() + entry = self.entries[row] + if entry.read: + style.font.setWeight(QFont.Normal) + else: + style.font.setWeight(QFont.Bold) + QtGui.QStyledItemDelegate.paint(self, painter, style, index) diff -r b535bce50626 -r 0f9b3e57cff0 MainWindow.py --- a/MainWindow.py Tue May 18 03:12:00 2010 +0200 +++ b/MainWindow.py Tue May 18 03:17:06 2010 +0200 @@ -3,11 +3,11 @@ from DisplayModel import DisplayModel from Feed import Feed from FeedEntry import FeedEntry +from FeedEntryItemDelegate import FeedEntryItemDelegate from FeedSettings import FeedSettings from PreferencesDialog import PreferencesDialog from PyQt4 import QtGui from PyQt4.QtCore import QUrl -from PyQt4.QtGui import QFont from Ui_MainWindow import Ui_MainWindow import subprocess @@ -95,15 +95,3 @@ feedSettings.exec_() -class FeedEntryItemDelegate(QtGui.QStyledItemDelegate): - def __init__(self): - QtGui.QStyledItemDelegate.__init__(self, None) - - def paint(self, painter, style, index): - row = index.row() - entry = self.entries[row] - if entry.read: - style.font.setWeight(QFont.Normal) - else: - style.font.setWeight(QFont.Bold) - QtGui.QStyledItemDelegate.paint(self, painter, style, index)