# HG changeset patch # User Dirk Olmes # Date 1272512637 -7200 # Node ID 6b5ceffabe495cc31108f72eeca68fbc587336a9 # Parent dcc8abff06943801fd4fd03cb3f46ed6fbbf5371 MainWindowController -> MainWindow diff -r dcc8abff0694 -r 6b5ceffabe49 MainWindow.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MainWindow.py Thu Apr 29 05:43:57 2010 +0200 @@ -0,0 +1,36 @@ + +from DisplayModel import DisplayModel +from Feed import Feed +from FeedEntry import FeedEntry +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.setupFeedList() + + def setupFeedList(self): + self.allFeeds = Feed.all(self.session) + feedModel = DisplayModel(self, self.allFeeds, Feed.userPresentableString) + self.ui.feedList.setModel(feedModel) + + 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): + print("Add Feed!") + \ No newline at end of file diff -r dcc8abff0694 -r 6b5ceffabe49 MainWindowController.py --- a/MainWindowController.py Thu Apr 29 05:41:52 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ - -from DisplayModel import DisplayModel -from Feed import Feed -from FeedEntry import FeedEntry -from PyQt4 import QtGui -from PyQt4.QtCore import QUrl -from Ui_MainWindow import Ui_MainWindow - -class MainWindowController(QtGui.QMainWindow): - def __init__(self, session=None): - QtGui.QWidget.__init__(self, None) - self.session = session - self.ui = Ui_MainWindow() - self.ui.setupUi(self) - self.setupFeedList() - - def setupFeedList(self): - self.allFeeds = Feed.all(self.session) - feedModel = DisplayModel(self, self.allFeeds, Feed.userPresentableString) - self.ui.feedList.setModel(feedModel) - - 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): - print("Add Feed!") - \ No newline at end of file diff -r dcc8abff0694 -r 6b5ceffabe49 feedworm-gui.py --- a/feedworm-gui.py Thu Apr 29 05:41:52 2010 +0200 +++ b/feedworm-gui.py Thu Apr 29 05:43:57 2010 +0200 @@ -1,5 +1,5 @@ -from MainWindowController import MainWindowController +from MainWindow import MainWindow from PyQt4 import QtGui import sys from util import configureLogging, createSession @@ -9,6 +9,6 @@ session = createSession() app = QtGui.QApplication(sys.argv) - mainWindowController = MainWindowController(session) - mainWindowController.show() + mainWindow = MainWindow(session) + mainWindow.show() sys.exit(app.exec_())