Mercurial > hg > Feedworm
comparison FeedSettings.py @ 124:a4b2077c9603 backend
editing a feed's properties is implemented through the backend now
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 22 Aug 2011 11:02:53 +0200 |
parents | d11c3f71ac40 |
children | bca9341dc67f |
comparison
equal
deleted
inserted
replaced
123:862760b161b4 | 124:a4b2077c9603 |
---|---|
1 | 1 |
2 from PyQt4 import QtGui | 2 from PyQt4 import QtGui |
3 from Ui_FeedSettings import Ui_FeedSettings | 3 from Ui_FeedSettings import Ui_FeedSettings |
4 | 4 |
5 class FeedSettings(QtGui.QDialog): | 5 class FeedSettings(QtGui.QDialog): |
6 def __init__(self, session, feed): | 6 """ |
7 Copy all feed properties into the GUI on initialization. Collect all changes | |
8 in a separate dict that's passed into the backend along with the feed to modify. | |
9 """ | |
10 def __init__(self, feed, backend): | |
7 QtGui.QWidget.__init__(self, None) | 11 QtGui.QWidget.__init__(self, None) |
8 self.session = session | |
9 self.feed = feed | 12 self.feed = feed |
13 self.backend = backend | |
14 self.changes = {} | |
10 self.ui = Ui_FeedSettings() | 15 self.ui = Ui_FeedSettings() |
11 self.ui.setupUi(self) | 16 self.ui.setupUi(self) |
12 self.initUi() | 17 self.initUi() |
13 | 18 |
14 def initUi(self): | 19 def initUi(self): |
17 self.ui.autoLoadArticle.setChecked(self.feed.auto_load_entry_link) | 22 self.ui.autoLoadArticle.setChecked(self.feed.auto_load_entry_link) |
18 self.ui.alwaysOpenInBrowser.setChecked(self.feed.always_open_in_browser) | 23 self.ui.alwaysOpenInBrowser.setChecked(self.feed.always_open_in_browser) |
19 | 24 |
20 def editingTitleFinished(self): | 25 def editingTitleFinished(self): |
21 title = str(self.ui.feedTitle.text()) | 26 title = str(self.ui.feedTitle.text()) |
22 self.feed.title = title | 27 self.changes["title"] = title |
23 | 28 |
24 def editingUpdateIntervalFinished(self): | 29 def editingUpdateIntervalFinished(self): |
25 updateInterval = int(str(self.ui.updateInterval.text())) | 30 updateInterval = int(str(self.ui.updateInterval.text())) |
26 self.feed.update_interval = updateInterval | 31 self.changes["update_interval"] = updateInterval |
27 self.feed.incrementNextUpdateDate() | |
28 | 32 |
29 def autoLoadArticleChanged(self, change): | 33 def autoLoadArticleChanged(self, change): |
30 if change: | 34 if change: |
31 self.feed.auto_load_entry_link = True | 35 self.changes["auto_load_entry_link"] = True |
32 else: | 36 else: |
33 self.feed.auto_load_entry_link = False | 37 self.changes["auto_load_entry_link"] = False |
34 | 38 |
35 def alwaysOpenInExternalBrowser(self, change): | 39 def alwaysOpenInExternalBrowser(self, change): |
36 if change: | 40 if change: |
37 self.feed.always_open_in_browser = True | 41 self.changes["always_open_in_browser"] = True |
38 else: | 42 else: |
39 self.feed.always_open_in_browser = False | 43 self.changes["always_open_in_browser"] = False |
40 | 44 |
41 def accept(self): | 45 def accept(self): |
42 self.session.commit() | 46 self.backend.updateFeed(self.feed, self.changes) |
43 QtGui.QDialog.accept(self) | 47 QtGui.QDialog.accept(self) |
44 | |
45 def reject(self): | |
46 self.session.rollback() | |
47 QtGui.QDialog.reject(self) |