# HG changeset patch # User Dirk Olmes # Date 1272416411 -7200 # Node ID 3ffecc709da9ff0d700d58a458329474ed16b733 # Parent b1aeb98824c13496c52cfb47dd5a4a61633aa788 move fetch logic into Feed diff -r b1aeb98824c1 -r 3ffecc709da9 Feed.py --- a/Feed.py Wed Apr 28 02:57:41 2010 +0200 +++ b/Feed.py Wed Apr 28 03:00:11 2010 +0200 @@ -1,5 +1,9 @@ class Feed(object): + @staticmethod + def all(session): + return session.query(Feed).order_by(Feed.title).all() + def __init__(self, title, rss_url): self.title = title self.rss_url = rss_url diff -r b1aeb98824c1 -r 3ffecc709da9 MainWindowController.py --- a/MainWindowController.py Wed Apr 28 02:57:41 2010 +0200 +++ b/MainWindowController.py Wed Apr 28 03:00:11 2010 +0200 @@ -23,11 +23,8 @@ def __init__(self, parent=None, **args): QAbstractListModel.__init__(self, parent, *args) self.session = parent.session - self.fetchAllFeeds() - - def fetchAllFeeds(self): - self.allFeeds = self.session.query(Feed).all() - + self.allFeeds = Feed.all(parent.session) + def rowCount(self, parent=QModelIndex()): return len(self.allFeeds)