Mercurial > hg > Feedworm
comparison 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 |
comparison
equal
deleted
inserted
replaced
120:e830fa1cc7a2 | 121:510a5d00e98a |
---|---|
1 | 1 |
2 from PyQt4 import QtGui | 2 from PyQt4 import QtGui |
3 from Ui_AddFeed import Ui_AddFeed | 3 from Ui_AddFeed import Ui_AddFeed |
4 import FeedUpdater | |
5 import logging | 4 import logging |
6 | 5 |
7 class AddFeed(QtGui.QDialog): | 6 class AddFeed(QtGui.QDialog): |
8 def __init__(self, session): | 7 def __init__(self, backend=None): |
9 QtGui.QWidget.__init__(self, None) | 8 QtGui.QWidget.__init__(self, None) |
10 self.session = session | 9 self.backend = backend |
11 self.exception = None | 10 self.exception = None |
12 self.ui = Ui_AddFeed() | 11 self.ui = Ui_AddFeed() |
13 self.ui.setupUi(self) | 12 self.ui.setupUi(self) |
14 self.ui.url.setFocus() | 13 self.ui.url.setFocus() |
15 | 14 |
16 def accept(self): | 15 def accept(self): |
17 try: | 16 try: |
18 self.createFeed() | 17 self.createFeed() |
19 self.session.commit() | 18 self.session.commit() # TODO this should be the responsibility of the FeedUpdater |
20 except AttributeError as ae: | 19 except AttributeError as ae: |
21 logging.getLogger("AddFeed").info(ae) | 20 logging.getLogger("AddFeed").info(ae) |
22 | 21 |
23 self.exception = ae | 22 self.exception = ae |
24 self.session.rollback() | 23 self.session.rollback() # TODO this should be the responsibility of the FeedUpdater |
25 QtGui.QDialog.accept(self) | 24 QtGui.QDialog.accept(self) |
26 | 25 |
27 def createFeed(self): | 26 def createFeed(self): |
28 url = self.getUrl() | 27 url = self.getUrl() |
29 # TODO get status from feedUpdater and display in status area of the main window | 28 # TODO get status and display in status area of the main window |
30 FeedUpdater.createNewFeed(url, self.session) | 29 self.backend.feedUpdater().createNewFeed(url) |
31 | 30 |
32 def getUrl(self): | 31 def getUrl(self): |
33 text = self.ui.url.text() | 32 text = self.ui.url.text() |
34 # the content of a QLineEdit is a QString, convert it to a Python string | 33 # the content of a QLineEdit is a QString, convert it to a Python string |
35 return str(text) | 34 return str(text) |
36 |