Esempio n. 1
0
 def RunGoal(self, goal=None, gwp=None):
     if goal is None or gwp is None: return
     
     message = "Goal: "+str(goal.title)+"\nFinished: "+str( self._currentDateTime().toString() )+"\nStarted: "+str(goal.registeredTime.toString())+"\nDT: "+str(goal.seconds)+" milliseconds"
     print "Running Goal",message,"\n"
     
     if goal.imagePath != "":
         splashPix = QtGui.QPixmap(goal.imagePath)
     else:
         splashPix = QtGui.QPixmap("No_Image_Available.png")
         
     if splashPix.isNull(): 
         print "Null pix, avoiding creating a splashscreen"
     else:
         splash = ExtraSplashScreen(splashPix, QtCore.Qt.WindowStaysOnTopHint)
         splash.setMask( splashPix.mask() )
         splash.show()
         
         if goal.mp3Path != "":
             mediaSource = Phonon.MediaSource(goal.mp3Path)
             mediaObject = Phonon.MediaObject(self)
             audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
             Phonon.createPath(mediaObject, audioOutput)
             mediaObject.setCurrentSource(mediaSource)
        
             splash.shown.connect(mediaObject.play)
             splash.hidden.connect(mediaObject.stop)
         
         self.splashes.append(splash)
         splash.hidden.connect(lambda : self._cleanupSplashScreen(splash) )
         
     self.RemoveGoalWidgetPart(gwp, goal)
Esempio n. 2
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.layout = QtGui.QVBoxLayout()
        self.layout.setContentsMargins(0,0,0,0)
        self.setLayout(self.layout)

        self.mediaObject = Phonon.MediaObject(self)
        self.videoWidget = Phonon.VideoWidget(self)
        self.videoWidget.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding)
        self.audioOutput = Phonon.AudioOutput(Phonon.VideoCategory, self)
        Phonon.createPath(self.mediaObject, self.videoWidget)
        Phonon.createPath(self.mediaObject, self.audioOutput)
        self.layout.addWidget(self.videoWidget)

        self.toolBar = QtGui.QToolBar()
        self.toolBar.setMovable(False)
        self.toolBar.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.layout.addWidget(self.toolBar)

        self.playButton = QtGui.QToolButton()
        self.playButton.setText("Play")
        self.playButton.clicked.connect(self.play)
        self.toolBar.addWidget(self.playButton)

        self.pauseButton = QtGui.QToolButton()
        self.pauseButton.setText("Pause")
        self.pauseButton.clicked.connect(self.pause)
        self.toolBar.addWidget(self.pauseButton)

        self.seekSlider = Phonon.SeekSlider()
        self.seekSlider.setMediaObject(self.mediaObject)
        self.toolBar.addWidget(self.seekSlider)
Esempio n. 3
0
    def openMultimedia(self):
        if self.controller.audio_dir:
            pass
        else:
            self.controller.audio_dir = tempfile.mkdtemp(prefix="VTAudio")

        tmp_dir = os.path.join(self.controller.audio_dir, "audio")

        if os.path.isdir(tmp_dir) == True:
            pass
        else:
            os.mkdir(os.path.join(self.controller.audio_dir, "audio"))
        
        
        self.audioMedia = Phonon.MediaObject()
        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory)
        Phonon.createPath(self.audioMedia, self.audioOutput)
        self.paused = False
        
        self.filename = QtGui.QFileDialog.getOpenFileName(self, 'Open File', 
                                                         '/', "Music (*.mp3 *.wav *.ogg *.mpc *.flac *.au *.raw *.dct *.aac *.m4a *.wma *.amr *.awb)")

        if self.filename != "":
            bname = os.path.basename(str(self.filename))
            fbasename, fextension = os.path.splitext(bname)
            fd, temp_fname = tempfile.mkstemp(suffix=fextension, prefix="VTAudio", dir=tmp_dir) 
            os.close(fd)
            self.file = open(self.filename, 'r')
            shutil.copyfile(self.filename, temp_fname)
            self.audio_filename = temp_fname
            self.fname = os.path.basename(temp_fname)
            self.controller.setAudioMediaObject(self.audioMedia)
            self.controller.update_audio(self.fname)   
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle('VLC_Subs')
#        self.setWindowIcon(QtGui.QIcon('\\icon\vlc.ico'))
        self.thread = SleepProgress()
        self.media = Phonon.MediaObject(self)
        self.media.stateChanged.connect(self.handleStateChanged)
        self.video = Phonon.VideoWidget(self)
        self.video.setMinimumSize(300, 300)
        self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self)
        Phonon.createPath(self.media, self.audio)
        Phonon.createPath(self.media, self.video)
        if path:
            self.media.setCurrentSource(Phonon.MediaSource(path))
            self.media.play()

        layout = QtGui.QVBoxLayout(self)

        self.thread = SleepProgress()

        self.nameLabel = QtGui.QLabel("0.0%")
        self.nameLine = QtGui.QLineEdit()
        self.progressbar = QtGui.QProgressBar()
        self.progressbar.setMinimum(1)
        self.progressbar.setMaximum(100)
        layout.addWidget(self.progressbar)
        layout.addWidget(self.nameLabel)
        self.thread.partDone.connect(self.updatePBar)
        self.thread.procDone.connect(self.fin)

        layout.addWidget(self.video, 1)
        self.thread.start()
Esempio n. 5
0
def init_tanooki():
    global audioOutput
    global mediaObject
    audioOutput = Phonon.AudioOutput(Phonon.MusicCategory)
    mediaObject = Phonon.MediaObject()
    mediaObject.setTickInterval(1000)
    Phonon.createPath(mediaObject, audioOutput)
