Mercurial > hg > Feedworm
view MainWindow.py @ 28:72dfae865899
better logging when updating feeds, handle entries that have no id
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 29 Apr 2010 07:04:42 +0200 |
parents | bdd1296a4b8c |
children | 5bb57caa8f66 |
line wrap: on
line source
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 class MainWindow(QtGui.QMainWindow): def __init__(self, session=None): QtGui.QWidget.__init__(self, None) self.session = session self.ui = Ui_MainWindow() self.ui.setupUi(self) self.updateFeedList() 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) 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) def addFeed(self): 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()