Mercurial > hg > Feedworm
diff Feed.py @ 61:db35ab7753f0
add a preference to hide read feed entries
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 24 Jul 2010 03:11:06 +0200 |
parents | daa2731967fe |
children | d292ab61ed6f |
line wrap: on
line diff
--- a/Feed.py Fri Jul 23 17:41:05 2010 +0200 +++ b/Feed.py Sat Jul 24 03:11:06 2010 +0200 @@ -21,11 +21,20 @@ def userPresentableString(self): return self.title - def entriesSortedByUpdateDate(self): + def entriesSortedByUpdateDate(self, hideReadEntries=False): sortedEntries = list(self.entries) sortedEntries.sort(FeedEntry.compareByUpdateDate) + if hideReadEntries: + return self._filterReadEntries(sortedEntries) return sortedEntries + def _filterReadEntries(self, entries): + retValue = [] + for entry in entries: + if not entry.read: + retValue.append(entry) + return retValue + def incrementNextUpdateDate(self): delta = timedelta(minutes=self.update_interval) self.next_update = datetime.now() + delta