Esempio n. 6
0
 def __init__(self, parent=None):
     QtGui.QMainWindow.__init__(self, parent)
     Ui_MainWindow.__init__(self)
     # QtGui.QDialog.__init__(self)
     self.setupUi(self)
     self.songModel = SongModel()
     self.initPlaylist()#初始化播放列表
     self.player = Phonon.MediaObject()
     self.output = Phonon.AudioOutput(Phonon.MusicCategory)
     self.player.setCurrentSource(Phonon.MediaSource(self.url))
     Phonon.createPath(self.player, self.output)
     # Phonon.createPath(self.mediaObject, self.player)
     self.player.setTickInterval(1000)
     self.player.tick.connect(self.tock)
     self.pushButton_play.clicked.connect(self.play_clicked)#播放按钮单击信号
     self.player.stateChanged.connect(self.state_changed)#播放状态改变信号
     self.player.finished.connect(self.finished)#播放结束信号
     # Phonon.SeekSlider(self.player, self)#进度条
     # self.seekSlider2 = Phonon.SeekSlider(self)
     self.seekSlider2.setMediaObject(self.player)
     self.seekSlider2.setTracking(True)
     # self.seekSlider2.show()
     # self.listWidget.itemSelectionChanged.connect(self.item_changed)#列表选项改变信号
     self.listWidget.itemClicked.connect(self.item_clicked)#列表选项点击信号
     self.pushButton_open_files.clicked.connect(self.open_files)#打开文件
     self.pushButton_open_dir.clicked.connect(self.open_dir)#打开文件夹
     self.pushButton_remove.clicked.connect(self.remove_item) #移除当前选中
     self.volumeSlider.setAudioOutput(self.output)#音量控制器
     self.pushButton_sort.clicked.connect(self.sort)#排序
     self.pushButton_search.clicked.connect(self.search_music)#在线歌曲搜索
     self.init_btn_enabled()
     self.dst = os.path.join(basedir, 'tmp.txt')
Esempio n. 7
0
    def init_music(self):
        self.m_media = Phonon.MediaObject(self)
        self.m_output = audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
        Phonon.createPath(self.m_media, audioOutput)
        self.song_playlist = None
        self.m_media.aboutToFinish.connect(self.play_next_song)
        self.play_next_song()
        self.play_pause_music_action = play_pause_music_action = QAction(u"Music", self)
        play_pause_music_action.setCheckable(True)
        play_pause_music_action.toggled.connect(self.play_pause_music)
        self.view_menu.addAction(play_pause_music_action)
        play_pause_music_action.setChecked(True)
        
        self.s_media = Phonon.MediaObject(self)
        self.s_output = audioOutput = Phonon.AudioOutput(Phonon.GameCategory, self)
        Phonon.createPath(self.s_media, audioOutput)
        self.__sound_sources = {}
        for soundname, soundfile in SOUNDS.items():
            self.__sound_sources[soundname] = Phonon.MediaSource(\
                resfile('audio/sound/'+ soundfile))

        self.sound_action = sound_action = QAction(u"Sound", self)
        sound_action.setCheckable(True)
        sound_action.toggled.connect(self.mute)
        self.__last_s_volume = self.s_output.volume()
        sound_action.setChecked(True)
        self.view_menu.addAction(sound_action)
Esempio n. 8
0
	def __init__(self):
		super(QtGui.QWidget,self).__init__()
		self.ui = musicplayerui.Ui_Form()
		self.ui.setupUi(self)
		self.setWindowFlags(self.windowFlags()|QtCore.Qt.FramelessWindowHint|QtCore.Qt.WindowSystemMenuHint)
		#self.setAttribute(QtCore.Qt.WA_NoSystemBackground,True)
		self.setAttribute(QtCore.Qt.WA_TranslucentBackground,True)
		self.setAttribute(QtCore.Qt.WA_NoSystemBackground,True)		
		#self.setWindowOpacity(0.2)

		self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory,self)
		self.mediaObject = Phonon.MediaObject(self)
		
		self.mediaObject.setTickInterval(1000)
		self.mediaObject.stateChanged.connect(self.statechange)
		

		Phonon.createPath(self.mediaObject,self.audioOutput)
		
		self.ui.pb4.setAutoRepeat(True)
		self.ui.pb5.setAutoRepeat(True)
		self.connect(self.ui.pb1,QtCore.SIGNAL('clicked()'),self.mediaObject.play)
		self.connect(self.ui.pb2,QtCore.SIGNAL('clicked()'),self.mediaObject.pause)
		self.connect(self.ui.pb3,QtCore.SIGNAL('clicked()'),self.mediaObject.stop)
		self.connect(self.ui.pb4,QtCore.SIGNAL('clicked()'),self.volumeup)
		self.connect(self.ui.pb5,QtCore.SIGNAL('clicked()'),self.volumedown)
		self.ui.volumeSlider.setAudioOutput(self.audioOutput)
		self.ui.seekSlider.setMediaObject(self.mediaObject)
    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 = ''
Esempio n. 10
0
 def finished(self):
     # print('finished')
     c_index = self.comboBox.currentIndex()
     #print(c_index)
     #单曲循环
     if(c_index == 1):
         # self.url = self.songModel.get_url(self.listWidget.item(self.listWidget.currentRow()+1).text())
         # print(self.url)
         self.player.play()
     #列表循环
     if(c_index == 2):
         # self.player.pause()
         c_row = self.listWidget.currentRow()
         # print(c_row)
         if(c_row != -1):
             self.listWidget.setCurrentRow((self.listWidget.currentRow()+1) % self.listWidget.count())
         else:
             self.url = self.listWidget.setCurrentRow(1)
         self.url = self.songModel.get_item(self.listWidget.item(self.listWidget.currentRow()).text())['url']
         self.lrc = self.songModel.get_item(self.listWidget.item(self.listWidget.currentRow()).text())['lrc']
         # print(self.url)
         self.player.setCurrentSource(Phonon.MediaSource(self.url))
         Phonon.createPath(self.player, self.output)
         self.player.play()
         self.clr_lrc()
         if(self.lrc):
             self.show_lrc(self.lrc)
Esempio n. 11
0
 def __init__(self):
     QtGui.QPushButton.__init__(self, "Choose File")
     self.mediaObject = Phonon.MediaObject(self)
     self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
     Phonon.createPath(self.mediaObject, self.audioOutput)
     self.mediaObject.stateChanged.connect(self.handleStateChanged)
     self.clicked.connect(self.handleButton)
    def __init__(self, name=None, archivo=None, ruta=None):
        super(ReproductorMultimedia, self).__init__()

        self.puerto = "COM10"

        rutaAbs = os.path.abspath(os.path.curdir)
        self.ruta = rutaAbs + ruta
        self.carpeta = "Muestras/"
        self.setWindowTitle('Reproductor Multimedia')
        self.media = Phonon.MediaObject(self)
        self.media.stateChanged.connect(self.handleStateChanged)
        self.video = Phonon.VideoWidget(self)
        self.video.setMinimumSize(800, 400)
        self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self)
        Phonon.createPath(self.media, self.audio)
        Phonon.createPath(self.media, self.video)
        self.button = QtGui.QPushButton('Reproducir Video', self)
        self.button.clicked.connect(self.handleButton)
        self.button.setMinimumSize(100, 30)
        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(self.video, 1)
        layout.addWidget(self.button)
        self.closeThread = False
        self.datos = name
        self.nombreArchivo = archivo
        self.setWindowIcon(QtGui.QIcon('Icon/icon.jpg'))
        self.show()
