annotate FeedSettings.py @ 180:a4832a180c69

allow setting the URL to the database via command line
author dirk
date Sat, 10 Sep 2011 04:43:40 +0200
parents bca9341dc67f
children a2552f1e450e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
1
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
2 from PyQt4 import QtGui
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
3 from Ui_FeedSettings import Ui_FeedSettings
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
4
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
5 class FeedSettings(QtGui.QDialog):
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
6 """
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
7 Copy all feed properties into the GUI on initialization. Collect all changes
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
8 in a separate dict that's passed into the backend along with the feed to modify.
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
9 """
151
bca9341dc67f move the selected feed into the backend - sqlalchemy backend works, couchdb backend currently broken
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 124
diff changeset
10 def __init__(self, backend):
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
11 QtGui.QWidget.__init__(self, None)
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
12 self.backend = backend
151
bca9341dc67f move the selected feed into the backend - sqlalchemy backend works, couchdb backend currently broken
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 124
diff changeset
13 self.feed = backend.selectedFeed
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
14 self.changes = {}
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
15 self.ui = Ui_FeedSettings()
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
16 self.ui.setupUi(self)
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
17 self.initUi()
151
bca9341dc67f move the selected feed into the backend - sqlalchemy backend works, couchdb backend currently broken
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 124
diff changeset
18
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
19 def initUi(self):
52
6bc6899f3330 allow changing a feed's title
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 48
diff changeset
20 self.ui.feedTitle.setText(self.feed.title)
79
d11c3f71ac40 Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 77
diff changeset
21 self.ui.updateInterval.setText(str(self.feed.update_interval))
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
22 self.ui.autoLoadArticle.setChecked(self.feed.auto_load_entry_link)
77
d292ab61ed6f Add another setting to feed: when opening a feed entry in browser, you can force opening it in an external browser now. This is because some sites just crash the QWebView.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 52
diff changeset
23 self.ui.alwaysOpenInBrowser.setChecked(self.feed.always_open_in_browser)
d292ab61ed6f Add another setting to feed: when opening a feed entry in browser, you can force opening it in an external browser now. This is because some sites just crash the QWebView.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 52
diff changeset
24
d292ab61ed6f Add another setting to feed: when opening a feed entry in browser, you can force opening it in an external browser now. This is because some sites just crash the QWebView.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 52
diff changeset
25 def editingTitleFinished(self):
d292ab61ed6f Add another setting to feed: when opening a feed entry in browser, you can force opening it in an external browser now. This is because some sites just crash the QWebView.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 52
diff changeset
26 title = str(self.ui.feedTitle.text())
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
27 self.changes["title"] = title
151
bca9341dc67f move the selected feed into the backend - sqlalchemy backend works, couchdb backend currently broken
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 124
diff changeset
28
79
d11c3f71ac40 Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 77
diff changeset
29 def editingUpdateIntervalFinished(self):
d11c3f71ac40 Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 77
diff changeset
30 updateInterval = int(str(self.ui.updateInterval.text()))
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
31 self.changes["update_interval"] = updateInterval
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
32
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
33 def autoLoadArticleChanged(self, change):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
34 if change:
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
35 self.changes["auto_load_entry_link"] = True
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
36 else:
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
37 self.changes["auto_load_entry_link"] = False
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
38
77
d292ab61ed6f Add another setting to feed: when opening a feed entry in browser, you can force opening it in an external browser now. This is because some sites just crash the QWebView.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 52
diff changeset
39 def alwaysOpenInExternalBrowser(self, change):
d292ab61ed6f Add another setting to feed: when opening a feed entry in browser, you can force opening it in an external browser now. This is because some sites just crash the QWebView.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 52
diff changeset
40 if change:
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
41 self.changes["always_open_in_browser"] = True
77
d292ab61ed6f Add another setting to feed: when opening a feed entry in browser, you can force opening it in an external browser now. This is because some sites just crash the QWebView.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 52
diff changeset
42 else:
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
43 self.changes["always_open_in_browser"] = False
77
d292ab61ed6f Add another setting to feed: when opening a feed entry in browser, you can force opening it in an external browser now. This is because some sites just crash the QWebView.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 52
diff changeset
44
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
45 def accept(self):
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
46 self.backend.updateFeed(self.feed, self.changes)
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
47 QtGui.QDialog.accept(self)