From d8d9eaef60bf7225a9f8dd320a96a2daef7e05d9 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sun, 19 Feb 2012 10:57:27 +0100 Subject: [PATCH] new housings on top --- weboob/applications/qflatboob/main_window.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/weboob/applications/qflatboob/main_window.py b/weboob/applications/qflatboob/main_window.py index 90cebe24..1bab0620 100644 --- a/weboob/applications/qflatboob/main_window.py +++ b/weboob/applications/qflatboob/main_window.py @@ -32,10 +32,11 @@ class HousingListWidgetItem(QListWidgetItem): def __init__(self, housing, *args, **kwargs): QListWidgetItem.__init__(self, *args, **kwargs) self.housing = housing + self.read = False def __lt__(self, other): - return (float(self.housing.cost) / float(self.housing.area)) < \ - (float(other.housing.cost) / float(other.housing.area)) + return '%s%s' % (self.read, float(self.housing.cost) / float(self.housing.area)) < \ + '%s%s' % (other.read, float(other.housing.cost) / float(other.housing.area)) def setAttrs(self, storage): text = u'

%s

' % self.housing.title @@ -45,10 +46,13 @@ class HousingListWidgetItem(QListWidgetItem): text += u'
%s' % storage.get('notes', self.housing.fullid, default='') self.setText(text) - if self.housing.fullid in storage.get('bookmarks'): - self.setBackground(QBrush(QColor(255, 224, 219))) - elif not self.housing.fullid in storage.get('read'): + if not self.housing.fullid in storage.get('read'): self.setBackground(QBrush(QColor(219, 224, 255))) + self.read = False + else: + self.read = True + if self.housing.fullid in storage.get('bookmarks'): + self.setBackground(QBrush(QColor(255, 224, 219))) class MainWindow(QtMainWindow): def __init__(self, config, storage, weboob, parent=None):