Esempio n. 13
0
    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 = 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)
Esempio n. 14
0
 def initUI(self):
     self.setWindowTitle("zTunes")
     self.mediaObject = Phonon.MediaObject()
     audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
     Phonon.createPath(self.mediaObject, audioOutput)
     self.mainToolBar = QtGui.QToolBar("Main Toolbar")
     self.mainToolBar.setStyleSheet("QToolBar { background: palette(window); border-bottom: 1px solid palette(shadow); }")
     self.mainToolBar.setMovable(False)
     self.mainToolBar.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
     changeSourceAction = QtGui.QAction(QtGui.QIcon().fromTheme("document-open"), "Change current source...", self)
     changeSourceAction.triggered.connect(self.changeSource)
     seekBackwardAction = QtGui.QAction(QtGui.QIcon().fromTheme("media-seek-backward"), "Seek backward", self)
     seekBackwardAction.triggered.connect(self.seekBackward)
     seekBackwardAction.setShortcut("Left")
     self.togglePlayPauseAction = QtGui.QAction(QtGui.QIcon().fromTheme("media-playback-start"), "Play/Pause", self)
     self.togglePlayPauseAction.setCheckable(True)
     self.togglePlayPauseAction.triggered.connect(self.togglePlayPause)
     seekForwardAction = QtGui.QAction(QtGui.QIcon().fromTheme("media-seek-forward"), "Seek backward", self)
     seekForwardAction.triggered.connect(self.seekForward)
     seekForwardAction.setShortcut("Right")
     seekAction = QtGui.QAction(QtGui.QIcon().fromTheme("go-jump"), "Seek...", self)
     seekAction.triggered.connect(self.seek)
     self.mainToolBar.addAction(changeSourceAction)
     self.mainToolBar.addAction(seekBackwardAction)
     self.mainToolBar.addAction(self.togglePlayPauseAction)
     self.mainToolBar.addAction(seekForwardAction)
     self.mainToolBar.addAction(seekAction)
     self.addToolBar(self.mainToolBar)
Esempio n. 15
0
 def init(self):
     self.setHasConfigurationInterface(True)
     #Get configuration
     self.configuration = self.config()
     self.launchers = str(self.configuration.readEntry("launchers", self.default_launchers).toString())
     self.launchers = pickle.loads(self.launchers)
     self.use_fixed_width = (self.configuration.readEntry("use_fixed_width", False).toBool())
     self.fixed_width = self.configuration.readEntry("fixed_width", 100).toInt()[0]
     self.layout_orientation = self.configuration.readEntry("layout_orientation", Qt.Horizontal).toInt()[0]
     self.background_type = self.configuration.readEntry("background_type", "default").toString()
     self.show_volume = (self.configuration.readEntry("show_volume", True).toBool())
     self.last_volume = (self.configuration.readEntry("last_volume", 75).toInt())[0]
     self.use_icons = (self.configuration.readEntry("use_icons", True).toBool())
     print self.fixed_width
     
     #basic setup
     self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
     self.theme = Plasma.Svg(self)
     self.theme.setImagePath("widgets/background")
     self.set_background()
     self.media_object = Phonon.MediaObject(self)
     self.active_button= None
     self.audio_out = Phonon.AudioOutput(Phonon.MusicCategory, self)
     #Add the widgets to the layout
     self.refresh_launchers()
     self.setLayout(self.mylayout)
     self.volume_change(self.last_volume)
     
     self.connect(self.media_object, SIGNAL("metaDataChanged()"), self.update_metadata)
     Phonon.createPath(self.media_object, self.audio_out)
Esempio n. 16
0
 def __init__(self, peer, stream_adapter, parent=None):
     super(MainWindow, self).__init__(parent)
     
     self.__track_list = TrackModel()
     
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.trackListView.setModel(self.__track_list)
     self.ui.trackListView.doubleClicked.connect(self.list_double_clicked)
     self.ui.trackListView.clicked.connect(self.list_clicked)
     self.ui.searchBtn.clicked.connect(self.search)
     self.ui.playBtn.clicked.connect(self.play)
     self.ui.stopBtn.clicked.connect(self.stop)
     self.ui.pauseBtn.clicked.connect(self.pause)
     self.setWindowTitle('Zalgo')
       
     self.__peer = peer
     self.__recv_contr = None
     self.__stream_adapter = stream_adapter
     self.__hashes = []
     self.__pid = ''    
     self.__playing_now = None
     
     self.__audio_output = Phonon.AudioOutput(Phonon.MusicCategory, self)
     self.__media_object = Phonon.MediaObject(self)
      
     self.__media_object.setTickInterval(1000)
     self.__media_object.stateChanged.connect(self.state_changed)
     self.__media_object.tick.connect(self.tick)
     
     self.ui.seekSlider.setMediaObject(self.__media_object)
     self.ui.volumeSlider.setAudioOutput(self.__audio_output)
     
     Phonon.createPath(self.__media_object, self.__audio_output)
