comparison MainWindow.py @ 24:6b5ceffabe49

MainWindowController -> MainWindow
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 29 Apr 2010 05:43:57 +0200
parents MainWindowController.py@dcc8abff0694
children bdd1296a4b8c
comparison
equal deleted inserted replaced
23:dcc8abff0694 24:6b5ceffabe49
1
2 from DisplayModel import DisplayModel
3 from Feed import Feed
4 from FeedEntry import FeedEntry
5 from PyQt4 import QtGui
6 from PyQt4.QtCore import QUrl
7 from Ui_MainWindow import Ui_MainWindow
8
9 class MainWindow(QtGui.QMainWindow):
10 def __init__(self, session=None):
11 QtGui.QWidget.__init__(self, None)
12 self.session = session
13 self.ui = Ui_MainWindow()
14 self.ui.setupUi(self)
15 self.setupFeedList()
16
17 def setupFeedList(self):
18 self.allFeeds = Feed.all(self.session)
19 feedModel = DisplayModel(self, self.allFeeds, Feed.userPresentableString)
20 self.ui.feedList.setModel(feedModel)
21
22 def feedSelected(self, index):
23 self.selectedFeed = self.allFeeds[index.row()]
24 model = DisplayModel(self, self.selectedFeed.entries, FeedEntry.userPresentableString)
25 self.ui.feedEntryList.setModel(model)
26 self.ui.feedEntryList.update()
27
28 def feedEntrySelected(self, index):
29 row = index.row()
30 entry = self.selectedFeed.entries[row]
31 baseUrl = QUrl(entry.link) # TODO this is the wrong base url, figure out the correct one
32 self.ui.webView.setHtml(entry.summary, baseUrl)
33
34 def addFeed(self):
35 print("Add Feed!")
36