Mercurial > hg > Feedworm
diff MainWindow.py @ 27:bdd1296a4b8c
implemented adding a feed
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 29 Apr 2010 06:47:47 +0200 |
parents | 6b5ceffabe49 |
children | 5bb57caa8f66 |
line wrap: on
line diff
--- a/MainWindow.py Thu Apr 29 06:47:22 2010 +0200 +++ b/MainWindow.py Thu Apr 29 06:47:47 2010 +0200 @@ -1,7 +1,9 @@ +from AddFeed import AddFeed from DisplayModel import DisplayModel from Feed import Feed from FeedEntry import FeedEntry +import FeedUpdater from PyQt4 import QtGui from PyQt4.QtCore import QUrl from Ui_MainWindow import Ui_MainWindow @@ -12,13 +14,14 @@ self.session = session self.ui = Ui_MainWindow() self.ui.setupUi(self) - self.setupFeedList() + self.updateFeedList() - def setupFeedList(self): + def updateFeedList(self): self.allFeeds = Feed.all(self.session) feedModel = DisplayModel(self, self.allFeeds, Feed.userPresentableString) self.ui.feedList.setModel(feedModel) - + self.ui.feedList.update() + def feedSelected(self, index): self.selectedFeed = self.allFeeds[index.row()] model = DisplayModel(self, self.selectedFeed.entries, FeedEntry.userPresentableString) @@ -32,5 +35,10 @@ self.ui.webView.setHtml(entry.summary, baseUrl) def addFeed(self): - print("Add Feed!") - \ No newline at end of file + addFeed = AddFeed(self.session) + success = addFeed.exec_() + if success: + url = addFeed.getUrl() + FeedUpdater.createNewFeed(url, self.session) + # TODO get status from feedUpdater and display in status area of the main window + self.updateFeedList()