Mercurial > hg > Feedworm
view Preferences.py @ 77:d292ab61ed6f
Add another setting to feed: when opening a feed entry in browser, you can force opening it in an external browser now. This is because some sites just crash the QWebView.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 14 Aug 2010 02:53:49 +0200 |
parents | e8c2730eb444 |
children | b8bfd1bd6c55 |
line wrap: on
line source
from Preference import Preference import util START_MAXIMIZED = "START_MAXIMIZED" HIDE_READ_ENTRIES = "HIDE_READ_FEED_ENTRIES" SHOW_ONLY_UNREAD_FEEDS = "SHOW_ONLY_UNREAD_FEEDS" class Preferences(object): def __init__(self, session): self.session = session self.cache = {} def _cachedPreference(self, key, defaultValue=None): if self.cache.has_key(key): return self.cache[key] else: pref = Preference.forKey(key, self.session) if pref is None: pref = Preference(key, str(defaultValue)) self.session.add(pref) self.cache[key] = pref return pref def startMaximized(self): pref = self._cachedPreference(START_MAXIMIZED, False) return util.str2bool(pref.value) def setStartMaximized(self, flag): pref = self._cachedPreference(START_MAXIMIZED) pref.value = util.bool2str(flag) def hideReadFeedEntries(self): pref = self._cachedPreference(HIDE_READ_ENTRIES, False) return util.str2bool(pref.value) def setHideReadFeedEntries(self, flag): pref = self._cachedPreference(HIDE_READ_ENTRIES) pref.value = util.bool2str(flag) def showOnlyUnreadFeeds(self): pref = self._cachedPreference(SHOW_ONLY_UNREAD_FEEDS, False) return util.str2bool(pref.value) def setShowOnlyUnreadFeeds(self, flag): pref = self._cachedPreference(SHOW_ONLY_UNREAD_FEEDS) pref.value = util.bool2str(flag)