def set_video_player(self): self.mediaObject = Phonon.MediaObject(self.tab_2) self.videoWidget = Phonon.VideoWidget(self.tab_2) self.videoWidget.setGeometry(QtCore.QRect(199, 0, 641, 461)) self.videoWidget.setObjectName(_fromUtf8("videoPlayer")) Phonon.createPath(self.mediaObject, self.videoWidget) self.audioOutput = Phonon.AudioOutput(Phonon.VideoCategory, self.tab_2) Phonon.createPath(self.mediaObject, self.audioOutput) self.metaInformationResolver = Phonon.MediaObject(self.tab_2) self.mediaObject.setTickInterval(1000) self.videoWidget.setScaleMode(0) QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL('tick(qint64)'),self.tick) QtCore.QObject.connect(self.mediaObject,QtCore.SIGNAL('stateChanged(Phonon::State, Phonon::State)'),self.stateChanged) QtCore.QObject.connect(self.metaInformationResolver,QtCore.SIGNAL('stateChanged(Phonon::State, Phonon::State)'),self.metaStateChanged) QtCore.QObject.connect(self.mediaObject,QtCore.SIGNAL('currentSourceChanged(Phonon::MediaSource)'),self.sourceChanged) self.setupActions() # self.setupMenus() self.setupUi2() self.timeLcd.display("00:00") self.video_id = self.videoWidget.winId() self.source = ''
def __init__(self): QtGui.QWidget.__init__(self) # media self.media = Phonon.MediaObject(self) self.media.stateChanged.connect(self.handleStateChanged) self.video = Phonon.VideoWidget(self) self.video.setMinimumSize(200, 200) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self) Phonon.createPath(self.media, self.audio) Phonon.createPath(self.media, self.video) self.media.setCurrentSource(Phonon.MediaSource("Wildlife.wmv")) self.media.play() # control button self.button = QtGui.QPushButton('选择文件', self) self.button.clicked.connect(self.handleButton) # for display of time lapse self.info = QtGui.QLabel(self) # layout layout = QtGui.QGridLayout(self) layout.addWidget(self.video, 1, 1, 3, 3) layout.addWidget(self.info, 4, 1, 1, 3) layout.addWidget(self.button, 5, 1, 1, 3) # signal-slot, for time lapse self.thread = PollTimeThread(self) self.thread.update.connect(self.update)
def open_screen(self): # Initializes screen with selected screen object, opens thread # when run screen = self.screens[self.lwScreen.currentRow()] dialog = customdialog.ViewDialog(screen, self._del_view_dialog) self.view_dialogs[screen.name] = dialog dialog.show() self.refresh_tab_buts() # Create new thread if screen is a Video object if type(screen) is svdevices.Video: # Initialize Phonon multimedia objects media_src = Phonon.MediaSource(screen.link) media_obj = Phonon.MediaObject(dialog) media_obj.setCurrentSource(media_src) video_widget = Phonon.VideoWidget(dialog) video_widget.setMinimumSize(640, 480) dialog.vLayout.addWidget(video_widget) Phonon.createPath(media_obj, video_widget) video_widget.show() worker = Worker(self._handle_video, media_obj, video_name=screen.name) self.threadpool.start(worker)
def __init__(self, parent=None): Widget.__init__(self) QtGui.QWidget.__init__(self, parent) self.media = Phonon.MediaObject(self) self.video = Phonon.VideoWidget(self) self.video.setMinimumSize(400, 400) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self) Phonon.createPath(self.media, self.audio) Phonon.createPath(self.media, self.video) layout = QtGui.QVBoxLayout(self) layout.addWidget(self.video, 0) self.handleButton()
def setupUi(self, Widget, width, height): Widget.setObjectName(_fromUtf8("VideoWidget")) Widget.resize(width, height) self.media = Phonon.MediaObject(Widget) #self.media.stateChanged.connect(self.__handleStateChanged) self.video = Phonon.VideoWidget(Widget) self.video.setMaximumSize(width, height) self.video.setMinimumSize(width, height) self.video.setAspectRatio(Phonon.VideoWidget.AspectRatioWidget) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, Widget) Phonon.createPath(self.media, self.audio) Phonon.createPath(self.media, self.video)
def __init__(self): super(MainWidget, self).__init__() self.angle = 0 self.scale = 5 self.shear = 5 self.translate = 50 self.name = 'file/backgroud.jpg' self.scene = QGraphicsScene() self.scene.setSceneRect(-200, -200, 400, 400) self.pixmap = QPixmap(self.name) self.item = PixItem(self.pixmap) self.scene.addItem(self.item) self.item.setPos(0, 0) self.view = QGraphicsView() self.view.setScene(self.scene) self.view.setMinimumSize(200, 200) self.ctrlFrame = QFrame() self.createControllFrame() self.rightlayout = QVBoxLayout() self.rightlayout.addWidget(self.openImage) self.rightlayout.addWidget(self.rotateGroup) self.rightlayout.addWidget(self.scaleGroup) self.rightlayout.addWidget(self.shearGroup) self.rightlayout.addWidget(self.translateGroup) self.rightlayout.addWidget(self.outlineGroup) self.rightlayout.addWidget(self.openVideo) # videolayout self.video = Phonon.VideoWidget(self) self.video.setMinimumSize(200, 200) self.leftlayout = QHBoxLayout() self.leftlayout.addWidget(self.view) # self.leftlayout.addWidget(self.ctrlFrame) # self.leftlayout.addWidget(self.video) self.leftlayout.addWidget(self.ctrlFrame) self.mainlayout = QHBoxLayout() self.mainlayout.addLayout(self.leftlayout) self.mainlayout.addLayout(self.rightlayout) self.setLayout(self.mainlayout) self.setWindowTitle(self.tr("Graphics Item 的各种变形"))
def setup(self, display): """ Set up the player widgets """ display.phonon_widget = Phonon.VideoWidget(display) display.phonon_widget.resize(display.size()) display.media_object = Phonon.MediaObject(display) Phonon.createPath(display.media_object, display.phonon_widget) if display.has_audio: display.audio = Phonon.AudioOutput(Phonon.VideoCategory, display.media_object) Phonon.createPath(display.media_object, display.audio) display.phonon_widget.raise_() display.phonon_widget.hide() self.has_own_widget = True
def g_display(self): QWidget.__init__(self) global audio, video, media if media is None: media = Phonon.MediaObject(self) video = Phonon.VideoWidget(self) audio = Phonon.AudioOutput(Phonon.MusicCategory, self) media.setTickInterval(1000) media.tick.connect(self.tick) Phonon.createPath(media, video) Phonon.createPath(media, audio) media.stateChanged.connect(self.stateChanged) self.setupActions() self.setupUi() self.timeLcd.display("00:00") self.play(self.node)
def __init__(self, width, height, host_orch, host_pp): # pdb.set_trace() QtGui.QWidget.__init__(self) #Dialog component self.dialog = QtGui.QDialog() self.ui = Ui_Dialog() self.ui.setupUi(self.dialog) #Tab widget self.tabWidget = QtGui.QTabWidget() self.tab = Ui_TabWidget() self.tab.setupUi(self.tabWidget, width / 2, height / 2, host_orch, host_pp) #Column widget self.column = QtGui.QWidget() self.col = Ui_column() self.col.setupUi(self.column, width, height) self.video_widget = Phonon.VideoWidget() self.video = Ui_Video() self.video.setupUi(self.video_widget, width / 2, height / 2) #List Widget # self.list = QtGui.QListWidget(self) # self.list.setMaximumSize(width/2,height/2) # #self.list.hide() #Log Widget self.scrollArea = QtGui.QScrollArea() self.scroll = Ui_ScrollArea() self.scroll.setupUi(self.scrollArea) # self.listView = QtGui.Qlabel(self) # self.listView.setObjectName("listView") #Connecting Handlers self.col.set_handler_about(self.__show_about_handle) self.col.set_handler_start(self.__start_scenario) self.col.set_handler_stop(self.__stop_scenario) self.col.set_handler_clean(self.__clean_logs) #Including in the grid layout = QtGui.QGridLayout(self) layout.addWidget(self.video_widget, 0, 0) layout.addWidget(self.scrollArea, 1, 2) layout.addWidget(self.tabWidget, 1, 0) layout.addWidget(self.column, 0, 2)
def __init__(self): QtGui.QWidget.__init__(self) self.media = Phonon.MediaObject(self) self.media.stateChanged.connect(self.handleStateChanged) self.video = Phonon.VideoWidget(self) self.video.setMinimumSize(400, 400) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self) Phonon.createPath(self.media, self.audio) Phonon.createPath(self.media, self.video) self.button = QtGui.QPushButton('Choose File', self) self.button.clicked.connect(self.handleButton) self.list = QtGui.QListWidget(self) self.list.addItems(Phonon.BackendCapabilities.availableMimeTypes()) layout = QtGui.QVBoxLayout(self) layout.addWidget(self.video, 1) layout.addWidget(self.button) layout.addWidget(self.list)
def __init__(self, iface): QtGui.QDialog.__init__(self) # Set up the user interface from Designer. self.ui = Ui_Form() self.ui.setupUi(self) self.iface = iface self.ui.sourceLoad_pushButton.clicked.connect(self.OpenButton) self.ui.replayPlay_pushButton.clicked.connect(self.PlayPauseButton) QObject.connect(self.ui.replay_mapTool_pushButton, SIGNAL("toggled(bool)"), self.replayMapTool_toggled) self.positionMarker = None settings = QSettings() settings.beginGroup("/plugins/PlayerPlugin") self.replay_followPosition = settings.value("followPosition", True, type=bool) settings.setValue("followPosition", self.replay_followPosition) QObject.connect(self.iface.mapCanvas(), SIGNAL("mapToolSet(QgsMapTool*)"), self.mapToolChanged) self.mapTool = ReplayMapTool(self.iface.mapCanvas(), self) self.mapTool_previous = None self.mapToolChecked = property(self.__getMapToolChecked, self.__setMapToolChecked) QObject.connect(self.ui.replayPosition_horizontalSlider, SIGNAL('sliderMoved(int)'), self.replayPosition_sliderMoved) QObject.connect(self.ui.addpoint_button, SIGNAL('clicked()'), self.snapshot) QObject.connect(self.ui.ExporText_button, SIGNAL('clicked()'), self.exportText) QObject.connect(self.ui.ExporShp_button, SIGNAL('clicked()'), self.exportShp) QObject.connect(self.ui.ExporSqlite_button, SIGNAL('clicked()'), self.exportSqlite) QObject.connect(self.ui.ExporKML_button, SIGNAL('clicked()'), self.exportKML) QObject.connect(self.ui.Help, SIGNAL('clicked()'), self.Help) self.PlayPuase = 0 # Puase=0,Play=1 self.Close = 0 # select video=1 , Close=0 self.adactProjection = False self.createLayer = 0 # Default layer=1,create by user=2,load existent=else self.videoWidget = Phonon.VideoWidget(self.ui.video_widget)
def __init__(self): QtGui.QWidget.__init__(self) self.media = Phonon.MediaObject(self) ### video widget #### self.video = Phonon.VideoWidget(self) self.video.setMinimumSize(320, 200) self.myfilename = "" self.connect( QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Space), self), QtCore.SIGNAL('activated()'), self.handlePlayButton) self.connect(QtGui.QShortcut(QtGui.QKeySequence("o"), self), QtCore.SIGNAL('activated()'), self.handleButton) self.connect(QtGui.QShortcut(QtGui.QKeySequence("q"), self), QtCore.SIGNAL('activated()'), self.handleQuit) self.connect(QtGui.QShortcut(QtGui.QKeySequence("f"), self), QtCore.SIGNAL('activated()'), self.handleFullscreen) self.connect(QtGui.QShortcut(QtGui.QKeySequence("s"), self), QtCore.SIGNAL('activated()'), self.toggleSlider) self.connect(QtGui.QShortcut(QtGui.QKeySequence("i"), self), QtCore.SIGNAL('activated()'), self.handleInfo) ### context menu #### self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.popup2) ### seek slider ### self.slider = Phonon.SeekSlider(self.media) self.slider.setStyleSheet(stylesheet(self)) isize = QSize(16, 16) self.slider.setFixedHeight(8) self.slider.setIconSize(isize) self.slider.hide() ### connection position to label ### self.media.isSeekable() ### layout ### layout = QtGui.QGridLayout(self) layout.setMargin(1) layout.addWidget(self.video, 0, 0, 1, 1) layout.addWidget(self.slider, 0, 0, 1, 1) layout.setColumnStretch(0, 1) layout.setRowStretch(0, 0) layout.setHorizontalSpacing(6)
def __init__(self): QtGui.QWidget.__init__(self) self.media = Phonon.MediaObject(self) # self.media.stateChanged.connect(self.handleStateChanged) self.video = Phonon.VideoWidget(self) self.video.setMinimumSize(400, 400) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self) Phonon.createPath(self.media, self.video) print(help(Phonon.createPath(self.media, self.audio))) self.btn_pepe = QtGui.QPushButton('Pepe', self) self.btn_pepe.clicked.connect(self.pepe) self.button = QtGui.QPushButton('Thomas', self) self.button.clicked.connect(self.thomas) self.btn_surreal = QtGui.QPushButton('Surreal Guy', self) self.btn_surreal.clicked.connect(self.surreal) layout = QtGui.QVBoxLayout(self) layout.addWidget(self.video, 1) layout.addWidget(self.button) layout.addWidget(self.btn_pepe) layout.addWidget(self.btn_surreal)
def __init__(self, Sound, Mdi): super(MdiPlayer, self).__init__() self.mdi = Mdi self.loading = 1 self.sound = Sound self.setAttribute(QtCore.Qt.WA_DeleteOnClose) # self.setFrameShape(QtGui.QFrame.NoFrame) # self.isUntitled = True self.media = Phonon.MediaObject(self) self.media.stateChanged.connect(self.handleStateChanged) self.video = Phonon.VideoWidget(self) self.video.setMinimumSize(50, 50) self.setBaseSize(80, 80) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self) Phonon.createPath(self.media, self.video) if self.sound == True: Phonon.createPath(self.media, self.audio) self.audio.setVolume(100) layout = QtGui.QVBoxLayout(self) layout.setMargin(0) layout.addWidget(self.video)
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.layout = QVBoxLayout(self) self.mo = Phonon.MediaObject() self.vw = Phonon.VideoWidget() self.vw.setGeometry(QRect(0, 0, 1280, 720)) self.vw.AspectRatio16_9 self.vw.FitInView Phonon.createPath(self.mo, self.vw) self.ao = Phonon.AudioOutput(Phonon.MusicCategory, self) Phonon.createPath(self.mo, self.ao) ##################### eye tracking ##################### self.audience_eye_tracking_dic = {} self.eye_track_dic = {} self.eye_track_frame_rate = 5 self.trial_lapse = 2000 ##################### eye tracking ##################### # self.open_file() self.mo.setTickInterval(self.eye_track_frame_rate) self.mo.tick.connect(self.draw_eye_tracking) self.scene = QGraphicsScene() self.view = QGraphicsView(self.scene, self) self.layout.addWidget(self.view) self.createUI() self.proxy = self.scene.addWidget(self.vw) # or # proxy = QGraphicsProxyWidget() # scene.addItem(proxy) ##################### eye tracking ##################### self.lines = [] self.dot = None
def __init__(self): QtGui.QWidget.__init__(self) self.media = Phonon.MediaObject(self) ### video widget #### self.video = Phonon.VideoWidget(self) self.video.setMinimumSize(320,200) self.videoCuts = [] self.myfilename = "" self.extension = "" self.t1 = "" self.t2 = "" self.t3 = "" self.t4 = "" self.t5 = "" self.t6 = "" ### open button ### self.button = QtGui.QPushButton('Choose Video', self) self.button.setFixedWidth(90) self.button.clicked.connect(self.handleButton) self.button.setStyleSheet(stylesheet(self)) ### context menu #### self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.popup2) ### play / pause button ### self.playbutton = QtGui.QPushButton('Play', self) self.playbutton.setFixedWidth(70) self.playbutton.clicked.connect(self.handlePlayButton) self.playbutton.setStyleSheet(stylesheet(self)) self.connect(QtGui.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Space), self), QtCore.SIGNAL('activated()'), self.handlePlayButton) self.connect(QtGui.QShortcut(QtGui.QKeySequence("Ctrl+o"), self), QtCore.SIGNAL('activated()'), self.handleButton) self.connect(QtGui.QShortcut(QtGui.QKeySequence("Ctrl+s"), self), QtCore.SIGNAL('activated()'), self.handleSaveVideo) self.connect(QtGui.QShortcut(QtGui.QKeySequence("Ctrl+q"), self), QtCore.SIGNAL('activated()'), self.handleQuit) ### save button ### self.savebutton = QtGui.QPushButton('Save Video', self) self.savebutton.setFixedWidth(90) self.savebutton.clicked.connect(self.handleSaveVideo) self.savebutton.setStyleSheet(stylesheet(self)) ### seek slider ### self.slider = Phonon.SeekSlider(self.media) self.slider.setStyleSheet(stylesheet(self)) isize = QSize(16,16) self.slider.setIconSize(isize) self.slider.setFocus() # self.slider.connect(self.handleLabel) ### connection position to label ### self.media.isSeekable() self.media.tick.connect(self.handleLabel) self.media.seekableChanged.connect(self.handleLabel) #self.slider.wheel.connect(self.handleLabel) ### table view ### self.iconList = QListWidget() self.iconList.setAlternatingRowColors(True) self.iconList.setFixedWidth(200) self.iconList.setContextMenuPolicy(Qt.CustomContextMenu) self.iconList.setStyleSheet("QListWidget::item:selected:active { background: #7D8ED9; color:#FFFFFF; } ") self.iconList.setViewMode(0) self.iconList.setSelectionBehavior(1) self.iconList.setIconSize(QSize(80, 80/1.78)) self._hookListActions() self.iconList.customContextMenuRequested.connect(self._openListMenu) ### set start button ### self.startbutton = QtGui.QPushButton('set Start', self) self.startbutton.setFixedWidth(70) self.startbutton.clicked.connect(self.handleStartButton) self.startbutton.setStyleSheet(stylesheet(self)) self.connect(QtGui.QShortcut(QtGui.QKeySequence("s"), self), QtCore.SIGNAL('activated()'), self.handleStartButton) ### set end button ### self.endbutton = QtGui.QPushButton('set End', self) self.endbutton.setFixedWidth(70) self.endbutton.clicked.connect(self.handleEndButton) self.endbutton.setStyleSheet(stylesheet(self)) self.connect(QtGui.QShortcut(QtGui.QKeySequence("e"), self), QtCore.SIGNAL('activated()'), self.handleEndButton) ### label ### self.mlabel = QtGui.QLabel('Frame', self) self.mlabel.setStyleSheet('QLabel \ {background-color: transparent; color: white;}\nQLabel{color: darkcyan; font-size: 12px; background-color: transparent; border-radius: 5px; padding: 6px; text-align: center;}\n QLabel:hover{color: red;}') #self.mlabel.setFixedWidth(80) ### layout ### layout = QtGui.QGridLayout(self) layout.addWidget(self.iconList, 0, 0, 1, 1) layout.addWidget(self.video, 0, 1, 1, 6) layout.addWidget(self.slider, 1, 1, 1, 6) layout.addWidget(self.button, 2, 0, 1, 1) layout.addWidget(self.savebutton, 2, 1, 1, 1) layout.addWidget(self.playbutton, 2, 3, 1, 1) layout.addWidget(self.startbutton, 2, 5, 1, 1) layout.addWidget(self.endbutton, 2, 6, 1, 1) layout.addWidget(self.mlabel, 2, 4, 1, 1)
import os from PyQt4 import QtGui from PyQt4.phonon import Phonon if __name__ == "__main__": app = QtGui.QApplication([]) app.setApplicationName("Phonon Video Player") file_path = "i.mpg" media_src = Phonon.MediaSource(file_path) media_obj = Phonon.MediaObject() media_obj.setCurrentSource(media_src) video_widget = Phonon.VideoWidget() Phonon.createPath(media_obj, video_widget) audio_out = Phonon.AudioOutput(Phonon.VideoCategory) Phonon.createPath(media_obj, audio_out) video_widget.show() media_obj.play() print "Play media" app.exec_()
def __init__(self): QtGui.QWidget.__init__(self) # media self.media = Phonon.MediaObject(self) self.media.stateChanged.connect(self.handleStateChanged) self.video = Phonon.VideoWidget(self) self.video.setMinimumSize(200, 200) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self) Phonon.createPath(self.media, self.audio) Phonon.createPath(self.media, self.video) # control button self.button_hello = QtGui.QPushButton('Hello', self) self.button_hello.clicked.connect(self.handleButton) self.button_hug = QtGui.QPushButton('Hug', self) self.button_hug.clicked.connect(self.handleButton) self.button_left_n = QtGui.QPushButton('left near', self) self.button_left_n.clicked.connect(self.handleButton) self.button_left_m = QtGui.QPushButton('left middle', self) self.button_left_m.clicked.connect(self.handleButton) self.button_left_f = QtGui.QPushButton('left far', self) self.button_left_f.clicked.connect(self.handleButton) self.button_right_n = QtGui.QPushButton('right near', self) self.button_right_n.clicked.connect(self.handleButton) self.button_right_m = QtGui.QPushButton('right middle', self) self.button_right_m.clicked.connect(self.handleButton) self.button_right_f = QtGui.QPushButton('right far', self) self.button_right_f.clicked.connect(self.handleButton) self.button_auto = QtGui.QPushButton('Auto', self) self.button_auto.clicked.connect(self.handleButton) self.button_manual = QtGui.QPushButton('Manual', self) self.button_manual.clicked.connect(self.handleButton) # for display of time lapse self.info = QtGui.QLabel(self) # layout layout = QtGui.QGridLayout(self) layout.addWidget(self.video, 1, 3, 7, 1) layout.addWidget(self.info, 4, 3, 1, 1) layout.addWidget(self.button_hello, 1, 1, 1, 1) layout.addWidget(self.button_hug, 1, 2, 1, 1) layout.addWidget(self.button_left_n, 2, 1, 1, 1) layout.addWidget(self.button_left_m, 3, 1, 1, 1) layout.addWidget(self.button_left_f, 4, 1, 1, 1) layout.addWidget(self.button_right_n, 2, 2, 1, 1) layout.addWidget(self.button_right_m, 3, 2, 1, 1) layout.addWidget(self.button_right_f, 4, 2, 1, 1) layout.addWidget(self.button_auto, 6, 1, 1, 1) layout.addWidget(self.button_manual, 6, 2, 1, 1) # signal-slot, for time lapse self.thread = PollTimeThread(self) self.thread.update.connect(self.update)
def __init__(self, parent=None): super(window, self).__init__(parent) _VERSION_=0.1 #-----------window setting-------------- self.setWindowTitle('QPlayer') self.setWindowIcon(QIcon('icon.png')) self.setGeometry(50, 50, 700,680) self.setFixedSize(700,680) #----------Full screen-------------------- self.short=QShortcut(self) self.short.setKey(QKeySequence('Esc')) self.short.setContext(Qt.ApplicationShortcut) self.short.activated.connect(self.escape) #-----------Pause key event------------- self.short=QShortcut(self) self.short.setKey(QKeySequence('Space')) self.short.setContext(Qt.ApplicationShortcut) self.short.activated.connect(self.space) #----------------------------------------- self.setStyleSheet('background-color:#1A2836;') #--------ToolBar setting------------------------- toolbar=self.addToolBar('') open=QAction(QIcon('open.png'),'open file',self) About=QAction('About',self) quit=QAction('Quit',self) toolbar.addAction(open) toolbar.addAction(About) toolbar.addAction(quit) open.triggered.connect(self.open_file) quit.triggered.connect(self.exiting) toolbar.setMovable(False) toolbar.setFocusPolicy(True) #---------Phonon source-------------------- self.media = Phonon.MediaObject(self) self.media.stateChanged.connect(self.statech) self.video= Phonon.VideoWidget(self) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self) self.video.setGeometry(20,50,660,400) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self) Phonon.createPath(self.media, self.audio) Phonon.createPath(self.media, self.video) #---------Slider-------------------------- self.slider=Phonon.SeekSlider(self) self.slider.setMediaObject(self.media) self.slider.setGeometry(20,460,660,20) #--------Frame------------------------ self.frame=QFrame(self) self.frame.setGeometry(20,498,660,20) self.frame.setStyleSheet("background-color:#1A2938;") #--------Label ----------------- self.label=QLabel(self) self.label.move(20,495) self.label.setText("<font color='White'>Volume :</font>") #----------Volume---------------------------------------- self.volumeslider=Phonon.VolumeSlider(self) self.volumeslider.setAudioOutput(self.audio) self.volumeslider.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Minimum) self.volumeslider.setGeometry(195,500,150,20) #-----------Button play--------------------- self.button_play=QPushButton('Play',self) self.button_play.move(20,530) self.button_play.clicked.connect(self.playing) self.button_play.setStyleSheet('background-color:#070D14;') #---------------------------------------------------------- #-------Button pause------------------- self.button_paus=QPushButton('Pause',self) self.button_paus.move(130,530) self.button_paus.clicked.connect(self.pausing) self.button_paus.setStyleSheet('background-color:#D73434;') #----------Button FullScreen watch---------------------- self.button_full=QPushButton('Fullscreen',self) self.button_full.move(240,530) self.button_full.clicked.connect(self.fullscreen) self.show()
def __init__(self): super(Window, self).__init__() self.recognizer = SpeakerRecognizer.SpeakerRecognizer() self.functionButtons = QtGui.QWidget(self) self.functionButtons.layout = QtGui.QHBoxLayout(self.functionButtons) self.trainUBMButton = QtGui.QPushButton('Train UBM', self.functionButtons) self.loadUBMButton = QtGui.QPushButton('Load UBM', self.functionButtons) self.saveUBMButton = QtGui.QPushButton('Save UBM', self.functionButtons) self.addSpeakerButton = QtGui.QPushButton('Add Speaker', self.functionButtons) self.trainUBMButton.clicked.connect(self.handleTrainUBMButton) self.loadUBMButton.clicked.connect(self.handleLoadUBMButton) self.saveUBMButton.clicked.connect(self.handleSaveUBMButton) self.addSpeakerButton.clicked.connect(self.handleAddSpeakerButton) self.functionButtons.layout.addWidget(self.trainUBMButton) self.functionButtons.layout.addWidget(self.loadUBMButton) self.functionButtons.layout.addWidget(self.saveUBMButton) self.functionButtons.layout.addWidget(self.addSpeakerButton) self.media = Phonon.MediaObject(self) self.video = Phonon.VideoWidget(self) self.video.setAspectRatio(Phonon.VideoWidget.AspectRatioWidget) self.video.setMinimumSize(640, 360) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self) Phonon.createPath(self.media, self.audio) Phonon.createPath(self.media, self.video) self.buttons = QtGui.QWidget(self) self.buttons.layout = QtGui.QHBoxLayout(self.buttons) self.openButton = QtGui.QPushButton('Open', self.buttons) self.playButton = QtGui.QPushButton('Play', self.buttons) self.playButton.setEnabled(False) self.openButton.clicked.connect(self.handleOpenButton) self.playButton.clicked.connect(self.handlePlayButton) self.buttons.layout.addWidget(self.openButton) self.buttons.layout.addWidget(self.playButton) self.progress = QtGui.QSlider(self, orientation=QtCore.Qt.Horizontal) self.progress.sliderMoved.connect(self.progressMoved) self.media.stateChanged.connect(self.handleStateChanged) self.media.tick.connect(self.tick) self.layout = QtGui.QVBoxLayout(self) self.layout.addWidget(self.video, 1) self.layout.addWidget(self.buttons) self.layout.addWidget(self.functionButtons) self.layout.addWidget(self.progress)