annotate FeedSettings.py @ 84:bacf42da9e36

update the status bar when an article is opened
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sun, 22 Aug 2010 16:45:25 +0200
parents d11c3f71ac40
children a4b2077c9603
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
1
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
2 from PyQt4 import QtGui
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
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
5 class FeedSettings(QtGui.QDialog):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
6 def __init__(self, session, feed):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
7 QtGui.QWidget.__init__(self, None)
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
8 self.session = session
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
9 self.feed = feed
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
10 self.ui = Ui_FeedSettings()
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
11 self.ui.setupUi(self)
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
12 self.initUi()
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
13
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
14 def initUi(self):
52
6bc6899f3330 allow changing a feed's title
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 48
diff changeset
15 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
16 self.ui.updateInterval.setText(str(self.feed.update_interval))
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
17 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
18 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
19
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
20 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
21 title = str(self.ui.feedTitle.text())
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
22 self.feed.title = title
79
d11c3f71ac40 Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 77
diff changeset
23
d11c3f71ac40 Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 77
diff changeset
24 def editingUpdateIntervalFinished(self):
d11c3f71ac40 Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 77
diff changeset
25 updateInterval = int(str(self.ui.updateInterval.text()))
d11c3f71ac40 Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 77
diff changeset
26 self.feed.update_interval = updateInterval
d11c3f71ac40 Make update interval editable via the feed's settings dialog.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 77
diff changeset
27 self.feed.incrementNextUpdateDate()
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
28
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
29 def autoLoadArticleChanged(self, change):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
30 if change:
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
31 self.feed.auto_load_entry_link = True
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
32 else:
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
33 self.feed.auto_load_entry_link = False
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
34
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
35 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
36 if 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
37 self.feed.always_open_in_browser = True
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
38 else:
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 self.feed.always_open_in_browser = False
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
48
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
41 def accept(self):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
42 self.session.commit()
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
43 QtGui.QDialog.accept(self)
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
44
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
45 def reject(self):
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
46 self.session.rollback()
6e5219e05625 GUI for feed settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
47 QtGui.QDialog.reject(self)