annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
1
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
2 from PyQt4 import QtGui
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
3 from Ui_AddFeed import Ui_AddFeed
49
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
4 import FeedUpdater
27
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
5
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
6 class AddFeed(QtGui.QDialog):
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
7 def __init__(self, session=None):
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
8 QtGui.QWidget.__init__(self, None)
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
9 self.session = session
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
10 self.ui = Ui_AddFeed()
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
11 self.ui.setupUi(self)
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
12 self.ui.url.setFocus()
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
13
49
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
14 def accept(self):
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
15 self.createFeed()
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
16 QtGui.QDialog.accept(self)
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
17
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
18 def createFeed(self):
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
19 url = self.getUrl()
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
20 # TODO get status from feedUpdater and display in status area of the main window
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
21 FeedUpdater.createNewFeed(url, self.session)
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
22
27
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
23 def getUrl(self):
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
24 text = self.ui.url.text()
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
25 # the content of a QLineEdit is a QString, convert it to a Python string
bdd1296a4b8c implemented adding a feed
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
26 return str(text)
49
6eba4168fd54 move the logic to add a feed into AddFeed
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 27
diff changeset
27