def __lt__(self, other): column=self.treeWidget().sortColumn() if column==1: return self.feed.unreadCount()<other.feed.unreadCount() else: # if not self.feed.xmlUrl and other.feed.xmlUrl: # return True return normalizar(self.feed.text.lower())<normalizar(other.feed.text.lower())
def getChildren(self, order_by='-text'): # Always should use this accesor, so metafolders work transparently if order_by[0] == '-': mul = -1 order_by = order_by[1:] else: mul = 1 if order_by == 'text': _cmp = lambda x, y: mul * cmp(normalizar(x.text.lower()), normalizar(y.text.lower())) elif order_by == 'unreadCount': _cmp = lambda x, y: mul * cmp(x.unreadCount(), y.unreadCount()) self.children.sort(cmp=_cmp) return self.children