annotate PreferencesDialog.py @ 114:b0290ab29483

move the "mark as read" menu items up in the feed menu as they are used most often
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 28 May 2011 07:43:56 +0200
parents c17a224bc251
children e830fa1cc7a2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
1
43
12ed8b5fa08c first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 42
diff changeset
2 from Preferences import Preferences
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
3 from PyQt4 import QtGui
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
4 from Ui_Preferences import Ui_Preferences
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
5
42
0c0d1760b737 Rename Preferences to PreferencesDialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 41
diff changeset
6 class PreferencesDialog(QtGui.QDialog):
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
7 def __init__(self, session=None):
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
8 QtGui.QWidget.__init__(self, None)
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
9 self.session = session
43
12ed8b5fa08c first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 42
diff changeset
10 self.preferences = Preferences(session)
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
11 self.ui = Ui_Preferences()
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
12 self.ui.setupUi(self)
42
0c0d1760b737 Rename Preferences to PreferencesDialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 41
diff changeset
13 self.fillUi()
88
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
14
42
0c0d1760b737 Rename Preferences to PreferencesDialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 41
diff changeset
15 def fillUi(self):
111
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
16 self.fillMaximized()
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
17 self.fillHideReadFeedEntries()
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
18 self.fillShowOnlyUnreadFeeds()
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
19 self.fillProxySettings()
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
20 self.fillDaysToKeepFeedEntries()
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
21
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
22 def fillMaximized(self):
43
12ed8b5fa08c first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 42
diff changeset
23 maximized = self.preferences.startMaximized()
12ed8b5fa08c first system preference: configure app to stat maximized.
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 42
diff changeset
24 self.ui.startMaximized.setChecked(maximized)
88
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
25
111
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
26 def fillHideReadFeedEntries(self):
61
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
27 hideRead = self.preferences.hideReadFeedEntries()
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
28 self.ui.hideReadFeedEntries.setChecked(hideRead)
88
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
29
111
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
30 def fillShowOnlyUnreadFeeds(self):
72
e8c2730eb444 control the display of unread feeds/all feeds via Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 61
diff changeset
31 showOnlyUnreadFeeds = self.preferences.showOnlyUnreadFeeds()
e8c2730eb444 control the display of unread feeds/all feeds via Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 61
diff changeset
32 self.ui.showOnlyUnreadFeeds.setChecked(showOnlyUnreadFeeds)
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
33
88
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
34 def fillProxySettings(self):
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
35 if self.preferences.isProxyConfigured():
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
36 self.ui.proxyHost.setText(self.preferences.proxyHost())
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
37 self.ui.proxyPort.setText(str(self.preferences.proxyPort()))
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
38
111
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
39 def fillDaysToKeepFeedEntries(self):
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
40 days = self.preferences.daysToKeepFeedEntries()
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
41 self.ui.daysToKeepFeedEntries.setText(str(days))
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
42
40
c858aab71e5b add preferences dialog
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
43 def startMaximizedChanged(self, change):
46
03358c113170 Better preferences handling: the GUI's responsibility is to convert the input from the event into a boolean value
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 44
diff changeset
44 if change:
03358c113170 Better preferences handling: the GUI's responsibility is to convert the input from the event into a boolean value
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 44
diff changeset
45 self.preferences.setStartMaximized(True)
03358c113170 Better preferences handling: the GUI's responsibility is to convert the input from the event into a boolean value
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 44
diff changeset
46 else:
03358c113170 Better preferences handling: the GUI's responsibility is to convert the input from the event into a boolean value
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 44
diff changeset
47 self.preferences.setStartMaximized(False)
41
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
48
61
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
49 def hideReadFeedEntriesChanged(self, change):
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
50 if change:
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
51 self.preferences.setHideReadFeedEntries(True)
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
52 else:
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
53 self.preferences.setHideReadFeedEntries(False)
db35ab7753f0 add a preference to hide read feed entries
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 46
diff changeset
54
72
e8c2730eb444 control the display of unread feeds/all feeds via Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 61
diff changeset
55 def showOnlyFeedsWithUnreadEntries(self, change):
e8c2730eb444 control the display of unread feeds/all feeds via Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 61
diff changeset
56 if change:
e8c2730eb444 control the display of unread feeds/all feeds via Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 61
diff changeset
57 self.preferences.setShowOnlyUnreadFeeds(True)
e8c2730eb444 control the display of unread feeds/all feeds via Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 61
diff changeset
58 else:
e8c2730eb444 control the display of unread feeds/all feeds via Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 61
diff changeset
59 self.preferences.setShowOnlyUnreadFeeds(False)
e8c2730eb444 control the display of unread feeds/all feeds via Preferences
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 61
diff changeset
60
88
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
61 def storeProxySettings(self):
111
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
62 proxyHost = self.ui.proxyHost.text()
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
63 if proxyHost.isEmpty():
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
64 proxyHost = None
88
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
65 self.preferences.setProxyHost(proxyHost)
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
66
111
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
67 proxyPort = self.ui.proxyPort.text()
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
68 if proxyPort.isEmpty():
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
69 proxyPort = None
88
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
70 self.preferences.setProxyPort(proxyPort)
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
71
111
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
72 def daysToKeepFeedEntriesFinishedEditing(self):
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
73 text = self.ui.daysToKeepFeedEntries.text()
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
74 if not text.isEmpty():
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
75 text = str(text)
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
76 self.preferences.setDaysToKeepFeedEntries(text)
c17a224bc251 make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 88
diff changeset
77
41
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
78 def accept(self):
88
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
79 self.storeProxySettings()
44
be990ac6e478 saving the preference "start maximized" from GUI implemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 43
diff changeset
80 self.session.commit()
41
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
81 QtGui.QDialog.accept(self)
88
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
82
41
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
83 def reject(self):
44
be990ac6e478 saving the preference "start maximized" from GUI implemented
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 43
diff changeset
84 self.session.rollback()
41
9fa1e33b67da use Qt resources for window icons
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 40
diff changeset
85 QtGui.QDialog.reject(self)
88
48d1d7bba548 UI for setting the proxy settings
Dirk Olmes <dirk@xanthippe.ping.de>
parents: 72
diff changeset
86