Esempio n. 17
0
 def __init__(self, parent=None):
     super(LlpMainWindow, self).__init__(parent)
     self.setupUi(self)
     # Setup instance variables
     self._playIcon = QIcon()
     self._playIcon.addPixmap(QPixmap(":/Images/Play"))
     self._pauseIcon = QIcon()
     self._pauseIcon.addPixmap(QPixmap(":/Images/Pause"))
     self._filename = None
     self._total = 0
     self._numDps = 1
     self._oldMs = 0
     self._beatsLeft = 0
     self._beatTimer = None
     self._rewinding = None
     self._forwarding = None
     self._wasPlaying = False
     self._zoom = 1
     self._spool = 0
     self._controls = ControlSet()
     self._scene = MarkedScene(self)
     self._media = Phonon.MediaObject(self)
     self._filterList = []
     self._audio = Phonon.AudioOutput(Phonon.MusicCategory, self)
     self._hsc = self.markView.horizontalScrollBar()
     settings = QSettings()
     self.recentFiles = [unicode(fname) for fname in
                         settings.value("RecentFiles").toStringList()
                         if os.path.exists(unicode(fname))]
     self._knownSongMarks = {}
     self._currentSongHash = None
     self._loadKnownMarks(settings)
     # Connect signals
     self._media.totalTimeChanged.connect(self._totalChanged)
     self._media.stateChanged.connect(self._mediaStateChanged)
     self._media.setTickInterval(TICK_INTERVAL)
     self._media.metaDataChanged.connect(self.printMeta)
     self._media.tick.connect(self._tick)
     self._media.prefinishMarkReached.connect(self._prefinish)
     self._media.finished.connect(self._finish)
     self._hsc.valueChanged.connect(self._setWindow)
     self._scene.currentChanged.connect(self.setCurrent)
     self.volumeSlider.setAudioOutput(self._audio)
     self.actionStartRewind.triggered.connect(self.on_rewindButton_pressed)
     self.actionEndRewind.triggered.connect(self.on_rewindButton_released)
     self.actionStartForward.triggered.connect(self.on_forwardButton_pressed)
     self.actionEndForward.triggered.connect(self.on_forwardButton_released)
     # Final setup
     self.markView.setScene(self._scene)
     self.globalView.setScene(self._scene)
     Phonon.createPath(self._media, self._audio)
     self._setSpool()
     self._tick(0)
     self._checkButtons()
     self._setupActions()
     self._mimeTypes = set()
     self._getAvailableMusicTypes()
     self._buildTypeFilter()
     self._updateRecent()
Esempio n. 18
0
 def __init__(self, parent):
     QObject.__init__(self, parent)
     self.player = Phonon.MediaObject(self)
     self.m_audio = Phonon.AudioOutput(Phonon.MusicCategory, self)
     Phonon.createPath(self.player, self.m_audio)
     self.player.setTickInterval(500)
     self.player.tick.connect(self._update_labels)
     self.player.finished.connect(self.finished)
Esempio n. 19
0
File: main.py Progetto: vkolev/qexfm
 def start_player(self):
     output = Phonon.AudioOutput(Phonon.MusicCategory, self)
     self.m_media = Phonon.MediaObject()
     Phonon.createPath(self.m_media, output)
     self.m_media.setCurrentSource(Phonon.MediaSource(QtCore.QUrl(self.currentSong.get_url())))
     self.seeker.setMediaObject(self.m_media)
     self.m_media.finished.connect(self.next_song)
     self.m_media.play()
Esempio n. 20
0
	def __init__(self):
		QtGui.QPushButton.__init__(self, 'Play')
		self.clicked.connect(self.play)
		# make a MediaSource for this sound
		self.mediaObject = Phonon.MediaObject()
		self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory)
		Phonon.createPath(self.mediaObject, self.audioOutput)
		self.mediaSource = Phonon.MediaSource("sound/sound.wav")
Esempio n. 21
0
 def __init__(self, listaRep):
     self.listaRep = listaRep
     self.cancion_actual = listaRep._head
     self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory)
     self.phonon = Phonon.MediaObject()
     self.phonon = Phonon.createPlayer(Phonon.MusicCategory)
     Phonon.createPath(self.phonon, self.audioOutput)
     self.phonon.setCurrentSource(Phonon.MediaSource(self.cancion_actual.song.archivo))
Esempio n. 22
0
	def __init__ (self, app):
		QObject.__init__ (self)
		self.app = app
		
		self.out = Phonon.AudioOutput (Phonon.MusicCategory, self.app)
		self.media = Phonon.MediaObject (self.app)
		self.media.prefinishMark = 1000
		Phonon.createPath (self.media, self.out)
    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)
 def play(self, index):
     ' play with delay '
     if not self.media:
         self.media = Phonon.MediaObject(self)
         audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
         Phonon.createPath(self.media, audioOutput)
     self.media.setCurrentSource(Phonon.MediaSource(
         self.model.filePath(index)))
     self.media.play()
Esempio n. 25
0
 def play_ding(self):
     try:
         from PyQt4.phonon import Phonon
         self.m_media = Phonon.MediaObject(self)
         audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
         Phonon.createPath(self.m_media, audioOutput)
         self.m_media.setCurrentSource(Phonon.MediaSource(Phonon.MediaSource(self.ding_sound_path)))
         self.m_media.play()
     except:
         print "I can't play sound. for that you need to install phonon on you distribution ;-)"
Esempio n. 26
0
 def reset(self):
     self.queue = []
     self.media = Phonon.MediaObject()
     self.media.finished.connect(self._on_finished)
     Phonon.createPath(self.media, Phonon.AudioOutput(Phonon.MusicCategory,
                       self))
     self.media.stop()
     self.media.clear()
     assert self.media.state() == 1
     assert len(self.media.queue()) == 0
Esempio n. 27
0
 def listenSolution(self):
     s = self.wbwObject.currentSolution()
     h = hashlib.md5(s.encode("utf-8")).hexdigest()
     mp3 = "%s/audio/%s/%s.%s" % (self.coursepath, self.wbwObject.langtts(), h, self.audiotype)
     if os.path.exists(mp3) and audio_module != 'none':
         if not self.media:
             self.media = Phonon.MediaObject(self)
             audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
             Phonon.createPath(self.media, audioOutput)
         self.media.setCurrentSource(Phonon.MediaSource(os.path.abspath(mp3)))
         self.media.play()
Esempio n. 28
0
 def init_phonon(self):
     if not self.player:
         self.player = Phonon.createPlayer(Phonon.MusicCategory)
         self.m_audio = Phonon.AudioOutput(Phonon.MusicCategory, self)
         Phonon.createPath(self.player, self.m_audio)
         self.player.setTickInterval(100)
         # actions
         self.player.tick.connect(self.player_tick)
         self.player.finished.connect(self.player_finished)
         # QSlider -> SeekSlider
         self.slider_time = Phonon.SeekSlider(self.player, self)
Esempio n. 29
0
 def gameAudioConfig(self):
     audio = None
     if QSound.isAvailable():
         audio = 'qsound'
     else:
         from PyQt4.phonon import Phonon
         self.phononSource = Phonon.MediaSource
         self.m_media = Phonon.MediaObject()
         self.audioOut = Phonon.AudioOutput(Phonon.GameCategory)
         Phonon.createPath(self.m_media, self.audioOut)
         audio = 'phonon'
     return audio
Esempio n. 30
0
 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()
Esempio n. 31
0
    def addFiles(self):
        files = QtGui.QFileDialog.getOpenFileNames(
            self, "Select Music Files",
            QtGui.QDesktopServices.storageLocation(
                QtGui.QDesktopServices.MusicLocation))
        if not files:
            return

        index = len(self.sources)

        for string in files:
            self.sources.append(Phonon.MediaSource(string))

        if self.sources:
            self.metaInformationResolver.setCurrentSource(self.sources[index])
Esempio n. 32
0
    def addWidgets(self):
        """ В этом методе мы добавляем виджеты и wприсоединяем обработчики сигналов.
            Обработчик сигнала для виджета так же называется "слотом"
        """

        #camview setup
        #path="C:\\Users\\SCB\\Downloads\\test.avi"

        path = QtCore.QUrl("rtsp://192.168.2.100:7070/")
        media = Phonon.MediaSource(path)
        self.videoPlayer.load(media)
        self.videoPlayer.play()

        #set maps properties
        url = "res.gmap.html"
        page = QtCore.QUrl("../res/gmap.html")
        self.mapView.load(page)

        #thumper pic
        myPixmap = QtGui.QPixmap(_fromUtf8('../res/thumper_top.jpg'))
        self.thumperImage.setPixmap(myPixmap)
        self.thumperImage.setScaledContents(True)

        #camDirection
        myPixmap = QtGui.QPixmap(_fromUtf8('../res/cam.png'))
        myPixmap = myPixmap.transformed(QtGui.QTransform().rotate(
            self.camDirectionAngle))
        self.camDirection.setPixmap(myPixmap)
        self.camDirection.setScaledContents(True)

        #logger
        self.actionSaveLog.triggered.connect(self.saveLog)
        self.actionSaveLog.setShortcut('Ctrl+S')

        #define menu actions
        self.actionExit.triggered.connect(self.exitApp)
        self.actionExit.setShortcut('Ctrl+Q')

        #device state
        #self.connectStateIndicator.connect(self.connectStateIndicator, QtCore.SIGNAL("")
        self.connectStateIndicator.setPixmap(self.device.disconState)
        self.connectStateIndicator.setScaledContents(True)
        self.actionConnect.triggered.connect(self.changeConnectionState)
        self.actionConnect.setShortcut('F5')
        self.resetTelemetry()

        #get state
        self.actionBattery.triggered.connect(self.addMarkerWithLabel)
 def restartPlay(self):
     if self.started:
         duration = self.timeout
         if self.speech and IS_SOUND_WORKING:
             self.disconnect(self.player, QtCore.SIGNAL('finished()'), self.restartPlay)
             self.connect(self.player, QtCore.SIGNAL('finished()'), self.clearLabel)
             self.player.setCurrentSource(Phonon.MediaSource(THREEBELLS))
             duration += THREEBELLS_DURATION
             self.player.play()
         self.isLabelClearable = False
         self.started = False
         self.ui.label.clear()
         self.ui.l_total.hide()
         self.ui.pb_replay.setEnabled(False)
         self.ui.label.setPixmap(QtGui.QPixmap(RESTART))
         QtCore.QTimer.singleShot(duration, self.startPlay)
Esempio n. 34
0
 def playAudio(self, clips, forceAlternateLanguage):
 
     self.player.clear()
     playerQueue = []
 
     for clip in clips:
         filename = self.lookupAudioHash(clip, forceAlternateLanguage)
         if os.path.exists(filename):
             #print 'playing audio: "' + filename + '"'
             playerQueue.append(Phonon.MediaSource(filename))
         else:
             Globals.MainWindow.displayStatusMessage( 'couldn\'t find audio: "' + filename + '"' )
             
     if playerQueue:
         self.player.enqueue(playerQueue)
         self.player.play()
Esempio n. 35
0
    def addFiles(self):
        if not self.file_dir:
            self.file_dir = QtGui.QDesktopServices.storageLocation(
                QtGui.QDesktopServices.MusicLocation)
        files = QtGui.QFileDialog.getOpenFileNames(self, u"Select Music Files",
                                                   self.file_dir)
        if not files:
            return
        index = len(self.sources)
        self.file_dir = "/".join(files[0].split("\\")[:-1])
        # print self.file_dir
        for string in files:
            self.sources.append(Phonon.MediaSource(string))

        if self.sources:  # 刚刚加进来的文件
            self.metaInformationResolver.setCurrentSource(self.sources[index])
Esempio n. 36
0
    def handle_btn_open(self):
        file_dialog = QtGui.QFileDialog(self.view, _('Choose a File'), 
                                      os.path.expanduser('~'),
                                      _('Multimedia File (*.*)'))

        if file_dialog.exec_():
            self.handle_clear_files()
            files = file_dialog.selectedFiles()
            file_name = files[0]
            self.model.append(file_name)
            self.playlist.listview.setCurrentIndex(self.model.index(0))
            self.view.title_widget.lab_movie_name.setText(file_name)
            self.media.setCurrentSource(Phonon.MediaSource(file_name))
            self.media.play()

        ''' Another version - open file ''' 
Esempio n. 37
0
    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)
Esempio n. 38
0
    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)
Esempio n. 39
0
 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
Esempio n. 40
0
 def playIt(self, playfile):
     self.audioOutput = Phonon.AudioOutput(Phonon.VideoCategory, self)
     self.currentFile = playfile
     self.mediasource = Phonon.MediaSource(self.currentFile)
     self.mediaobject = Phonon.MediaObject()
     self.mediaobject.setCurrentSource(self.mediasource)
     Phonon.createPath(self.mediaobject, self)  # test
     self.connect(
         self.mediaobject,
         QtCore.SIGNAL('stateChanged(Phonon::State, Phonon::State)'),
         self.stateChanged)
     Phonon.createPath(self.mediaobject, self.audioOutput)
     self.audioOutput.setVolume(self.volume)
     self.mediaobject.pause()  #check if this prevents hang on next track
     self.mediaobject.play()
