view backend/couchdb/Preferences.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 8ec20377bcb0
children 2d159eb2a91b
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 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._valueForKey("showOnlyUnreadFeeds")

    def startMaximized(self):
        return self._valueForKey("startMaximized")

    def hideReadFeedEntries(self):
        return self._valueForKey("hideReadFeedEntries")