view AddFeed.py @ 49:6eba4168fd54

move the logic to add a feed into AddFeed
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 17 May 2010 03:52:13 +0200
parents bdd1296a4b8c
children 4b0d686493fb
line wrap: on
line source


from PyQt4 import QtGui
from Ui_AddFeed import Ui_AddFeed
import FeedUpdater

class AddFeed(QtGui.QDialog):
    def __init__(self, session=None):
        QtGui.QWidget.__init__(self, None)
        self.session = session
        self.ui = Ui_AddFeed()
        self.ui.setupUi(self)
        self.ui.url.setFocus()
    
    def accept(self):
        self.createFeed()
        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)
    
    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)