[qcineoob] thumbnail for person and movie
This commit is contained in:
parent
7a917e879c
commit
d874a3087a
8 changed files with 41 additions and 144 deletions
|
|
@ -17,11 +17,13 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import urllib
|
||||
|
||||
from PyQt4.QtGui import QFrame, QImage, QPixmap
|
||||
|
||||
from weboob.tools.application.qt import QtDo
|
||||
from weboob.applications.qcineoob.ui.minimovie_ui import Ui_MiniMovie
|
||||
from weboob.capabilities.base import NotAvailable, NotLoaded
|
||||
|
||||
class MiniMovie(QFrame):
|
||||
def __init__(self, weboob, backend, movie, parent=None):
|
||||
|
|
@ -34,17 +36,16 @@ class MiniMovie(QFrame):
|
|||
self.backend = backend
|
||||
self.movie = movie
|
||||
self.ui.titleLabel.setText(movie.original_title)
|
||||
self.ui.shortDescLabel.setText(movie.short_description)
|
||||
self.ui.backendLabel.setText(backend.name)
|
||||
|
||||
#self.process_thumbnail = QtDo(self.weboob, self.gotThumbnail)
|
||||
#self.process_thumbnail.do('fillobj', self.movie, ['thumbnail_url'], backends=backend)
|
||||
self.process_thumbnail = QtDo(self.weboob, self.gotThumbnail)
|
||||
self.process_thumbnail.do('fillobj', self.movie, ['thumbnail_url'], backends=backend)
|
||||
|
||||
def gotThumbnail(self, backend, movie):
|
||||
if not backend:
|
||||
return
|
||||
|
||||
if movie.thumbnail_url:
|
||||
img = QImage.fromData(movie.thumbnail.data)
|
||||
if self.movie.thumbnail_url != NotAvailable:
|
||||
data = urllib.urlopen(self.movie.thumbnail_url).read()
|
||||
img = QImage.fromData(data)
|
||||
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img))
|
||||
|
||||
def enterEvent(self, event):
|
||||
|
|
|
|||
|
|
@ -17,11 +17,13 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import urllib
|
||||
|
||||
from PyQt4.QtGui import QFrame, QImage, QPixmap
|
||||
|
||||
from weboob.tools.application.qt import QtDo
|
||||
from weboob.applications.qcineoob.ui.miniperson_ui import Ui_MiniPerson
|
||||
from weboob.capabilities.base import NotAvailable, NotLoaded
|
||||
|
||||
class MiniPerson(QFrame):
|
||||
def __init__(self, weboob, backend, person, parent=None):
|
||||
|
|
@ -34,18 +36,16 @@ class MiniPerson(QFrame):
|
|||
self.backend = backend
|
||||
self.person = person
|
||||
self.ui.nameLabel.setText(person.name)
|
||||
#self.ui.birthdateLabel.setText(person.birth_date)
|
||||
self.ui.shortDescLabel.setText(person.short_description)
|
||||
self.ui.backendLabel.setText(backend.name)
|
||||
|
||||
#self.process_thumbnail = QtDo(self.weboob, self.gotThumbnail)
|
||||
#self.process_thumbnail.do('fillobj', self.person, ['thumbnail_url'], backends=backend)
|
||||
self.process_thumbnail = QtDo(self.weboob, self.gotThumbnail)
|
||||
self.process_thumbnail.do('fillobj', self.person, ['thumbnail_url'], backends=backend)
|
||||
|
||||
def gotThumbnail(self, backend, person):
|
||||
if not backend:
|
||||
return
|
||||
|
||||
if person.thumbnail_url:
|
||||
img = QImage.fromData(person.thumbnail.data)
|
||||
if self.person.thumbnail_url != NotAvailable:
|
||||
data = urllib.urlopen(self.person.thumbnail_url).read()
|
||||
img = QImage.fromData(data)
|
||||
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img))
|
||||
|
||||
def enterEvent(self, event):
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>464</width>
|
||||
<height>132</height>
|
||||
<height>136</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -89,78 +89,18 @@
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Duration</string>
|
||||
<string>Short description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="durationLabel">
|
||||
<widget class="QLabel" name="shortDescLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Author</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="authorLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rating</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="ratingLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
|
|
@ -173,7 +113,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="backendLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
|
|
|
|||
|
|
@ -89,78 +89,18 @@
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Duration</string>
|
||||
<string>Short description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="durationLabel">
|
||||
<widget class="QLabel" name="shortDescLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Author</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="authorLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rating</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="ratingLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
|
|
@ -173,7 +113,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="backendLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class Person(CapBaseObject):
|
|||
biography = StringField('Full biography of a person')
|
||||
short_description= StringField('Short description of a person')
|
||||
roles = Field('Lists of movies related to the person indexed by roles',dict)
|
||||
thumbnail_url = StringField('Url of person thumbnail')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue