diff AddFeed.py @ 121:510a5d00e98a backend

re-enabled AddFeed - does not work yet
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sun, 21 Aug 2011 04:17:13 +0200
parents dcee24702dd7
children 862760b161b4
line wrap: on
line diff
--- a/AddFeed.py	Sun Aug 21 04:04:37 2011 +0200
+++ b/AddFeed.py	Sun Aug 21 04:17:13 2011 +0200
@@ -1,36 +1,34 @@
 
 from PyQt4 import QtGui
 from Ui_AddFeed import Ui_AddFeed
-import FeedUpdater
 import logging
 
 class AddFeed(QtGui.QDialog):
-    def __init__(self, session):
+    def __init__(self, backend=None):
         QtGui.QWidget.__init__(self, None)
-        self.session = session
+        self.backend = backend
         self.exception = None
         self.ui = Ui_AddFeed()
         self.ui.setupUi(self)
         self.ui.url.setFocus()
-    
+
     def accept(self):
         try:
             self.createFeed()
-            self.session.commit()
+            self.session.commit() # TODO this should be the responsibility of the FeedUpdater
         except AttributeError as ae:
             logging.getLogger("AddFeed").info(ae)
-            
+
             self.exception = ae
-            self.session.rollback()
+            self.session.rollback() # TODO this should be the responsibility of the FeedUpdater
         QtGui.QDialog.accept(self)
 
     def createFeed(self):
         url = self.getUrl()
-        # TODO get status from feedUpdater and display in status area of the main window
-        FeedUpdater.createNewFeed(url, self.session)
-    
+        # TODO get status and display in status area of the main window
+        self.backend.feedUpdater().createNewFeed(url)
+
     def getUrl(self):
         text = self.ui.url.text()
         # the content of a QLineEdit is a QString, convert it to a Python string
         return str(text)
-    
\ No newline at end of file