[qcineoob] miniperson and minimovie thumbnail on demand, still slow

This commit is contained in:
Julien Veyssier 2013-03-13 00:57:25 +01:00
commit b906c3300a
2 changed files with 18 additions and 10 deletions

View file

@ -39,7 +39,8 @@ class MiniMovie(QFrame):
self.ui.shortDescLabel.setText(movie.short_description) self.ui.shortDescLabel.setText(movie.short_description)
self.ui.backendLabel.setText(backend.name) 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: if self.movie.thumbnail_url != NotAvailable:
data = urllib.urlopen(self.movie.thumbnail_url).read() data = urllib.urlopen(self.movie.thumbnail_url).read()
img = QImage.fromData(data) img = QImage.fromData(data)
@ -56,7 +57,10 @@ class MiniMovie(QFrame):
def mousePressEvent(self, event): def mousePressEvent(self, event):
QFrame.mousePressEvent(self, event) QFrame.mousePressEvent(self, event)
QApplication.setOverrideCursor( Qt.WaitCursor ) if event.button() == 2:
movie = self.backend.get_movie(self.movie.id) self.gotThumbnail()
if movie: else:
self.parent.doAction('Details of movie "%s"'%movie.original_title,self.parent.displayMovie,[movie]) 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])

View file

@ -45,7 +45,8 @@ class MiniPerson(QFrame):
self.ui.shortDescLabel.hide() self.ui.shortDescLabel.hide()
self.ui.backendLabel.setText(backend.name) 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: if self.person.thumbnail_url != NotAvailable:
data = urllib.urlopen(self.person.thumbnail_url).read() data = urllib.urlopen(self.person.thumbnail_url).read()
img = QImage.fromData(data) img = QImage.fromData(data)
@ -62,7 +63,10 @@ class MiniPerson(QFrame):
def mousePressEvent(self, event): def mousePressEvent(self, event):
QFrame.mousePressEvent(self, event) QFrame.mousePressEvent(self, event)
QApplication.setOverrideCursor( Qt.WaitCursor ) if event.button() == 2:
person = self.backend.get_person(self.person.id) self.gotThumbnail()
if person: else:
self.parent.doAction(u'Details of person "%s"'%person.name,self.parent.displayPerson,[person]) 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])