Mercurial > hg > Feedworm
diff MainWindow.py @ 61:db35ab7753f0
add a preference to hide read feed entries
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 24 Jul 2010 03:11:06 +0200 |
parents | d063e4814357 |
children | 228da10cc98b |
line wrap: on
line diff
--- a/MainWindow.py Fri Jul 23 17:41:05 2010 +0200 +++ b/MainWindow.py Sat Jul 24 03:11:06 2010 +0200 @@ -5,6 +5,7 @@ from FeedEntry import FeedEntry from FeedEntryItemDelegate import FeedEntryItemDelegate from FeedSettings import FeedSettings +from Preferences import Preferences from PreferencesDialog import PreferencesDialog from PyQt4 import QtGui from PyQt4.QtCore import QUrl @@ -17,6 +18,7 @@ def __init__(self, session=None): QtGui.QWidget.__init__(self, None) self.session = session + self.preferences = Preferences(session) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.updateFeedList() @@ -33,21 +35,29 @@ def feedSelected(self, index): self.selectedFeed = self.allFeeds[index.row()] + self.enableFeedRelatedWidgets() + self.setupFeedEntries() + def enableFeedRelatedWidgets(self): self.ui.actionFeedSettings.setEnabled(True) self.ui.actionMarkFeedRead.setEnabled(True) + + def setupFeedEntries(self): + hideReadEntries = self.preferences.hideReadFeedEntries() + self.feedEntries = self.selectedFeed.entriesSortedByUpdateDate(hideReadEntries) + self.initFeedDisplayModel() - self.sortedEntries = self.selectedFeed.entriesSortedByUpdateDate() - model = DisplayModel(self, self.sortedEntries, FeedEntry.userPresentableString) + def initFeedDisplayModel(self): + model = DisplayModel(self, self.feedEntries, FeedEntry.userPresentableString) self.ui.feedEntryList.setModel(model) - self.ui.feedEntryList.itemDelegate().entries = self.sortedEntries + self.ui.feedEntryList.itemDelegate().entries = self.feedEntries self.ui.feedEntryList.update() - + def feedEntrySelected(self, index): self.ui.menuArticle.setEnabled(True) row = index.row() - self.selectedEntry = self.sortedEntries[row] + self.selectedEntry = self.feedEntries[row] self.selectedEntry.markRead() if self.selectedEntry.feed.auto_load_entry_link: