本文整理汇总了Python中PySide.phonon.Phonon.createPath方法的典型用法代码示例。如果您正苦于以下问题:Python Phonon.createPath方法的具体用法?Python Phonon.createPath怎么用?Python Phonon.createPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.phonon.Phonon
的用法示例。
在下文中一共展示了Phonon.createPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def __init__(self, parent=None):
super(Movie, self).__init__(parent)
self.audioOutput = Phonon.AudioOutput(Phonon.VideoCategory)
self.mediaObject = Phonon.MediaObject(self)
self.mediaObject.setTickInterval(1)
Phonon.createPath(self.mediaObject, self)
Phonon.createPath(self.mediaObject, self.audioOutput)
self.overlay = DrawWidge(self)
self.overlay.resize(self.width(), self.height())
self.overlay.hide()
self.overlay_showing = False
self.image = DrawWidge(self)
self.image.resize(self.width(), self.height())
self.image.hide()
self.image_showing = False
self.fulled = False
self.subtitler = SubtitleWidge(self)
self.subtitler.resize(self.width(), self.height())
self.subtitler.hide()
self.subtitler_showing = False
self.save_timer = SaveCloser()
self.save_timer.start()
self.setupActions()
示例2: go
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def go(self, what2do, folder):
'''This function is called from javascript when clicking
the tracks, info or play all buttons'''
print('what 2 to',str(what2do))
what2do = str(what2do)
# stop playback when exiting the page
self.eval_js(self.doc,
'''window.addEventListener("unload", setup_files.stop, false);''')
if what2do == 'play_all':
tracks, folder_wrapper = self.get_folder_tracks(folder)
self.curtrack = 0
self.playlist = tracks
self.cur_folder = folder_wrapper
self.create_player()
self.create_buttons_events()
self.media_object = Phonon.MediaObject(self)
self.audio = Phonon.AudioOutput(Phonon.MusicCategory)
self.media_object.setTickInterval(1000)
self.media_object.tick.connect(self.draw_time)
self.media_object.stateChanged.connect(self.stateChanged)
self.media_object.finished.connect(self.next)
Phonon.createPath(self.media_object, self.audio)
if what2do == 'show_info':
self.show_hide_info(folder,'div.info')
if what2do == 'show_tracks':
self.show_hide_info(folder,'div.files_table_wrapper')
示例3: init
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def init(self, prefinishMark):
self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self.app)
self.player = Phonon.MediaObject(self.app)
self.player.setPrefinishMark(prefinishMark)
self.player.setTickInterval(1000)
Phonon.createPath(self.player, self.audioOutput)
self._bindEvents()
示例4: __init__
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def __init__(self):
super(Tramendo, self).__init__()
# Menu
self.trayIconMenu = QMenu(self)
# Build media player
self.audioOuptut = Phonon.AudioOutput(Phonon.MusicCategory, self)
self.player = Phonon.MediaObject(self)
Phonon.createPath(self.player, self.audioOuptut)
# Jamendo Actions
self.jamendo = JamendoRadio()
self.radioActions = QActionGroup(self)
self.radioActions.setExclusive(True)
self.radioActions.triggered.connect(self.play_stream_event)
radio_stations = self.jamendo.get_radio_list()
for radio in radio_stations:
action = QAction(radio["dispname"], self)
action.setCheckable(True)
action.setData(radio["id"])
self.radioActions.addAction(action)
self.trayIconMenu.addAction(action)
# Exit Action
self.quitAction = QAction("&Exit", self)
self.quitAction.triggered.connect(self.exit_event)
self.trayIconMenu.addAction(self.quitAction)
# Icon setting
self.trayIcon = QSystemTrayIcon(self)
self.trayIcon.setContextMenu(self.trayIconMenu)
self.trayIcon.setIcon(QApplication.style().standardIcon(QStyle.SP_MediaPlay))
self.trayIcon.show()
示例5: __init__
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.ui=Ui_toolBoxWidget()
self.ui.setupUi(self)
# volumeSlider_bombMusic
self.media = Phonon.MediaObject(self)
self.media.setCurrentSource(Phonon.MediaSource())
self.media.setTickInterval(10)
self.output = Phonon.AudioOutput(Phonon.MusicCategory, self)
Phonon.createPath(self.media, self.output)
self.ui.volumeSlider_music.setAudioOutput(self.output)
self.ui.seekSlider_musicProgress.setMediaObject(self.media)
self.ui.lcdNumber.display("00:00")
self.media.stateChanged.connect(self.stateChanged)
self.media.tick.connect(self.tick)
self.ui.pushButton_musicPlay.clicked.connect(self.changePlayPause)
self.ui.pushButton_musicStop.clicked.connect(self.changeStop)
self.ui.timeEdit_music.timeChanged.connect(self.timeEditTimeChanged)
self.path = None
self.signal = FileChoosedSignal()
示例6: play_sound
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def play_sound(self, alias):
""" Plays a sound
CHECK
When exporting sound over HDMI, the first time the first sound is
played, the beginning of it gets cut off.
It might be worth including a 1 millisecond silent .wave and playing
it with the volume turned to 0 on app load (init_sound() or some
such), to ensure the sound system has been initialized. Or something.
This doesn't seem to happen when the sound is local.
Arguments:
alias (str): The name of a sound file alias as specified in a .qrc
file, eg "mysound.wav"
"""
speakers = Phonon.AudioOutput(Phonon.MusicCategory, self)
media = Phonon.MediaObject(self)
speakers.setVolume(0.5)
Phonon.createPath(media, speakers)
media.setCurrentSource( ":/{}".format(alias) )
### If we let the media file play all the way through, we get a nasty
### static squelch at the end. Set it to stop playing 30 milliseconds
### before the end.
media.setPrefinishMark(30)
media.prefinishMarkReached.connect( media.stop )
media.play()
示例7: __init__
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
self.mediaObject = Phonon.MediaObject(self)
self.metaInformationResolver = Phonon.MediaObject(self)
self.mediaObject.setTickInterval(1000)
self.connect(self.mediaObject, QtCore.SIGNAL('tick(qint64)'),
self.tick)
self.connect(self.mediaObject,
QtCore.SIGNAL('stateChanged(Phonon::State, Phonon::State)'),
self.stateChanged)
self.connect(self.metaInformationResolver,
QtCore.SIGNAL('stateChanged(Phonon::State, Phonon::State)'),
self.metaStateChanged)
self.connect(self.mediaObject,
QtCore.SIGNAL('currentSourceChanged(Phonon::MediaSource)'),
self.sourceChanged)
self.connect(self.mediaObject, QtCore.SIGNAL('aboutToFinish()'),
self.aboutToFinish)
Phonon.createPath(self.mediaObject, self.audioOutput)
self.setupActions()
self.setupMenus()
self.setupUi()
self.timeLcd.display("00:00")
self.sources = []
示例8: initializeAudioPhonon
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def initializeAudioPhonon(self):
if self.DEBUG:
print "INFO: [Plugin:Orbit] Using Phonon Audio Framework"
self.initializeAudioFilePath()
self.media = Phonon.MediaObject()
#print dir(self.media)
audio = Phonon.AudioOutput(Phonon.MusicCategory)
Phonon.createPath(self.media, audio)
f = QtCore.QFile(self.audio_file)
if f.exists():
source = Phonon.MediaSource(self.audio_file)
if source.type() != -1: # -1 stands for invalid file
self.media.setCurrentSource(source)
self.media.play()
else:
if self.DEBUG:
print "ERROR: [Plugin:Orbit] Audio control file invalid:",
print self.audio_file
else:
if self.DEBUG:
print "ERROR: [Plugin:Orbit] Audio control file does not exist:,"
print self.audio_file
示例9: __init__
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def __init__(self, parent=None):
QMainWindow.__init__(self, parent)
self.setWindowFilePath('No file')
# the media object controls the playback
self.media = Phonon.MediaObject(self)
# the audio output does the actual sound playback
self.audio_output = Phonon.AudioOutput(Phonon.MusicCategory, self)
# a slider to seek to any given position in the playback
self.seeker = Phonon.SeekSlider(self)
self.setCentralWidget(self.seeker)
# link media objects together. The seeker will seek in the created
# media object
self.seeker.setMediaObject(self.media)
# audio data from the media object goes to the audio output object
Phonon.createPath(self.media, self.audio_output)
# set up actions to control the playback
self.actions = self.addToolBar('Actions')
for name, label, icon_name in self.ACTIONS:
icon = self.style().standardIcon(icon_name)
action = QAction(icon, label, self)
action.setObjectName(name)
self.actions.addAction(action)
if name == 'open':
action.triggered.connect(self._ask_open_filename)
else:
action.triggered.connect(getattr(self.media, name))
# whenever the playback state changes, show a message to the user
self.media.stateChanged.connect(self._show_state_message)
示例10: __init__
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def __init__(self):
super(Reproductor, self).__init__(parent=None)
self.setWindowTitle("Python Simple Player")
self.gridLayout = QtGui.QGridLayout(self)
loader = QtUiTools.QUiLoader()
# QtCore.QFile
file = QtCore.QFile("repro.ui")
file.open(QtCore.QFile.ReadOnly)
self.ui = loader.load(file, self)
file.close()
self.gridLayout.addWidget(self.ui, 0, 0, 1, 1)
# seccion multimedia
self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
self.mediaObject = Phonon.MediaObject(self)
Phonon.createPath(self.mediaObject, self.audioOutput)
self.mediaObject.setTickInterval(1000)
#
self.ui.lcdAvance.display("00:00")
QtCore.QObject.connect(
self.ui.btnArchivo,
QtCore.SIGNAL("clicked()"),
self.openFile)
QtCore.QObject.connect(
self.ui.btnPlay,
QtCore.SIGNAL("clicked()"),
self.play)
self.mediaObject.tick.connect(self.alAvanzar)
self.mediaObject.stateChanged.connect(self.alCambiarEstado)
示例11: __init__
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def __init__(self):
super(MainWindow, self).__init__()
self.media = Phonon.MediaObject(self)
self.audio = Phonon.AudioOutput(Phonon.MusicCategory, self)
self.video = Phonon.VideoWidget(self)
self.metaInformationResolver = Phonon.MediaObject(self)
Phonon.createPath(self.media, self.audio)
Phonon.createPath(self.media, self.video)
self.media.setTickInterval(1000)
self.sources = []
self.setupActions()
self.setupConnections()
self.setupUi()
self.setWindowTitle("BLue PLayer")
self.setMinimumSize(245,245)
self.resize(680,400)
示例12: getMusicTime
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def getMusicTime(self):
from PySide.phonon import Phonon
self.media2 = Phonon.MediaObject(self)
self.media2.setCurrentSource(Phonon.MediaSource())
self.media2.setCurrentSource(Phonon.MediaSource(self.path))
output = Phonon.AudioOutput(Phonon.MusicCategory, self)
Phonon.createPath(self.media2, output)
self.media2.stateChanged.connect(self.stateChanged2)
示例13: __init__
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def __init__(self):
self.backend = 'Phonon'
QtCore.QObject.__init__(self)
self.audioOuptut = Phonon.AudioOutput(Phonon.MusicCategory, self)
self.player = Phonon.MediaObject(self)
Phonon.createPath(self.player, self.audioOuptut)
self.connectedWidgets = []
self.player.aboutToFinish.connect(self.onPlaybackEnded)
示例14: __init__
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def __init__(self, setup=False, **kwargs):
QMainWindow.__init__(self)
self.setWindowTitle('...')
# time to syncronize plot and media object
self.tShift = 0
self.t = 0
self.mpl = {}
self.ca_widget_handle = []
self.ca_bar_handle = []
# bools to know if the timer is to be activated
# refresh timer
self.refresh = 15 # ms
self.timer = QtCore.QTimer()
self.timer.setInterval(self.refresh)
self.lcd = QtGui.QLCDNumber(self)
self.lcd.setDigitCount(5)
self.lcd.display("{:+05.1f}".format(self.t))
# phonon
# the media object controls the playback
self.media = Phonon.MediaObject(self)
self.audio_output = Phonon.AudioOutput(Phonon.MusicCategory, self)
self.seeker = Phonon.SeekSlider(self)
self.seeker.setFixedHeight(35)
self.seeker.setMediaObject(self.media)
self.media.setTickInterval(20)
# audio data from the media object goes to the audio output object
Phonon.createPath(self.media, self.audio_output)
# set up actions to control the playback
ACTIONS = [
('play', 'Play', QStyle.SP_MediaPlay),
('pause', 'Pause', QStyle.SP_MediaPause),
('stop', 'Stop', QStyle.SP_MediaStop)]
self.actions = self.addToolBar('Actions')
for name, label, icon_name in ACTIONS:
icon = self.style().standardIcon(icon_name)
action = QtGui.QAction(icon, label, self, )
action.setObjectName(name)
self.actions.addAction(action)
action.triggered.connect(getattr(self.media, name))
self.actions.addSeparator()
# show help
helpAction = QtGui.QAction('&Help', self)
helpAction.setObjectName(name)
self.actions.addAction(helpAction)
helpAction.triggered.connect(self.show_help)
# layout
self.vBox = QtGui.QVBoxLayout()
hBox = QtGui.QHBoxLayout()
hBox.addWidget(self.lcd)
hBox.addWidget(self.seeker)
self.vBox.addLayout(hBox)
# finish setup
if setup:
self.setup(**kwargs)
示例15: __init__
# 需要导入模块: from PySide.phonon import Phonon [as 别名]
# 或者: from PySide.phonon.Phonon import createPath [as 别名]
def __init__(self,audio=True,vibra=True):
_d = NotifierDebug();
self._d = _d.d;
self.manager = MNotificationManager('wazappnotify','WazappNotify');
self.vibra = vibra
self.personalRingtone = WAConstants.DEFAULT_SOUND_NOTIFICATION;
self.personalVibrate = True;
self.groupRingtone = WAConstants.DEFAULT_SOUND_NOTIFICATION;
self.groupVibrate = True;
QCoreApplication.setApplicationName("Wazapp");
self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, None)
self.mediaObject = Phonon.MediaObject(None)
Phonon.createPath(self.mediaObject, self.audioOutput)
self.profileChanged(0, 0, self.getCurrentProfile(), 0)
bus = dbus.SessionBus()
mybus = bus.get_object('com.nokia.profiled', '/com/nokia/profiled')
self.nface = dbus.Interface(mybus, 'com.nokia.profiled')
self.nface.connect_to_signal("profile_changed", self.profileChanged)
#prof = self.getCurrentProfile()
#reply = self.nface.get_value(prof,"ringing.alert.volume");
#self.currentProfile = prof
#self.currentVolume = "1.0" if reply=="100" else "0." + reply
#self._d("Checking current profile: " + prof + " - Volume: " + self.currentVolume)
#self.audioOutput.setVolume(float(self.currentVolume))
#self.newMessageSound = WAConstants.DEFAULT_SOUND_NOTIFICATION #fetch from settings
self.devInfo = QSystemDeviceInfo();
#self.devInfo.currentProfileChanged.connect(self.profileChanged);
self.audio = True
'''if audio:
self.audio = QMediaPlayer(None,QMediaPlayer.LowLatency);
self.audio.setVolume(100);
else:
self.audio = False'''
self.enabled = True
self.notifications = {}
# vibration comes too early here, now handled by ui.py when the message is already added in QML
# well, the truth is that sound comes too late... :D
#>> Any notification should be handler by the notifier, not UI :P I don't feel it's too early though,
# but if necessary connect to a signal and vibrate from here.
if self.vibra:
self.vibra = QFeedbackHapticsEffect();
self.vibra.setIntensity(1.0);
self.vibra.setDuration(200);