annotate FeedSettings.py @ 245:8e73a8ae863f

Fix the docstrings
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 09 Jun 2015 02:30:55 +0200
parents 699d8f1cebd4
children 3ce39af93e77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
217
bb3c851b18b1 add source file endcoding header
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 208
diff changeset
1 # -*- coding: utf-8 -*-
218
699d8f1cebd4 unify imports, especially Qt imports. Use consistent super syntax
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 217
diff changeset
2 from PyQt4.QtGui import QDialog
48
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
245
8e73a8ae863f Fix the docstrings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 218
diff changeset
5 """
8e73a8ae863f Fix the docstrings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 218
diff changeset
6 Copy all feed properties into the GUI on initialization. Collect all changes
8e73a8ae863f Fix the docstrings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 218
diff changeset
7 in a separate dict that's passed into the backend along with the feed to modify.
8e73a8ae863f Fix the docstrings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 218
diff changeset
8 """
218
699d8f1cebd4 unify imports, especially Qt imports. Use consistent super syntax
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 217
diff changeset
9 class FeedSettings(QDialog):
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):
218
699d8f1cebd4 unify imports, especially Qt imports. Use consistent super syntax
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 217
diff changeset
11 super(FeedSettings, self).__init__(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):
208
a2552f1e450e display the feed's URL on the feed settings dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 151
diff changeset
20 self.ui.urlLabel.setText(self.feed.rss_url)
52
6bc6899f3330 allow changing a feed's title
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 48
diff changeset
21 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
22 self.ui.updateInterval.setText(str(self.feed.update_interval))
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
23 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
24 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
25
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 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
27 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
28 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
29
79
d11c3f71ac40 Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 77
diff changeset
30 def editingUpdateIntervalFinished(self):
d11c3f71ac40 Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 77
diff changeset
31 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
32 self.changes["update_interval"] = updateInterval
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
33
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
34 def autoLoadArticleChanged(self, change):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
35 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
36 self.changes["auto_load_entry_link"] = True
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
37 else:
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
38 self.changes["auto_load_entry_link"] = False
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
39
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
40 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
41 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
42 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
43 else:
124
a4b2077c9603 editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 79
diff changeset
44 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
45
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
46 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
47 self.backend.updateFeed(self.feed, self.changes)
218
699d8f1cebd4 unify imports, especially Qt imports. Use consistent super syntax
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 217
diff changeset
48 super(FeedSettings, self).accept()