# HG changeset patch # User Dirk Olmes # Date 1272420030 -7200 # Node ID 6f7003fc6e6d38ebae8c2cead90727819a4d2423 # Parent 35225588b8958554b37fc94eb3bcb2d6a9558182 display the summary of the selected feed entry diff -r 35225588b895 -r 6f7003fc6e6d MainWindowController.py --- a/MainWindowController.py Wed Apr 28 03:46:47 2010 +0200 +++ b/MainWindowController.py Wed Apr 28 04:00:30 2010 +0200 @@ -2,7 +2,7 @@ from Feed import Feed from FeedEntry import FeedEntry from PyQt4 import QtCore, QtGui -from PyQt4.QtCore import QAbstractListModel, QModelIndex, QVariant, Qt +from PyQt4.QtCore import QAbstractListModel, QModelIndex, QVariant, Qt, QUrl from Ui_MainWindow import Ui_MainWindow class MainWindowController(QtGui.QMainWindow): @@ -24,13 +24,19 @@ self.connect(self.ui.feedList, QtCore.SIGNAL("clicked(QModelIndex)"), self.feedSelected) def setupFeedEntryList(self): - pass + self.connect(self.ui.feedEntryList, QtCore.SIGNAL("clicked(QModelIndex)"), self.feedEntrySelected) def feedSelected(self, index): - feed = self.allFeeds[index.row()] - model = DisplayModel(self, feed.entries, FeedEntry.userPresentableString) + self.selectedFeed = self.allFeeds[index.row()] + model = DisplayModel(self, self.selectedFeed.entries, FeedEntry.userPresentableString) self.ui.feedEntryList.setModel(model) self.ui.feedEntryList.update() + + def feedEntrySelected(self, index): + row = index.row() + entry = self.selectedFeed.entries[row] + baseUrl = QUrl(entry.link) # TODO this is the wrong base url, figure out the correct one + self.ui.webView.setHtml(entry.summary, baseUrl) class DisplayModel(QAbstractListModel): def __init__(self, parent=None, list=None, displayFunction=None, **args):