diff --git a/scripts/qvideoob b/scripts/qvideoob new file mode 100755 index 0000000000000000000000000000000000000000..de5268135436dd36c59880cd30f9b8d532d3ddb4 --- /dev/null +++ b/scripts/qvideoob @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai + +""" +Copyright(C) 2010 Romain Bignon + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 3 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +""" + +from weboob.frontends.qvideoob import QVideoob + +if __name__ == '__main__': + QVideoob.run() diff --git a/weboob/frontends/qvideoob/Makefile b/weboob/frontends/qvideoob/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..04c08812be91e4241c329054ab9ba1f0eff2da7c --- /dev/null +++ b/weboob/frontends/qvideoob/Makefile @@ -0,0 +1,5 @@ +all: + $(MAKE) -C ui + +clean: + $(MAKE) -C ui clean diff --git a/weboob/frontends/qvideoob/__init__.py b/weboob/frontends/qvideoob/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b36fc3d7dae07d96f54a50d51c9701972df272dd --- /dev/null +++ b/weboob/frontends/qvideoob/__init__.py @@ -0,0 +1 @@ +from .application import QVideoob diff --git a/weboob/frontends/qvideoob/application.py b/weboob/frontends/qvideoob/application.py new file mode 100644 index 0000000000000000000000000000000000000000..8d1bc2a405fd4a0437acb985025478c6c95f3cd3 --- /dev/null +++ b/weboob/frontends/qvideoob/application.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +""" +Copyright(C) 2010 Romain Bignon + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 3 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +""" + +from weboob.capabilities.video import ICapVideoProvider +from weboob.tools.application import QtApplication + +from .main_window import MainWindow + +class QVideoob(QtApplication): + def main(self, argv): + self.weboob.load_backends(ICapVideoProvider) + + self.main_window = MainWindow(self.weboob) + self.main_window.show() + return self.weboob.loop() diff --git a/weboob/frontends/qvideoob/main_window.py b/weboob/frontends/qvideoob/main_window.py new file mode 100644 index 0000000000000000000000000000000000000000..7266084a04657fef3e100d7bb8214c4f6f0b03de --- /dev/null +++ b/weboob/frontends/qvideoob/main_window.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- + +""" +Copyright(C) 2010 Romain Bignon + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 3 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +""" + +from PyQt4.QtCore import SIGNAL + +from weboob.capabilities.video import ICapVideoProvider +from weboob.tools.application.qt import QtMainWindow + +from weboob.frontends.qvideoob.ui.main_window_ui import Ui_MainWindow + +from .video import Video +from .minivideo import MiniVideo + +class MainWindow(QtMainWindow): + def __init__(self, weboob, parent=None): + QtMainWindow.__init__(self, parent) + self.ui = Ui_MainWindow() + self.ui.setupUi(self) + + self.weboob = weboob + self.minivideos = [] + + self.connect(self.ui.searchEdit, SIGNAL("returnPressed()"), self.search) + self.connect(self.ui.urlEdit, SIGNAL("returnPressed()"), self.openURL) + + def search(self): + pattern = unicode(self.ui.searchEdit.text()) + if not pattern: + return + + for minivideo in self.minivideos: + self.ui.scrollAreaContent.layout.removeWidget(minivideo) + + self.minivideos = [] + + for backend in self.weboob.iter_backends(): + for video in backend.iter_search_results(pattern): + minivideo = MiniVideo(video) + self.ui.scrollAreaContent.layout().addWidget(minivideo) + self.minivideos.append(minivideo) + + def openURL(self): + url = unicode(self.ui.urlEdit.text()) + if not url: + return + + for backend in self.weboob.iter_backends(): + video = backend.get_video(url) + if video: + video_widget = Video(video, self) + video_widget.show() + + self.ui.urlEdit.clear() + + diff --git a/weboob/frontends/qvideoob/minivideo.py b/weboob/frontends/qvideoob/minivideo.py new file mode 100644 index 0000000000000000000000000000000000000000..600a1444ff8276e0271f7dc4e21b06f0ed0628ff --- /dev/null +++ b/weboob/frontends/qvideoob/minivideo.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- + +""" +Copyright(C) 2010 Romain Bignon + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 3 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +""" + +import urllib2 +from PyQt4.QtGui import QFrame, QImage, QPixmap + +from weboob.frontends.qvideoob.ui.minivideo_ui import Ui_MiniVideo + +class MiniVideo(QFrame): + def __init__(self, video, parent=None): + QFrame.__init__(self, parent) + self.ui = Ui_MiniVideo() + self.ui.setupUi(self) + + self.video = video + self.ui.titleLabel.setText(video.title) + self.ui.durationLabel.setText('%d:%02d:%02d' % (video.duration/3600, (video.duration%3600)/60, video.duration%60)) + self.ui.authorLabel.setText(unicode(video.author)) + self.ui.dateLabel.setText(video.date and unicode(video.date) or '') + if video.rating_max: + self.ui.ratingLabel.setText('%s / %s' % (video.rating, video.rating_max)) + else: + self.ui.ratingLabel.setText('%s' % video.rating) + + if video.preview_url: + data = urllib2.urlopen(video.preview_url).read() + img = QImage.fromData(data) + self.ui.imageLabel.setPixmap(QPixmap.fromImage(img)) diff --git a/weboob/frontends/qvideoob/ui/Makefile b/weboob/frontends/qvideoob/ui/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..c1ee0ec0523e37bf49c87a1d599621f577a26e39 --- /dev/null +++ b/weboob/frontends/qvideoob/ui/Makefile @@ -0,0 +1,18 @@ +UI_FILES = $(wildcard *.ui) +UI_PY_FILES = $(UI_FILES:%.ui=%_ui.py) +PYUIC = pyuic4 + +all: $(UI_PY_FILES) + +%_ui.py: %.ui + $(PYUIC) -o $@ $^ + + # TODO: ugly hack, because of a usefull import by + # Qt in the nulog_ui.py file.. But we *don't* + # want to use a python resource file!! + sed -i '/import nulog3_rc/D' $@ + +clean: + rm -f *.pyc + rm -f $(UI_PY_FILES) + diff --git a/weboob/frontends/qvideoob/ui/__init__.py b/weboob/frontends/qvideoob/ui/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/weboob/frontends/qvideoob/ui/main_window.ui b/weboob/frontends/qvideoob/ui/main_window.ui new file mode 100644 index 0000000000000000000000000000000000000000..0de6d9dd31f084ee7f9ad2fd4afe17c97992dec8 --- /dev/null +++ b/weboob/frontends/qvideoob/ui/main_window.ui @@ -0,0 +1,104 @@ + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + QVideoob + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Search: + + + + + + + + + + + + + + + + true + + + + + 0 + 0 + 778 + 425 + + + + QWidget#scrollAreaContent { + background-color: rgb(255, 255, 255); +} + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + URL: + + + + + + + + + + + + + + + 0 + 0 + 800 + 25 + + + + + + + + diff --git a/weboob/frontends/qvideoob/ui/main_window_ui.py b/weboob/frontends/qvideoob/ui/main_window_ui.py new file mode 100644 index 0000000000000000000000000000000000000000..cdea1128309dfb33c5b1f13ece9b939fa0ace33f --- /dev/null +++ b/weboob/frontends/qvideoob/ui/main_window_ui.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'main_window.ui' +# +# Created: Sat Apr 17 10:42:00 2010 +# by: PyQt4 UI code generator 4.6 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(800, 600) + self.centralwidget = QtGui.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget) + self.verticalLayout.setObjectName("verticalLayout") + self.frame_2 = QtGui.QFrame(self.centralwidget) + self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel) + self.frame_2.setFrameShadow(QtGui.QFrame.Raised) + self.frame_2.setObjectName("frame_2") + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.frame_2) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.label = QtGui.QLabel(self.frame_2) + self.label.setObjectName("label") + self.horizontalLayout_2.addWidget(self.label) + self.searchEdit = QtGui.QLineEdit(self.frame_2) + self.searchEdit.setObjectName("searchEdit") + self.horizontalLayout_2.addWidget(self.searchEdit) + self.verticalLayout.addWidget(self.frame_2) + self.scrollArea = QtGui.QScrollArea(self.centralwidget) + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaContent = QtGui.QWidget(self.scrollArea) + self.scrollAreaContent.setGeometry(QtCore.QRect(0, 0, 778, 425)) + self.scrollAreaContent.setStyleSheet("""QWidget#scrollAreaContent { + background-color: rgb(255, 255, 255); +}""") + self.scrollAreaContent.setObjectName("scrollAreaContent") + self.verticalLayout_2 = QtGui.QVBoxLayout(self.scrollAreaContent) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.scrollArea.setWidget(self.scrollAreaContent) + self.verticalLayout.addWidget(self.scrollArea) + self.frame_3 = QtGui.QFrame(self.centralwidget) + self.frame_3.setFrameShape(QtGui.QFrame.StyledPanel) + self.frame_3.setFrameShadow(QtGui.QFrame.Raised) + self.frame_3.setObjectName("frame_3") + self.horizontalLayout = QtGui.QHBoxLayout(self.frame_3) + self.horizontalLayout.setObjectName("horizontalLayout") + self.label_2 = QtGui.QLabel(self.frame_3) + self.label_2.setObjectName("label_2") + self.horizontalLayout.addWidget(self.label_2) + self.urlEdit = QtGui.QLineEdit(self.frame_3) + self.urlEdit.setObjectName("urlEdit") + self.horizontalLayout.addWidget(self.urlEdit) + self.verticalLayout.addWidget(self.frame_3) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtGui.QMenuBar(MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 25)) + self.menubar.setObjectName("menubar") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtGui.QStatusBar(MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "QVideoob", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("MainWindow", "Search: ", None, QtGui.QApplication.UnicodeUTF8)) + self.label_2.setText(QtGui.QApplication.translate("MainWindow", "URL: ", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/weboob/frontends/qvideoob/ui/minivideo.ui b/weboob/frontends/qvideoob/ui/minivideo.ui new file mode 100644 index 0000000000000000000000000000000000000000..7fab8ee6717ea870f13fb72a9ea087392efe1ca4 --- /dev/null +++ b/weboob/frontends/qvideoob/ui/minivideo.ui @@ -0,0 +1,169 @@ + + + MiniVideo + + + + 0 + 0 + 464 + 111 + + + + Form + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 9 + + + 5 + + + 5 + + + + + + 0 + 0 + + + + + + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + + 75 + true + + + + Title + + + + + + + + 0 + 0 + + + + + 50 + true + false + + + + TextLabel + + + + + + + + 75 + true + + + + Duration + + + + + + + TextLabel + + + + + + + + 75 + true + + + + Author + + + + + + + TextLabel + + + + + + + + 75 + true + + + + Date + + + + + + + TextLabel + + + + + + + + 75 + true + + + + Rating + + + + + + + TextLabel + + + + + + + + + + diff --git a/weboob/frontends/qvideoob/ui/minivideo_ui.py b/weboob/frontends/qvideoob/ui/minivideo_ui.py new file mode 100644 index 0000000000000000000000000000000000000000..7722c64bf4f6b39b7bcb153805c6231c10c70aa5 --- /dev/null +++ b/weboob/frontends/qvideoob/ui/minivideo_ui.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'minivideo.ui' +# +# Created: Sat Apr 17 11:04:00 2010 +# by: PyQt4 UI code generator 4.6 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_MiniVideo(object): + def setupUi(self, MiniVideo): + MiniVideo.setObjectName("MiniVideo") + MiniVideo.resize(464, 111) + MiniVideo.setFrameShape(QtGui.QFrame.StyledPanel) + MiniVideo.setFrameShadow(QtGui.QFrame.Raised) + self.horizontalLayout = QtGui.QHBoxLayout(MiniVideo) + self.horizontalLayout.setContentsMargins(9, 5, -1, 5) + self.horizontalLayout.setObjectName("horizontalLayout") + self.imageLabel = QtGui.QLabel(MiniVideo) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.imageLabel.sizePolicy().hasHeightForWidth()) + self.imageLabel.setSizePolicy(sizePolicy) + self.imageLabel.setObjectName("imageLabel") + self.horizontalLayout.addWidget(self.imageLabel) + self.formLayout = QtGui.QFormLayout() + self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow) + self.formLayout.setObjectName("formLayout") + self.label_5 = QtGui.QLabel(MiniVideo) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_5.setFont(font) + self.label_5.setObjectName("label_5") + self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_5) + self.titleLabel = QtGui.QLabel(MiniVideo) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.titleLabel.sizePolicy().hasHeightForWidth()) + self.titleLabel.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setWeight(50) + font.setItalic(True) + font.setBold(False) + self.titleLabel.setFont(font) + self.titleLabel.setObjectName("titleLabel") + self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.titleLabel) + self.label_8 = QtGui.QLabel(MiniVideo) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_8.setFont(font) + self.label_8.setObjectName("label_8") + self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_8) + self.durationLabel = QtGui.QLabel(MiniVideo) + self.durationLabel.setObjectName("durationLabel") + self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.durationLabel) + self.label_4 = QtGui.QLabel(MiniVideo) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_4.setFont(font) + self.label_4.setObjectName("label_4") + self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label_4) + self.authorLabel = QtGui.QLabel(MiniVideo) + self.authorLabel.setObjectName("authorLabel") + self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.authorLabel) + self.label_2 = QtGui.QLabel(MiniVideo) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_2.setFont(font) + self.label_2.setObjectName("label_2") + self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_2) + self.dateLabel = QtGui.QLabel(MiniVideo) + self.dateLabel.setObjectName("dateLabel") + self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.dateLabel) + self.label_3 = QtGui.QLabel(MiniVideo) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_3.setFont(font) + self.label_3.setObjectName("label_3") + self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.label_3) + self.ratingLabel = QtGui.QLabel(MiniVideo) + self.ratingLabel.setObjectName("ratingLabel") + self.formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.ratingLabel) + self.horizontalLayout.addLayout(self.formLayout) + + self.retranslateUi(MiniVideo) + QtCore.QMetaObject.connectSlotsByName(MiniVideo) + + def retranslateUi(self, MiniVideo): + MiniVideo.setWindowTitle(QtGui.QApplication.translate("MiniVideo", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.label_5.setText(QtGui.QApplication.translate("MiniVideo", "Title", None, QtGui.QApplication.UnicodeUTF8)) + self.titleLabel.setText(QtGui.QApplication.translate("MiniVideo", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + self.label_8.setText(QtGui.QApplication.translate("MiniVideo", "Duration", None, QtGui.QApplication.UnicodeUTF8)) + self.durationLabel.setText(QtGui.QApplication.translate("MiniVideo", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + self.label_4.setText(QtGui.QApplication.translate("MiniVideo", "Author", None, QtGui.QApplication.UnicodeUTF8)) + self.authorLabel.setText(QtGui.QApplication.translate("MiniVideo", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + self.label_2.setText(QtGui.QApplication.translate("MiniVideo", "Date", None, QtGui.QApplication.UnicodeUTF8)) + self.dateLabel.setText(QtGui.QApplication.translate("MiniVideo", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("MiniVideo", "Rating", None, QtGui.QApplication.UnicodeUTF8)) + self.ratingLabel.setText(QtGui.QApplication.translate("MiniVideo", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/weboob/frontends/qvideoob/ui/video.ui b/weboob/frontends/qvideoob/ui/video.ui new file mode 100644 index 0000000000000000000000000000000000000000..58ab2b41ebeb8dd83bd4f5b238083e645a055a6d --- /dev/null +++ b/weboob/frontends/qvideoob/ui/video.ui @@ -0,0 +1,152 @@ + + + Video + + + + 0 + 0 + 647 + 404 + + + + Video + + + + + + + 12 + 75 + true + + + + QFrame::Box + + + QFrame::Raised + + + TextLabel + + + + + + + + 0 + 0 + + + + background-color: rgb(255, 255, 255); + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 75 + true + + + + Author + + + + + + + + 75 + true + + + + Date + + + + + + + + 75 + true + + + + Rating + + + + + + + TextLabel + + + + + + + TextLabel + + + + + + + TextLabel + + + + + + + TextLabel + + + + + + + + 75 + true + + + + Duration + + + + + + + + + + + diff --git a/weboob/frontends/qvideoob/ui/video_ui.py b/weboob/frontends/qvideoob/ui/video_ui.py new file mode 100644 index 0000000000000000000000000000000000000000..a32a5c3a965aa5091fff13a4abb423396941e4ff --- /dev/null +++ b/weboob/frontends/qvideoob/ui/video_ui.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'video.ui' +# +# Created: Sat Apr 17 10:11:11 2010 +# by: PyQt4 UI code generator 4.6 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_Video(object): + def setupUi(self, Video): + Video.setObjectName("Video") + Video.resize(647, 404) + self.verticalLayout = QtGui.QVBoxLayout(Video) + self.verticalLayout.setObjectName("verticalLayout") + self.titleLabel = QtGui.QLabel(Video) + font = QtGui.QFont() + font.setPointSize(12) + font.setWeight(75) + font.setBold(True) + self.titleLabel.setFont(font) + self.titleLabel.setFrameShape(QtGui.QFrame.Box) + self.titleLabel.setFrameShadow(QtGui.QFrame.Raised) + self.titleLabel.setObjectName("titleLabel") + self.verticalLayout.addWidget(self.titleLabel) + self.frame = QtGui.QFrame(Video) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.MinimumExpanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth()) + self.frame.setSizePolicy(sizePolicy) + self.frame.setStyleSheet("background-color: rgb(255, 255, 255);") + self.frame.setFrameShape(QtGui.QFrame.StyledPanel) + self.frame.setFrameShadow(QtGui.QFrame.Sunken) + self.frame.setObjectName("frame") + self.verticalLayout.addWidget(self.frame) + self.frame_2 = QtGui.QFrame(Video) + self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel) + self.frame_2.setFrameShadow(QtGui.QFrame.Raised) + self.frame_2.setObjectName("frame_2") + self.formLayout = QtGui.QFormLayout(self.frame_2) + self.formLayout.setObjectName("formLayout") + self.label = QtGui.QLabel(self.frame_2) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label.setFont(font) + self.label.setObjectName("label") + self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label) + self.label_2 = QtGui.QLabel(self.frame_2) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_2.setFont(font) + self.label_2.setObjectName("label_2") + self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label_2) + self.label_3 = QtGui.QLabel(self.frame_2) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_3.setFont(font) + self.label_3.setObjectName("label_3") + self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_3) + self.authorLabel = QtGui.QLabel(self.frame_2) + self.authorLabel.setObjectName("authorLabel") + self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.authorLabel) + self.dateLabel = QtGui.QLabel(self.frame_2) + self.dateLabel.setObjectName("dateLabel") + self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.dateLabel) + self.ratingLabel = QtGui.QLabel(self.frame_2) + self.ratingLabel.setObjectName("ratingLabel") + self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.ratingLabel) + self.durationLabel = QtGui.QLabel(self.frame_2) + self.durationLabel.setObjectName("durationLabel") + self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.durationLabel) + self.label_8 = QtGui.QLabel(self.frame_2) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_8.setFont(font) + self.label_8.setObjectName("label_8") + self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_8) + self.verticalLayout.addWidget(self.frame_2) + + self.retranslateUi(Video) + QtCore.QMetaObject.connectSlotsByName(Video) + + def retranslateUi(self, Video): + Video.setWindowTitle(QtGui.QApplication.translate("Video", "Video", None, QtGui.QApplication.UnicodeUTF8)) + self.titleLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("Video", "Author", None, QtGui.QApplication.UnicodeUTF8)) + self.label_2.setText(QtGui.QApplication.translate("Video", "Date", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("Video", "Rating", None, QtGui.QApplication.UnicodeUTF8)) + self.authorLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + self.dateLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + self.ratingLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + self.durationLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + self.label_8.setText(QtGui.QApplication.translate("Video", "Duration", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/weboob/frontends/qvideoob/video.py b/weboob/frontends/qvideoob/video.py new file mode 100644 index 0000000000000000000000000000000000000000..e72d4564d0833b2fbbd2bf266b140fc4942307f1 --- /dev/null +++ b/weboob/frontends/qvideoob/video.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +Copyright(C) 2010 Romain Bignon + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 3 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +""" + +from PyQt4.QtGui import QDialog + +from weboob.frontends.qvideoob.ui.video_ui import Ui_Video + +class Video(QDialog): + def __init__(self, video, parent=None): + QDialog.__init__(self, parent) + self.ui = Ui_Video() + self.ui.setupUi(self) + + self.video = video + self.setWindowTitle("Video - %s" % video.title) + self.ui.titleLabel.setText(video.title) + self.ui.durationLabel.setText('%d:%02d:%02d' % (video.duration/3600, (video.duration%3600)/60, video.duration%60)) + self.ui.authorLabel.setText(unicode(video.author)) + self.ui.dateLabel.setText(unicode(video.date)) + if video.rating_max: + self.ui.ratingLabel.setText('%s / %s' % (video.rating, video.rating_max)) + else: + self.ui.ratingLabel.setText('%s' % video.rating)