changeset 122:f5afe0c1f4d2 backend

move more operations to the backend
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sun, 21 Aug 2011 18:39:02 +0200
parents 510a5d00e98a
children 862760b161b4
files MainWindow.py backend/sqlalchemy/SqlAlchemyBackend.py
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MainWindow.py	Sun Aug 21 04:17:13 2011 +0200
+++ b/MainWindow.py	Sun Aug 21 18:39:02 2011 +0200
@@ -117,13 +117,11 @@
         subprocess.Popen([browser, self.selectedEntry.link])
 
     def toggleReadOnSelectedEntry(self):
-        self.selectedEntry.toggleRead()
-        self.session.commit()
+        self.backend.toggleRead(self.selectedEntry)
         self.ui.feedEntryList.doItemsLayout()
 
     def markSelectedFeedRead(self):
-        self.selectedFeed.markAllEntriesRead()
-        self.session.commit()
+        self.backend.markAllEntriesRead(self.selectedFeed)
         self.ui.feedEntryList.doItemsLayout()
 
     def markSelectedEntriesRead(self):
--- a/backend/sqlalchemy/SqlAlchemyBackend.py	Sun Aug 21 04:17:13 2011 +0200
+++ b/backend/sqlalchemy/SqlAlchemyBackend.py	Sun Aug 21 18:39:02 2011 +0200
@@ -36,6 +36,14 @@
     def getFeeds(self):
         return FeedList.getFeeds(self.session)
 
+    def toggleRead(self, feedEntry):
+        feedEntry.toggleRead()
+        self.session.commit()
+
+    def markAllEntriesRead(self, feed):
+        feed.markAllEntriesRead()
+        self.session.commit()
+
     def dispose(self):
         # save all uncommitted state, just in case
         self.session.commit()