Mercurial > hg > Feedworm
view backend/couchdb/Preferences.py @ 156:2d159eb2a91b
displaying the preferences dialog works, saving prefs doesn't yet
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 27 Aug 2011 10:17:07 +0200 |
parents | 8ec20377bcb0 |
children | e8bb107a74e1 |
line wrap: on
line source
class Preferences(object): def __init__(self, database): self.database = database self.viewResults = self.database.view("feedtest/preference_by_key") def _valueForKey(self, key): try: resultsForKey = self.viewResults[key] row = iter(resultsForKey).next() return row.value["value"] except StopIteration: return None def _booleanValueForKey(self, key): value = self._valueForKey(key) if value is None: return False else: return value def isProxyConfigured(self): return self.proxyHost() is not None def proxyHost(self): return self._valueForKey("proxyHost") def proxyPort(self): return self._valueForKey("proxyPort") def showOnlyUnreadFeeds(self): return self._booleanValueForKey("showOnlyUnreadFeeds") def startMaximized(self): return self._booleanValueForKey("startMaximized") def hideReadFeedEntries(self): return self._booleanValueForKey("hideReadFeedEntries") def daysToKeepFeedEntries(self): days = self._valueForKey("daysToKeepFeedEntries") if days is not None: return days else: return 60 def rollback(self): # this method does nothing pass