Mercurial > hg > Feedworm
annotate FeedSettings.py @ 131:3719440c8c6b backend
closing the backend branch now that it's merged into default
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 22 Aug 2011 15:35:32 +0200 |
parents | a4b2077c9603 |
children | bca9341dc67f |
rev | line source |
---|---|
48 | 1 |
2 from PyQt4 import QtGui | |
3 from Ui_FeedSettings import Ui_FeedSettings | |
4 | |
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 """ |
a4b2077c9603
editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
79
diff
changeset
|
10 def __init__(self, feed, backend): |
48 | 11 QtGui.QWidget.__init__(self, None) |
12 self.feed = feed | |
124
a4b2077c9603
editing a feed's properties is implemented through the backend now
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
79
diff
changeset
|
13 self.backend = backend |
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 | 15 self.ui = Ui_FeedSettings() |
16 self.ui.setupUi(self) | |
17 self.initUi() | |
18 | |
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 | 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 |
79
d11c3f71ac40
Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
77
diff
changeset
|
28 |
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 | 32 |
33 def autoLoadArticleChanged(self, change): | |
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 | 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 | 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 | 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 | 47 QtGui.QDialog.accept(self) |