Esempio n. 41
0
 def show_correct_image(self, obj_target):
     self.feedback_timer.timeout.disconnect()
     self.feedback_timer.timeout.connect(self.setnexttrial)
     self.feedback_timer.start_timer(CORRECT_IM_SHOW_MS)
     if 'fam' in self.condition:
         im_target = os.path.join(IMAGE_FAM_DIR,
                                  '{}{}'.format(obj_target, IMAGE_FORMAT))
     elif 'new' in self.condition:
         im_target = os.path.join(IMAGE_NEW_DIR,
                                  '{}{}'.format(obj_target, IMAGE_FORMAT))
     screen_h = QDesktopWidget().screenGeometry().height(
     ) if self.fullscreen else MAIN_WINDOW_HEIGHT
     self.im_feedback.setPixmap(
         QtGui.QPixmap(im_target).scaledToHeight(int(screen_h * 0.4)))
     self.audio_media.setCurrentSource(
         Phonon.MediaSource(CORRECT_IM_SHOW_AUDIOPATH))
     self.audio_media.play()
Esempio n. 42
0
 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)
Esempio n. 43
0
    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)
Esempio n. 44
0
    def __init__(self, parent):
        #QGLWidget.__init__(self, parent)
        super(Field, self).__init__(parent)
        self.setMinimumSize(1400, 525)

        # GL settings
        fmt = self.format()
        fmt.setDoubleBuffer(
            True
        )  # always double buffers anyway (watch nVidia setting, do not do it there also n 120 Hz mode)
        fmt.setSampleBuffers(True)
        fmt.setSwapInterval(
            1)  # 0: no sync to v-refresh, number of syncs to wait for
        self.setFormat(fmt)  # PyQt
        if self.format().swapInterval() == -1:
            qWarning(
                "Setting swapinterval not possible, expect synching problems")
        if not self.format().doubleBuffer():
            qWarning("Could not get double buffer; results will be suboptimal")
        self.extrapolationTime = 0
        self.fadeFactor = 1.0  # no fade, fully exposed
        self.state = "sleep"
        self.requestSleep = False
        self.lifetime = 60

        # audio
        self.mediaObject = Phonon.MediaObject(self)
        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
        Phonon.createPath(self.mediaObject, self.audioOutput)
        self.mediaSourceBeep = Phonon.MediaSource("sound\sound2.wav")
        self.mediaSourceNoise = Phonon.MediaSource("sound\wgn.wav")
        self.mediaObject.setCurrentSource(self.mediaSourceNoise)
        ##		self.mediaObject.play()
        ##		self.homingText = pyttsx.init()
        ##		self.homingText.say('Homing.')
        #self.beep = pyglet.resource.media('sound\beep-5.wav')
        self.moveString = "Reference"
        self.t0PreTrial = -1  # -1 for not currently pretrial, >=0 for start time of pretrial state
        self.t0Wait = -1  # -1 for not currently wait, >=0 for start time of wait (response phase)

        # shutter glasses
        try:
            self.shutter = buttonbox.Buttonbox()  # optionally add port="COM17"
            self.openShutter(False, False)
        except Exception as e:
            print(e)

        # experimental conditions
        self.conditions = conditions.Conditions(
            dataKeys=['swapMoves', 'subject'])
        self.nInterval = 1
        self.nBall = 24  # number of stars in ball
Esempio n. 45
0
    def addFiles(self):
        files = QtGui.QFileDialog.getOpenFileNames(self, "Select Music Files",
                QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.MusicLocation))

        if not files:
            return

        index = len(self.sources)
        print files
        for string in files:
            self.sources.append(Phonon.MediaSource(string))
        self.sources = []
        metaData = self.metaInformationResolver.metaData()
        title = metaData.get('TITLE', [''])[0]
        print "!!!"
        print title
        if self.sources:
            self.metaInformationResolver.setCurrentSource(self.sources[index])
Esempio n. 46
0
	def showMedia(self, path, mediaDisplay, autoplay):
		try:
			self._html5 = self._settings.setting("org.openteacher.lessons.media.videohtml5")["value"]
		except:
			self._html5 = False
		
		if self._html5 or mediaDisplay.noPhonon:
			if not mediaDisplay.noPhonon:
				# Stop any media playing
				mediaDisplay.videoPlayer.stop()
			# Set the widget to the web view
			mediaDisplay.setCurrentWidget(mediaDisplay.webviewer)
			# Set the right html
			autoplayhtml = ""
			if autoplay:
				autoplayhtml = '''autoplay="autoplay"'''
			mediaDisplay.webviewer.setHtml('''
			<html><head>
			<title>Video</title>
			<style type="text/css">
			body
			{
			margin: 0px;
			}
			</style>
			</head><body onresize="size()"><video id="player" src="''' + path + '''" ''' + autoplayhtml + ''' controls="controls" />
			<script>
			function size()
			{
				document.getElementById('player').style.width = window.innerWidth;
				document.getElementById('player').style.height = window.innerHeight;
			}
			size()
			</script>
			</body></html>
			''')
		else:
			# Set the widget to video player
			mediaDisplay.setCurrentWidget(mediaDisplay.videoPlayer)
			# Play the video
			mediaDisplay.videoPlayer.play(Phonon.MediaSource(path))
			if not autoplay:
				# Immediately pause it
				mediaDisplay.videoPlayer.pause()
Esempio n. 47
0
 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):
        super(QtGui.QMainWindow, self).__init__()
        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
        self.mediaObject = Phonon.MediaObject(self)
        self.metaInformationResolver = Phonon.MediaObject(self)
        self.mediaObject.setTickInterval(100)
        self.mediaObject.tick.connect(self.tick)

        Phonon.createPath(self.mediaObject, self.audioOutput)

        self.media = Phonon.MediaSource("nuo.mp3")
        self.metaInformationResolver.setCurrentSource(self.media)
        self.mediaObject.setCurrentSource(self.media)
        self.mediaObject.play()
Esempio n. 49
0
 def loadFile(self):
     path = QtGui.QFileDialog.getOpenFileName(
         self, ("Video laden"), '/Axel_1/Filme',
         "Videos (*.mp4 *.ts *.avi *.mpeg *.mpg *.mkv)")
     if path:
         #self.myfilename = unicode(path)
         self.media.setCurrentSource(Phonon.MediaSource(path))
         self.video.setScaleMode(1)
         self.video.setAspectRatio(1)
         self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self)
         Phonon.createPath(self.media, self.audio)
         Phonon.createPath(self.media, self.video)
         self.slider.hide()
         self.media.play()
