Mercurial > hg > Feedworm
diff MainWindow.py @ 119:04a730f9d07d backend
move all sqlalchemy related classes to the respective sub-package. use a backend to abstract from access to the data
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sun, 21 Aug 2011 03:55:16 +0200 |
parents | e9145e8dd698 |
children | e830fa1cc7a2 |
line wrap: on
line diff
--- a/MainWindow.py Sun Aug 21 02:47:25 2011 +0200 +++ b/MainWindow.py Sun Aug 21 03:55:16 2011 +0200 @@ -1,35 +1,32 @@ -from AddFeed import AddFeed +#from AddFeed import AddFeed from DisplayModel import DisplayModel -from Feed import Feed from FeedEntryItemDelegate import FeedEntryItemDelegate from FeedEntryTableModel import FeedEntryTableModel from FeedSettings import FeedSettings -from Preferences import Preferences -from PreferencesDialog import PreferencesDialog +#from PreferencesDialog import PreferencesDialog from PyQt4.QtCore import QUrl from PyQt4.QtGui import QApplication from PyQt4.QtGui import QMainWindow from PyQt4.QtGui import QWidget from Ui_MainWindow import Ui_MainWindow -import FeedList import subprocess STATUS_MESSAGE_DISPLAY_MILLIS = 20000 class MainWindow(QMainWindow): - def __init__(self, session=None): + def __init__(self, backend=None): QWidget.__init__(self, None) - self.session = session - self.preferences = Preferences(session) + self.backend = backend + self.preferences = backend.preferences() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.updateFeedList() self.initFeedEntryList() def updateFeedList(self): - self.allFeeds = FeedList.getFeeds(self.session) - feedModel = DisplayModel(self, self.allFeeds, Feed.userPresentableString) + self.allFeeds = self.backend.getFeeds() + feedModel = DisplayModel(self, self.allFeeds, "title") self.ui.feedList.setModel(feedModel) self.ui.feedList.update() @@ -145,17 +142,18 @@ self.ui.feedEntryList.doItemsLayout() def addFeed(self): - addFeed = AddFeed(self.session) - success = addFeed.exec_() - if not success: - return - - if addFeed.exception is not None: - message = "Error while adding feed: " + str(addFeed.exception) - self._updateStatusBar(message) - else: - self.session.commit() - self.updateFeedList() + pass +# addFeed = AddFeed(self.session) +# success = addFeed.exec_() +# if not success: +# return +# +# if addFeed.exception is not None: +# message = "Error while adding feed: " + str(addFeed.exception) +# self._updateStatusBar(message) +# else: +# self.session.commit() +# self.updateFeedList() def deleteFeed(self): try: @@ -167,8 +165,9 @@ self._updateStatusBar(message) def showPreferences(self): - preferences = PreferencesDialog(self.session) - preferences.exec_() + pass +# preferences = PreferencesDialog(self.session) +# preferences.exec_() def showFeedSettings(self): feedSettings = FeedSettings(self.session, self.selectedFeed) @@ -178,8 +177,7 @@ self.ui.statusbar.showMessage(message, STATUS_MESSAGE_DISPLAY_MILLIS) def close(self): - # save all uncommitted state, just in case - self.session.commit() + self.backend.dispose() QMainWindow.close(self) def copyArticleURLToClipboard(self):