improvement
This commit is contained in:
parent
74deb97d6a
commit
d605d30588
7 changed files with 45 additions and 247 deletions
|
|
@ -51,7 +51,7 @@ class MainWindow(QtMainWindow):
|
|||
|
||||
for backend in self.weboob.iter_backends():
|
||||
for video in backend.iter_search_results(pattern):
|
||||
minivideo = MiniVideo(video)
|
||||
minivideo = MiniVideo(backend, video)
|
||||
self.ui.scrollAreaContent.layout().addWidget(minivideo)
|
||||
self.minivideos.append(minivideo)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,15 +22,18 @@ import urllib2
|
|||
from PyQt4.QtGui import QFrame, QImage, QPixmap
|
||||
|
||||
from weboob.frontends.qvideoob.ui.minivideo_ui import Ui_MiniVideo
|
||||
from .video import Video
|
||||
|
||||
class MiniVideo(QFrame):
|
||||
def __init__(self, video, parent=None):
|
||||
def __init__(self, backend, video, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
self.ui = Ui_MiniVideo()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
self.backend = backend
|
||||
self.video = video
|
||||
self.ui.titleLabel.setText(video.title)
|
||||
self.ui.backendLabel.setText(backend.name)
|
||||
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 '')
|
||||
|
|
@ -43,3 +46,19 @@ class MiniVideo(QFrame):
|
|||
data = urllib2.urlopen(video.preview_url).read()
|
||||
img = QImage.fromData(data)
|
||||
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img))
|
||||
|
||||
def enterEvent(self, event):
|
||||
self.setFrameShadow(self.Sunken)
|
||||
QFrame.enterEvent(self, event)
|
||||
|
||||
def leaveEvent(self, event):
|
||||
self.setFrameShadow(self.Raised)
|
||||
QFrame.leaveEvent(self, event)
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
QFrame.mousePressEvent(self, event)
|
||||
|
||||
video = self.backend.get_video(self.video.id)
|
||||
if video:
|
||||
video_widget = Video(video, self)
|
||||
video_widget.show()
|
||||
|
|
|
|||
|
|
@ -7,11 +7,6 @@ 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)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>464</width>
|
||||
<height>111</height>
|
||||
<height>112</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -160,6 +160,26 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Where</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="backendLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
|||
|
|
@ -1,109 +0,0 @@
|
|||
# -*- 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))
|
||||
|
||||
|
|
@ -32,6 +32,9 @@
|
|||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
|||
|
|
@ -1,130 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'video.ui'
|
||||
#
|
||||
# Created: Sat Apr 17 12:19:03 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_2 = QtGui.QVBoxLayout(self.frame)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.videoPlayer = phonon.Phonon.VideoPlayer(self.frame)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.MinimumExpanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.videoPlayer.sizePolicy().hasHeightForWidth())
|
||||
self.videoPlayer.setSizePolicy(sizePolicy)
|
||||
self.videoPlayer.setObjectName("videoPlayer")
|
||||
self.verticalLayout_2.addWidget(self.videoPlayer)
|
||||
self.seekSlider = phonon.Phonon.SeekSlider(self.frame)
|
||||
self.seekSlider.setIconVisible(True)
|
||||
self.seekSlider.setTracking(True)
|
||||
self.seekSlider.setObjectName("seekSlider")
|
||||
self.verticalLayout_2.addWidget(self.seekSlider)
|
||||
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.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow)
|
||||
self.formLayout.setObjectName("formLayout")
|
||||
self.label_4 = QtGui.QLabel(self.frame_2)
|
||||
font = QtGui.QFont()
|
||||
font.setWeight(75)
|
||||
font.setBold(True)
|
||||
self.label_4.setFont(font)
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_4)
|
||||
self.urlEdit = QtGui.QLineEdit(self.frame_2)
|
||||
self.urlEdit.setReadOnly(True)
|
||||
self.urlEdit.setObjectName("urlEdit")
|
||||
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.urlEdit)
|
||||
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(1, QtGui.QFormLayout.LabelRole, self.label_8)
|
||||
self.durationLabel = QtGui.QLabel(self.frame_2)
|
||||
self.durationLabel.setObjectName("durationLabel")
|
||||
self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.durationLabel)
|
||||
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(2, QtGui.QFormLayout.LabelRole, self.label)
|
||||
self.authorLabel = QtGui.QLabel(self.frame_2)
|
||||
self.authorLabel.setObjectName("authorLabel")
|
||||
self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.authorLabel)
|
||||
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(3, QtGui.QFormLayout.LabelRole, self.label_2)
|
||||
self.dateLabel = QtGui.QLabel(self.frame_2)
|
||||
self.dateLabel.setObjectName("dateLabel")
|
||||
self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.dateLabel)
|
||||
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(4, QtGui.QFormLayout.LabelRole, self.label_3)
|
||||
self.ratingLabel = QtGui.QLabel(self.frame_2)
|
||||
self.ratingLabel.setObjectName("ratingLabel")
|
||||
self.formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.ratingLabel)
|
||||
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_4.setText(QtGui.QApplication.translate("Video", "URL", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_8.setText(QtGui.QApplication.translate("Video", "Duration", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.durationLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label.setText(QtGui.QApplication.translate("Video", "Author", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.authorLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_2.setText(QtGui.QApplication.translate("Video", "Date", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.dateLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_3.setText(QtGui.QApplication.translate("Video", "Rating", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.ratingLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
from PyQt4 import phonon
|
||||
Loading…
Add table
Add a link
Reference in a new issue