Mercurial > hg > Feedworm
view PreferencesDialog.py @ 150:babe14449162
the entries for the selected feeds had to be set onto the item delegate so had access to the selected feed entry. Keep the list in one place only (the model) and access it from the item delegate.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 27 Aug 2011 06:43:28 +0200 |
parents | e830fa1cc7a2 |
children | e8bb107a74e1 |
line wrap: on
line source
from PyQt4 import QtGui from Ui_Preferences import Ui_Preferences class PreferencesDialog(QtGui.QDialog): def __init__(self, backend=None): QtGui.QWidget.__init__(self, None) self.backend = backend self.preferences = backend.preferences() self.ui = Ui_Preferences() self.ui.setupUi(self) self.fillUi() def fillUi(self): self.fillMaximized() self.fillHideReadFeedEntries() self.fillShowOnlyUnreadFeeds() self.fillProxySettings() self.fillDaysToKeepFeedEntries() def fillMaximized(self): maximized = self.preferences.startMaximized() self.ui.startMaximized.setChecked(maximized) def fillHideReadFeedEntries(self): hideRead = self.preferences.hideReadFeedEntries() self.ui.hideReadFeedEntries.setChecked(hideRead) def fillShowOnlyUnreadFeeds(self): showOnlyUnreadFeeds = self.preferences.showOnlyUnreadFeeds() self.ui.showOnlyUnreadFeeds.setChecked(showOnlyUnreadFeeds) def fillProxySettings(self): if self.preferences.isProxyConfigured(): self.ui.proxyHost.setText(self.preferences.proxyHost()) self.ui.proxyPort.setText(str(self.preferences.proxyPort())) def fillDaysToKeepFeedEntries(self): days = self.preferences.daysToKeepFeedEntries() self.ui.daysToKeepFeedEntries.setText(str(days)) def startMaximizedChanged(self, change): if change: self.preferences.setStartMaximized(True) else: self.preferences.setStartMaximized(False) def hideReadFeedEntriesChanged(self, change): if change: self.preferences.setHideReadFeedEntries(True) else: self.preferences.setHideReadFeedEntries(False) def showOnlyFeedsWithUnreadEntries(self, change): if change: self.preferences.setShowOnlyUnreadFeeds(True) else: self.preferences.setShowOnlyUnreadFeeds(False) def storeProxySettings(self): proxyHost = self.ui.proxyHost.text() if proxyHost.isEmpty(): proxyHost = None self.preferences.setProxyHost(proxyHost) proxyPort = self.ui.proxyPort.text() if proxyPort.isEmpty(): proxyPort = None self.preferences.setProxyPort(proxyPort) def daysToKeepFeedEntriesFinishedEditing(self): text = self.ui.daysToKeepFeedEntries.text() if not text.isEmpty(): text = str(text) self.preferences.setDaysToKeepFeedEntries(text) def accept(self): self.storeProxySettings() self.preferences.commit(); QtGui.QDialog.accept(self) def reject(self): self.preferences.rollback() QtGui.QDialog.reject(self)