# HG changeset patch # User Dirk Olmes # Date 1272419207 -7200 # Node ID 35225588b8958554b37fc94eb3bcb2d6a9558182 # Parent 5fda8bd94fa831a2efab773288d75ef91fd95f50 add a list view for displaying feed entries from the selected feed diff -r 5fda8bd94fa8 -r 35225588b895 FeedEntry.py --- a/FeedEntry.py Wed Apr 28 03:37:01 2010 +0200 +++ b/FeedEntry.py Wed Apr 28 03:46:47 2010 +0200 @@ -12,3 +12,6 @@ def __repr__(self): return "" % (self.pk, self.link) + + def userPresentableString(self): + return self.title \ No newline at end of file diff -r 5fda8bd94fa8 -r 35225588b895 MainWindowController.py --- a/MainWindowController.py Wed Apr 28 03:37:01 2010 +0200 +++ b/MainWindowController.py Wed Apr 28 03:46:47 2010 +0200 @@ -1,5 +1,6 @@ from Feed import Feed +from FeedEntry import FeedEntry from PyQt4 import QtCore, QtGui from PyQt4.QtCore import QAbstractListModel, QModelIndex, QVariant, Qt from Ui_MainWindow import Ui_MainWindow @@ -14,6 +15,7 @@ def setupWidgets(self): self.setupFeedList() + self.setupFeedEntryList() def setupFeedList(self): self.allFeeds = Feed.all(self.session) @@ -21,9 +23,14 @@ self.ui.feedList.setModel(feedModel) self.connect(self.ui.feedList, QtCore.SIGNAL("clicked(QModelIndex)"), self.feedSelected) + def setupFeedEntryList(self): + pass + def feedSelected(self, index): feed = self.allFeeds[index.row()] - print("feed selected: " + str(feed)) + model = DisplayModel(self, feed.entries, FeedEntry.userPresentableString) + self.ui.feedEntryList.setModel(model) + self.ui.feedEntryList.update() class DisplayModel(QAbstractListModel): def __init__(self, parent=None, list=None, displayFunction=None, **args): diff -r 5fda8bd94fa8 -r 35225588b895 Ui_MainWindow.ui --- a/Ui_MainWindow.ui Wed Apr 28 03:37:01 2010 +0200 +++ b/Ui_MainWindow.ui Wed Apr 28 03:46:47 2010 +0200 @@ -23,6 +23,22 @@ 551 + + true + + + QListView::Fixed + + + + + + 230 + 0 + 571 + 111 + +