Esempio n. 50
0
        def mediaLoad(self, file, play=False):

            self.isFinished = False

            try:
                if os.path.exists(file):
                    self.__media__ = Phonon.MediaSource(file)
                    if self.__media__ != None:
                        self.mediaObject.setCurrentSource(self.__media__)

            except:
                self.__media__ = None

            if self.__media__ != None:
                if play:
                    self.mediaPlay()
                else:
                    self.mediaStop()

            return (self.__media__ != None)
Esempio n. 51
0
    def setAlarm(self,sensor_address, sensor_level):
        for p in self.GI:
            if(p.address==sensor_address):
                old_level=p.level
                p.setLevel(sensor_level)
                x=p.pos().x()
                y=p.pos().y()
                id_s=p.id
                sounds=p.sounds.split('|')
        if(sensor_level in [1,2]):


            self.pBSZUOn()
            self.m_media.stop()
            fn="sounds/{}".format(sounds[sensor_level-1])
            if(os.path.exists(fn)==False):
                print('Error: Файл"',fn,'" не найден!')
            self.m_media.setCurrentSource(Phonon.MediaSource(fn))
            self.m_media.play()

        #---33 Уровень равный при первом запуске системы
        if(old_level==33 and not sensor_level in [1,2]):
            st=1
            sb=0
        else:
            st=0
            sb=-1
        self.SaveEvent('Датчик',id_s,sensor_level,self.UserId,st,sb)
        #Информаци для плеера
        if(sensor_level in [1,2]):
            self.ui.lineEditAOm.setText(sounds[sensor_level-1])
            #---------------------------------------------------------------------------------------------------
            fields='sensor.info, stype.info, level.title, event.created, event.id,level.id'
            where='WHERE((event.status_id=0)and(level.id in(1,2,3,4)))'
            sql=self.formatSqlEvent(fields,where)
            query = QtSql.QSqlQuery(sql)
            if(query.next()):
                text = '{}, {}, {} '.format(query.value(0),query.value(1),query.value(2))
                self.ui.lineEditAOs.setText(text)
            #---------------------------------------------------------------------------------
        self.getMessageDB()
Esempio n. 52
0
def create_animation_widget(screen_h):
    # Create the Phonon video player
    animation_player = Phonon.VideoPlayer()
    animation_player.setStyleSheet("QLabel {background-color:blue}")
    size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                    QtGui.QSizePolicy.Preferred)
    animation_player.setSizePolicy(size_policy)
    # The animation size is a square
    animation_player.setFixedSize(screen_h / RATIO_SCREEN_H_ANIMATION_H,
                                  screen_h / RATIO_SCREEN_H_ANIMATION_H)
    animation_widget = QtGui.QWidget()
    animation_layout = QtGui.QHBoxLayout()
    spacer_item_1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding,
                                      QtGui.QSizePolicy.Minimum)
    spacer_item_2 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding,
                                      QtGui.QSizePolicy.Minimum)
    animation_layout.addItem(spacer_item_1)
    animation_layout.addWidget(animation_player)
    animation_layout.addItem(spacer_item_2)
    animation_widget.setLayout(animation_layout)
    return animation_player, animation_widget
Esempio n. 53
0
    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.urlEdit.setText(video.url)
        self.ui.titleLabel.setText(video.title)
        self.ui.durationLabel.setText(unicode(video.duration))
        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)

        self.ui.seekSlider.setMediaObject(self.ui.videoPlayer.mediaObject())
        self.ui.videoPlayer.load(Phonon.MediaSource(QUrl(video.url)))
        self.ui.videoPlayer.play()
Esempio n. 54
0
    def load_and_play_files(self):
        """Presents user with a Dialog box to choose media files. Once selected, it then plays the first
        file among the selected files"""

        files = QFileDialog.getOpenFileNames(self, None, '',
                                             'Media file(*.mp4 *.wmv *.avi *.3gp *.oog *.mpeg *.mp2 *.wma *.mp3)'
                                             ';;All files(*.*)')
        if files == []:
            # If no media files have been selected then don't execute the rest of the code.
            return

        self.media_sources = []
        for file in files:
            self.populate_playlist(file)
            self.media_sources.append(Phonon.MediaSource(file))

        self.mediaObject.setQueue(self.media_sources)  # automatically run all selected file one after the other
        self.mediaObject.play()

        self.stage = 'Track loaded and playing'
        self._enable_disable_buttons()
Esempio n. 55
0
    def now_play_sequence(self, audioseq):
        first = audioseq[0]
        queue = audioseq[1:]

        self.log.debug("Now playing %s" % first)
        self.reset()
        self.media.setCurrentSource(Phonon.MediaSource(first))

        if queue:
            self.log.debug("enqueuing %s" % queue)
            for filename in queue:
                self.enqueue(filename)

        self.media.play()

        if not self.media.currentSource().fileName() == first:
            self.log.debug("should be playing %s but is not" % first)
            self._on_error()
        else:
            self.log.debug("Ok, correctly playing %s (%s)" %
                           (self.media.currentSource(), first))
