Mercurial > hg > Feedworm
annotate FeedSettings.py @ 254:156edbd0733a pyqt5
the pyqt5 branch was merged into the default branch
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Fri, 10 Nov 2017 01:45:55 +0100 |
parents | 3ce39af93e77 |
children |
rev | line source |
---|---|
217
bb3c851b18b1
add source file endcoding header
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
208
diff
changeset
|
1 # -*- coding: utf-8 -*- |
251 | 2 from PyQt5.QtWidgets import QDialog |
48 | 3 from Ui_FeedSettings import Ui_FeedSettings |
4 | |
245 | 5 """ |
6 Copy all feed properties into the GUI on initialization. Collect all changes | |
7 in a separate dict that's passed into the backend along with the feed to modify. | |
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 | 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): |
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 | 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 | 33 |
34 def autoLoadArticleChanged(self, change): | |
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 | 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 | 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 | 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() |