Mercurial > hg > Feedworm
annotate FeedSettings.py @ 206:f74fe7cb5091
when updating feeds, only ever create new Feed objects for entries that are younger than the current expire date. This ensures that we do not see old, read, expired entries again
author | dirk |
---|---|
date | Sat, 02 Jun 2012 04:30:04 +0200 |
parents | bca9341dc67f |
children | a2552f1e450e |
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 """ |
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 | 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 | 15 self.ui = Ui_FeedSettings() |
16 self.ui.setupUi(self) | |
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 | 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 |
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 | 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) |