From b906c3300a510b741c1e2c5db624851a66c201a0 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Wed, 13 Mar 2013 00:57:25 +0100 Subject: [PATCH] [qcineoob] miniperson and minimovie thumbnail on demand, still slow --- weboob/applications/qcineoob/minimovie.py | 14 +++++++++----- weboob/applications/qcineoob/miniperson.py | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/weboob/applications/qcineoob/minimovie.py b/weboob/applications/qcineoob/minimovie.py index f7011e03..b5db934c 100644 --- a/weboob/applications/qcineoob/minimovie.py +++ b/weboob/applications/qcineoob/minimovie.py @@ -39,7 +39,8 @@ class MiniMovie(QFrame): self.ui.shortDescLabel.setText(movie.short_description) self.ui.backendLabel.setText(backend.name) - def gotThumbnail(self, backend, movie): + def gotThumbnail(self): + self.backend.fill_movie(self.movie,('thumbnail_url')) if self.movie.thumbnail_url != NotAvailable: data = urllib.urlopen(self.movie.thumbnail_url).read() img = QImage.fromData(data) @@ -56,7 +57,10 @@ class MiniMovie(QFrame): def mousePressEvent(self, event): QFrame.mousePressEvent(self, event) - QApplication.setOverrideCursor( Qt.WaitCursor ) - movie = self.backend.get_movie(self.movie.id) - if movie: - self.parent.doAction('Details of movie "%s"'%movie.original_title,self.parent.displayMovie,[movie]) + if event.button() == 2: + self.gotThumbnail() + else: + QApplication.setOverrideCursor( Qt.WaitCursor ) + movie = self.backend.get_movie(self.movie.id) + if movie: + self.parent.doAction('Details of movie "%s"'%movie.original_title,self.parent.displayMovie,[movie]) diff --git a/weboob/applications/qcineoob/miniperson.py b/weboob/applications/qcineoob/miniperson.py index 9937d25c..63bb1d2e 100644 --- a/weboob/applications/qcineoob/miniperson.py +++ b/weboob/applications/qcineoob/miniperson.py @@ -45,7 +45,8 @@ class MiniPerson(QFrame): self.ui.shortDescLabel.hide() self.ui.backendLabel.setText(backend.name) - def gotThumbnail(self, backend, person): + def gotThumbnail(self): + self.backend.fill_person(self.person,('thumbnail_url')) if self.person.thumbnail_url != NotAvailable: data = urllib.urlopen(self.person.thumbnail_url).read() img = QImage.fromData(data) @@ -62,7 +63,10 @@ class MiniPerson(QFrame): def mousePressEvent(self, event): QFrame.mousePressEvent(self, event) - QApplication.setOverrideCursor( Qt.WaitCursor ) - person = self.backend.get_person(self.person.id) - if person: - self.parent.doAction(u'Details of person "%s"'%person.name,self.parent.displayPerson,[person]) + if event.button() == 2: + self.gotThumbnail() + else: + QApplication.setOverrideCursor( Qt.WaitCursor ) + person = self.backend.get_person(self.person.id) + if person: + self.parent.doAction(u'Details of person "%s"'%person.name,self.parent.displayPerson,[person])