From e2ac58ae4f1674a6bac321a5b80f74b5cc29bb8c Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Mon, 11 Mar 2013 16:33:46 +0100 Subject: [PATCH] [qcineoob] info person and info movie --- weboob/applications/qcineoob/main_window.py | 16 +- weboob/applications/qcineoob/movie.py | 26 +- weboob/applications/qcineoob/person.py | 22 +- .../applications/qcineoob/ui/main_window.ui | 80 +++-- weboob/applications/qcineoob/ui/movie.ui | 273 ++++++++++++++++-- weboob/applications/qcineoob/ui/person.ui | 176 +++++++++-- 6 files changed, 508 insertions(+), 85 deletions(-) diff --git a/weboob/applications/qcineoob/main_window.py b/weboob/applications/qcineoob/main_window.py index 1b154885..0fbc2b74 100644 --- a/weboob/applications/qcineoob/main_window.py +++ b/weboob/applications/qcineoob/main_window.py @@ -107,7 +107,7 @@ class MainWindow(QtMainWindow): def searchMovieAction(self,pattern): self.ui.stackedWidget.setCurrentWidget(self.ui.movie_list_page) for minimovie in self.minimovies: - self.ui.movie_list_page.layout().removeWidget(minimovie) + self.ui.movie_list_content.layout().removeWidget(minimovie) minimovie.hide() minimovie.deleteLater() @@ -125,17 +125,17 @@ class MainWindow(QtMainWindow): self.process = None return minimovie = MiniMovie(self.weboob, backend, movie, self) - self.ui.scrollAreaContent.layout().addWidget(minimovie) + self.ui.movie_list_content.layout().addWidget(minimovie) self.minimovies.append(minimovie) def displayMovie(self, movie): self.ui.stackedWidget.setCurrentWidget(self.ui.movie_info_page) if self.current_movie_widget != None: - self.ui.movie_info_page.layout().removeWidget(self.current_movie_widget) + self.ui.movie_info_content.layout().removeWidget(self.current_movie_widget) self.current_movie_widget.hide() self.current_movie_widget.deleteLater() wmovie = Movie(movie,self) - self.ui.movie_info_page.layout().addWidget(wmovie) + self.ui.movie_info_content.layout().addWidget(wmovie) self.current_movie_widget = wmovie def searchPerson(self): @@ -147,7 +147,7 @@ class MainWindow(QtMainWindow): def searchPersonAction(self,pattern): self.ui.stackedWidget.setCurrentWidget(self.ui.person_list_page) for miniperson in self.minipersons: - self.ui.person_list_page.layout().removeWidget(miniperson) + self.ui.person_list_content.layout().removeWidget(miniperson) miniperson.hide() miniperson.deleteLater() @@ -165,17 +165,17 @@ class MainWindow(QtMainWindow): self.process = None return miniperson = MiniPerson(self.weboob, backend, person, self) - self.ui.scrollAreaContent_2.layout().addWidget(miniperson) + self.ui.person_list_content.layout().addWidget(miniperson) self.minipersons.append(miniperson) def displayPerson(self, person): self.ui.stackedWidget.setCurrentWidget(self.ui.person_info_page) if self.current_person_widget != None: - self.ui.person_info_page.layout().removeWidget(self.current_person_widget) + self.ui.person_info_content.layout().removeWidget(self.current_person_widget) self.current_person_widget.hide() self.current_person_widget.deleteLater() wperson = Person(person,self) - self.ui.person_info_page.layout().addWidget(wperson) + self.ui.person_info_content.layout().addWidget(wperson) self.current_person_widget = wperson def closeEvent(self, ev): diff --git a/weboob/applications/qcineoob/movie.py b/weboob/applications/qcineoob/movie.py index 806cb880..8d1bb8fc 100644 --- a/weboob/applications/qcineoob/movie.py +++ b/weboob/applications/qcineoob/movie.py @@ -17,12 +17,13 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . +import urllib -from PyQt4.QtCore import QUrl -from PyQt4.QtGui import QFrame -from PyQt4.phonon import Phonon +from PyQt4.QtCore import QUrl,Qt +from PyQt4.QtGui import QFrame, QImage, QPixmap from weboob.applications.qcineoob.ui.movie_ui import Ui_Movie +from weboob.capabilities.base import NotAvailable, NotLoaded class Movie(QFrame): def __init__(self, movie, parent=None): @@ -34,3 +35,22 @@ class Movie(QFrame): self.movie = movie self.ui.titleLabel.setText(movie.original_title) self.ui.durationLabel.setText(unicode(movie.duration)) + self.gotThumbnail() + + if movie.other_titles != NotAvailable: + self.ui.otherTitlesPlain.setPlainText('\n'.join(movie.other_titles)) + if movie.release_date != NotAvailable: + self.ui.releaseDateLabel.setText(movie.release_date.isoformat()) + self.ui.durationLabel.setText('%s'%movie.duration) + self.ui.pitchPlain.setPlainText('%s'%movie.pitch) + self.ui.countryLabel.setText('%s'%movie.country) + self.ui.noteLabel.setText('%s'%movie.note) + + self.ui.verticalLayout.setAlignment(Qt.AlignTop) + + def gotThumbnail(self): + 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)) + diff --git a/weboob/applications/qcineoob/person.py b/weboob/applications/qcineoob/person.py index 3a03b5f5..a6b4c36e 100644 --- a/weboob/applications/qcineoob/person.py +++ b/weboob/applications/qcineoob/person.py @@ -17,12 +17,13 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . +import urllib from PyQt4.QtCore import QUrl -from PyQt4.QtGui import QFrame -from PyQt4.phonon import Phonon +from PyQt4.QtGui import QFrame, QImage, QPixmap from weboob.applications.qcineoob.ui.person_ui import Ui_Person +from weboob.capabilities.base import NotAvailable, NotLoaded class Person(QFrame): def __init__(self, person, parent=None): @@ -32,5 +33,20 @@ class Person(QFrame): self.ui.setupUi(self) self.person = person + self.gotThumbnail() self.ui.nameLabel.setText(person.name) - self.ui.birthdateLabel.setText(person.birth_date.isoformat()) + + self.ui.realNameLabel.setText('%s'%person.real_name) + self.ui.birthPlaceLabel.setText('%s'%person.birth_place) + self.ui.birthDateLabel.setText(person.birth_date.isoformat()) + if person.death_date != NotAvailable: + self.ui.deathDateLabel.setText(person.death_date.isoformat()) + else: + self.ui.deathDateLabel.parent().hide() + self.ui.shortBioPlain.setPlainText('%s'%person.short_biography) + + def gotThumbnail(self): + 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)) diff --git a/weboob/applications/qcineoob/ui/main_window.ui b/weboob/applications/qcineoob/ui/main_window.ui index 284942a3..a1a211ba 100644 --- a/weboob/applications/qcineoob/ui/main_window.ui +++ b/weboob/applications/qcineoob/ui/main_window.ui @@ -79,13 +79,10 @@ - - - true - + 0 @@ -94,56 +91,77 @@ 313 - - - 0 - - - 0 - - + - - - - + - - - true - + 0 0 - 78 - 16 + 542 + 313 - - - 0 - - - 0 - - + + + + + + + + + + + + true + + + + + 0 + 0 + 542 + 313 + + + - + + + + + true + + + + + 0 + 0 + 542 + 313 + + + + + + + diff --git a/weboob/applications/qcineoob/ui/movie.ui b/weboob/applications/qcineoob/ui/movie.ui index 066f792b..ba3775fa 100644 --- a/weboob/applications/qcineoob/ui/movie.ui +++ b/weboob/applications/qcineoob/ui/movie.ui @@ -6,10 +6,22 @@ 0 0 - 857 - 629 + 428 + 490 + + + 0 + 0 + + + + + 2000 + 600 + + Frame @@ -19,25 +31,24 @@ QFrame::Raised - + - + + + + 16777215 + 3000 + + QFrame::StyledPanel QFrame::Raised - + - - - Title: - - - - - + @@ -47,26 +58,246 @@ - + + + + 16777215 + 600 + + QFrame::StyledPanel QFrame::Raised - + - - - Duration: + + + + 16777215 + 35 + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Title: + + + + + + + + + + + - - - + + + + 0 + 0 + + + + 16777215 + 200 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 100 + 16777215 + + + + Other titles: + + + + + + + + + + + + + + 16777215 + 35 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Duration: + + + + + + + + + + + + + + + + + + 16777215 + 35 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Release date: + + + + + + + + + + + + + + + + + + 16777215 + 200 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Pitch: + + + + + + + + + + + + + + 16777215 + 35 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Country: + + + + + + + + + + + + + + + + + + 16777215 + 35 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Note: + + + + + + + + + + + diff --git a/weboob/applications/qcineoob/ui/person.ui b/weboob/applications/qcineoob/ui/person.ui index 75272628..f1661c08 100644 --- a/weboob/applications/qcineoob/ui/person.ui +++ b/weboob/applications/qcineoob/ui/person.ui @@ -19,25 +19,18 @@ QFrame::Raised - + - + QFrame::StyledPanel QFrame::Raised - + - - - name: - - - - - + @@ -47,26 +40,171 @@ - + QFrame::StyledPanel QFrame::Raised - + - - - Birth date: + + + QFrame::StyledPanel + + QFrame::Raised + + + + + + name: + + + + + + + + + + + - - - + + + QFrame::StyledPanel + + QFrame::Raised + + + + + + Birth date: + + + + + + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Real Name: + + + + + + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Birth place: + + + + + + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Death date: + + + + + + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Short biography: + + + + + + + + 16777215 + 100 + + + + +