Mercurial > hg > Feedworm
comparison MainWindowController.py @ 16:3ffecc709da9
move fetch logic into Feed
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Wed, 28 Apr 2010 03:00:11 +0200 |
parents | b1aeb98824c1 |
children | 5fda8bd94fa8 |
comparison
equal
deleted
inserted
replaced
15:b1aeb98824c1 | 16:3ffecc709da9 |
---|---|
21 | 21 |
22 class FeedModel(QAbstractListModel): | 22 class FeedModel(QAbstractListModel): |
23 def __init__(self, parent=None, **args): | 23 def __init__(self, parent=None, **args): |
24 QAbstractListModel.__init__(self, parent, *args) | 24 QAbstractListModel.__init__(self, parent, *args) |
25 self.session = parent.session | 25 self.session = parent.session |
26 self.fetchAllFeeds() | 26 self.allFeeds = Feed.all(parent.session) |
27 | 27 |
28 def fetchAllFeeds(self): | |
29 self.allFeeds = self.session.query(Feed).all() | |
30 | |
31 def rowCount(self, parent=QModelIndex()): | 28 def rowCount(self, parent=QModelIndex()): |
32 return len(self.allFeeds) | 29 return len(self.allFeeds) |
33 | 30 |
34 def data(self, index, role): | 31 def data(self, index, role): |
35 if index.isValid() and role == Qt.DisplayRole: | 32 if index.isValid() and role == Qt.DisplayRole: |