Mercurial > hg > Feedworm
comparison PreferencesDialog.py @ 111:c17a224bc251
make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 31 Mar 2011 03:15:39 +0200 |
parents | 48d1d7bba548 |
children | e830fa1cc7a2 |
comparison
equal
deleted
inserted
replaced
110:43c234c8fe87 | 111:c17a224bc251 |
---|---|
11 self.ui = Ui_Preferences() | 11 self.ui = Ui_Preferences() |
12 self.ui.setupUi(self) | 12 self.ui.setupUi(self) |
13 self.fillUi() | 13 self.fillUi() |
14 | 14 |
15 def fillUi(self): | 15 def fillUi(self): |
16 self.fillMaximized() | |
17 self.fillHideReadFeedEntries() | |
18 self.fillShowOnlyUnreadFeeds() | |
19 self.fillProxySettings() | |
20 self.fillDaysToKeepFeedEntries() | |
21 | |
22 def fillMaximized(self): | |
16 maximized = self.preferences.startMaximized() | 23 maximized = self.preferences.startMaximized() |
17 self.ui.startMaximized.setChecked(maximized) | 24 self.ui.startMaximized.setChecked(maximized) |
18 | 25 |
26 def fillHideReadFeedEntries(self): | |
19 hideRead = self.preferences.hideReadFeedEntries() | 27 hideRead = self.preferences.hideReadFeedEntries() |
20 self.ui.hideReadFeedEntries.setChecked(hideRead) | 28 self.ui.hideReadFeedEntries.setChecked(hideRead) |
21 | 29 |
30 def fillShowOnlyUnreadFeeds(self): | |
22 showOnlyUnreadFeeds = self.preferences.showOnlyUnreadFeeds() | 31 showOnlyUnreadFeeds = self.preferences.showOnlyUnreadFeeds() |
23 self.ui.showOnlyUnreadFeeds.setChecked(showOnlyUnreadFeeds) | 32 self.ui.showOnlyUnreadFeeds.setChecked(showOnlyUnreadFeeds) |
24 | |
25 self.fillProxySettings() | |
26 | 33 |
27 def fillProxySettings(self): | 34 def fillProxySettings(self): |
28 if self.preferences.isProxyConfigured(): | 35 if self.preferences.isProxyConfigured(): |
29 self.ui.proxyHost.setText(self.preferences.proxyHost()) | 36 self.ui.proxyHost.setText(self.preferences.proxyHost()) |
30 self.ui.proxyPort.setText(str(self.preferences.proxyPort())) | 37 self.ui.proxyPort.setText(str(self.preferences.proxyPort())) |
38 | |
39 def fillDaysToKeepFeedEntries(self): | |
40 days = self.preferences.daysToKeepFeedEntries() | |
41 self.ui.daysToKeepFeedEntries.setText(str(days)) | |
31 | 42 |
32 def startMaximizedChanged(self, change): | 43 def startMaximizedChanged(self, change): |
33 if change: | 44 if change: |
34 self.preferences.setStartMaximized(True) | 45 self.preferences.setStartMaximized(True) |
35 else: | 46 else: |
46 self.preferences.setShowOnlyUnreadFeeds(True) | 57 self.preferences.setShowOnlyUnreadFeeds(True) |
47 else: | 58 else: |
48 self.preferences.setShowOnlyUnreadFeeds(False) | 59 self.preferences.setShowOnlyUnreadFeeds(False) |
49 | 60 |
50 def storeProxySettings(self): | 61 def storeProxySettings(self): |
51 proxyHost = str(self.ui.proxyHost.text()) | 62 proxyHost = self.ui.proxyHost.text() |
63 if proxyHost.isEmpty(): | |
64 proxyHost = None | |
52 self.preferences.setProxyHost(proxyHost) | 65 self.preferences.setProxyHost(proxyHost) |
53 | 66 |
54 proxyPort = int(self.ui.proxyPort.text()) | 67 proxyPort = self.ui.proxyPort.text() |
68 if proxyPort.isEmpty(): | |
69 proxyPort = None | |
55 self.preferences.setProxyPort(proxyPort) | 70 self.preferences.setProxyPort(proxyPort) |
71 | |
72 def daysToKeepFeedEntriesFinishedEditing(self): | |
73 text = self.ui.daysToKeepFeedEntries.text() | |
74 if not text.isEmpty(): | |
75 text = str(text) | |
76 self.preferences.setDaysToKeepFeedEntries(text) | |
56 | 77 |
57 def accept(self): | 78 def accept(self): |
58 self.storeProxySettings() | 79 self.storeProxySettings() |
59 self.session.commit() | 80 self.session.commit() |
60 QtGui.QDialog.accept(self) | 81 QtGui.QDialog.accept(self) |