Mercurial > hg > Feedworm
view 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 source
from PyQt4 import QtGui from Ui_AddFeed import Ui_AddFeed import logging class AddFeed(QtGui.QDialog): def __init__(self, backend=None): QtGui.QWidget.__init__(self, None) 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() # TODO this should be the responsibility of the FeedUpdater except AttributeError as ae: logging.getLogger("AddFeed").info(ae) self.exception = ae 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 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)