Mercurial > hg > Feedworm
comparison DisplayModel.py @ 148:c5a427d46703
displaying entries for a feed works now with the couchdb backend
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Fri, 26 Aug 2011 06:13:39 +0200 |
parents | 04a730f9d07d |
children | bb3c851b18b1 |
comparison
equal
deleted
inserted
replaced
147:b290e29a94b5 | 148:c5a427d46703 |
---|---|
11 return len(self.list) | 11 return len(self.list) |
12 | 12 |
13 def data(self, index, role): | 13 def data(self, index, role): |
14 if index.isValid() and role == Qt.DisplayRole: | 14 if index.isValid() and role == Qt.DisplayRole: |
15 row = index.row() | 15 row = index.row() |
16 object = self.list[row] | 16 item = self.list[row] |
17 displayString = self._stringToDisplay(object) | 17 displayString = self._stringToDisplay(item) |
18 return QVariant(displayString) | 18 return QVariant(displayString) |
19 else: | 19 else: |
20 return QVariant() | 20 return QVariant() |
21 | 21 |
22 def _stringToDisplay(self, object): | 22 def _stringToDisplay(self, item): |
23 if hasattr(object, self.displayAttribute): | 23 if hasattr(item, self.displayAttribute): |
24 return getattr(object, self.displayAttribute) | 24 return getattr(item, self.displayAttribute) |
25 else: | 25 else: |
26 return "invalid display attribute: " + self.displayAttribute | 26 return "invalid display attribute: " + self.displayAttribute |