Esempio n. 56
0
 def setaudio(self):
     """ Choose randomly an audio instruction. Set it to the audio player """
     self.audio_media.clear()
     # Get the number ot the target object
     obj_target_num, _ = self.subject.gettargetname(self.i_trial,
                                                    self.condition)
     # Choose randomly an instruction
     if self.condition in [
             'scrambled-2y_train_fam', 'scrambled-2y_train_new',
             'scrambled-4y_train_fam', 'scrambled-4y_train_new'
     ]:
         test_inst_str = TRAIN_INSTRUCTIONS_SCRAMBLED[randint(0, 2)]
     elif self.response_ver == 'visual':
         test_inst_str = TEST_INSTRUCTIONS_POINTAGE[randint(0, 2)]
     else:
         test_inst_str = TEST_INSTRUCTIONS_TACTILE[randint(0, 2)]
     # Get audio path
     if obj_target_num < 0:  # Familiar objects
         if self.condition == 'scrambled-2y_train_fam':
             audio_dir_path = AUDIO_FAM_SCRAMBLED_2Y_DIR
         elif self.condition == 'scrambled-4y_train_fam':
             audio_dir_path = AUDIO_FAM_SCRAMBLED_4Y_DIR
         else:
             audio_dir_path = AUDIO_FAM_DIR
         obj_name = self.subject.getobjectname(obj_target_num)[0]
         audio_path = os.path.join(
             audio_dir_path, obj_name,
             test_inst_str + '_' + obj_name + AUDIO_FORMAT)
     else:  # New objects
         if self.condition == 'scrambled-2y_train_new':
             audio_dir_path = AUDIO_NEW_SCRAMBLED_2Y_DIR
         elif self.condition == 'scrambled-4y_train_new':
             audio_dir_path = AUDIO_NEW_SCRAMBLED_4Y_DIR
         else:
             audio_dir_path = AUDIO_NEW_DIR
         _, _, pseudo_word = self.subject.getobjectname(obj_target_num)
         audio_path = os.path.join(
             audio_dir_path, pseudo_word,
             test_inst_str + '_' + pseudo_word + AUDIO_FORMAT)
     self.audio_media.setCurrentSource(Phonon.MediaSource(audio_path))
Esempio n. 57
0
 def play(self):
         # self.dlg.listWidget.setStyleSheet('color: green')
         self.player.setCurrentSource(Phonon.MediaSource(os.path.join(str(os.getcwd()),self.list[int(self.dlg.listWidget.currentRow())])))
         self.player.play()
         self.row=self.dlg.listWidget.currentRow()
         # print(self.list[int(self.dlg.listWidget.currentRow())])
         # t.item(0)->setForeground(Qt::red);
         # self.dlg.listWidget.item(self.row).setForeground("red")
         self.dlg.statusbar.showMessage(self.list[int(self.dlg.listWidget.currentRow())])
         try:
             podatki=self.read_id3v2(self.list[int(self.dlg.listWidget.currentRow())])
             print(podatki)
             self.dlg.Izvajalec.setText(podatki[0])
             self.dlg.Naslov.setText(podatki[1])
             self.dlg.Key.setText(podatki[2])
             self.dlg.BPM.setText(podatki[3])
             # self.dlg.labelLength.setText(podatki[4])
             # print(podatki[4])
             # print(podatki)
         except:
             self.dlg.Izvajalec.setText(self.list[int(self.dlg.listWidget.currentRow())])
             pass
Esempio n. 58
0
def main(argv):
    #Parse out the command line arguments
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description=DESCRIPTION,
        epilog=EPILOG)

    parser.add_argument("-d",
                        "--debug",
                        action='store_true',
                        help="Output test debug information")
    parser.add_argument("media",
                        type=str,
                        nargs=1,
                        default="all",
                        help="Media to load")

    args = parser.parse_args()
    if args.debug:
        print "Debug Enabled"
        debug = True

    media_source = args.media[0]
    media_src = Phonon.MediaSource(media_source)

    app = QApplication(sys.argv)
    media_obj = Phonon.MediaObject()
    media_obj.setCurrentSource(media_src)

    video_widget = VW()
    #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()

    sys.exit(app.exec_())
Esempio n. 59
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.setupUi(self)

        # Create Phonon Music Player
        self.phonon = Phonon.createPlayer(Phonon.MusicCategory)
        self.phonon.stateChanged.connect(self.slotPhononStateChanged)
        self.phonon.finished.connect(self.slotPhononPlaybackFinished)

        # Connect signals for buttons
        self.comboBoxUsers.currentIndexChanged.connect(
            self.reflectUserProperties)
        self.pushButtonRecordSample.clicked.connect(self.slotShowRecordWindow)

        # Enable button when item clicked
        self.listWidgetEnrollments.itemClicked.connect(
            lambda: self.pushButtonPlay.setEnabled(True))

        # Play sample if double-clicked
        self.listWidgetEnrollments.itemDoubleClicked.connect(
            self.slotStartPlayback)

        # Start/Stop Playback
        self.pushButtonPlay.clicked.connect(self.slotStartPlayback)
        self.pushButtonStop.clicked.connect(self.slotStopPlayback)
        self.pushButtonTrain.clicked.connect(self.slotShowTrainingDialog)
        self.pushButtonIdentify.clicked.connect(self.slotShowIdentifyDialog)
        self.pushButtonAddSpeaker.clicked.connect(self.slotAddSpeaker)
        self.pushButtonPlayTestingSample.clicked.connect(
            self.slotPlayTestingSample)
        self.lineEditNewSpeaker.textEdited.connect(self.slotCheckNewSpeaker)

        # Create Marf instance
        self.marf = Marf()

        # Fill speaker list
        self.fill_speaker_list()
Esempio n. 60
0
        def fill():
            print "triggered"
            a = l[1:]#list of songs in album
            self.a_files = a
            self.albumsource = []
            for i in a:
                self.albumsource.append(Phonon.MediaSource(i))
            print "list"
            self.albumTable.setRowCount(0)
            self.albumTable.clearContents()
            currentRow = 0
            for i in range(1,len(l)):
                path = l[i]
                line = self.tagGet(path)#get song tags
                
                titleItem = QtGui.QTableWidgetItem(line[0])
                titleItem.setFlags(titleItem.flags() ^ QtCore.Qt.ItemIsEditable)
                
                artistItem = QtGui.QTableWidgetItem(line[1])
                artistItem.setFlags(artistItem.flags() ^ QtCore.Qt.ItemIsEditable)
                artistItem.setTextAlignment(QtCore.Qt.AlignLeft)

                albumItem = QtGui.QTableWidgetItem(line[2])
                albumItem.setFlags(albumItem.flags() ^ QtCore.Qt.ItemIsEditable)
                
                timeItem = QtGui.QTableWidgetItem(str(line[3]))
                timeItem.setFlags(timeItem.flags() ^ QtCore.Qt.ItemIsEditable)
                timeItem.setTextAlignment(QtCore.Qt.AlignCenter)

                
                self.albumTable.insertRow(currentRow)
                self.albumTable.setItem(currentRow, 0, titleItem)
                self.albumTable.setItem(currentRow, 1, artistItem)
                self.albumTable.setItem(currentRow, 2, albumItem)        
                self.albumTable.setItem(currentRow, 3, timeItem)

                self.albumTable.setRowHeight(currentRow, 50)
                currentRow = currentRow + 1