Live Initialisation Delayed

This commit is contained in:
Tim Bentley 2011-04-29 12:55:49 +01:00
parent e6f69c01f4
commit 4304d111f1

View File

@ -71,6 +71,8 @@ class MainDisplay(DisplayWidget):
self.videoHide = False self.videoHide = False
self.override = {} self.override = {}
self.retranslateUi() self.retranslateUi()
self.mediaObject = None
self.firstTime = True
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool |
QtCore.Qt.WindowStaysOnTopHint) QtCore.Qt.WindowStaysOnTopHint)
@ -104,19 +106,10 @@ class MainDisplay(DisplayWidget):
self.screen[u'size'].width(), self.screen[u'size'].height())) self.screen[u'size'].width(), self.screen[u'size'].height()))
log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number) log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number)
if self.needsPhonon: if self.needsPhonon:
self.mediaObject = Phonon.MediaObject(self) if self.firstTime:
self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject) self.firstTime = False
Phonon.createPath(self.mediaObject, self.videoWidget) else:
Phonon.createPath(self.mediaObject, self.audio) self.createMediaObject()
QtCore.QObject.connect(self.mediaObject,
QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'),
self.videoState)
QtCore.QObject.connect(self.mediaObject,
QtCore.SIGNAL(u'finished()'),
self.videoFinished)
QtCore.QObject.connect(self.mediaObject,
QtCore.SIGNAL(u'tick(qint64)'),
self.videoTick)
log.debug(u'Setup webView for monitor %s' % self.screens.monitor_number) log.debug(u'Setup webView for monitor %s' % self.screens.monitor_number)
self.webView = QtWebKit.QWebView(self) self.webView = QtWebKit.QWebView(self)
self.webView.setGeometry(0, 0, self.webView.setGeometry(0, 0,
@ -177,6 +170,21 @@ class MainDisplay(DisplayWidget):
log.debug( log.debug(
u'Finished setup for monitor %s' % self.screens.monitor_number) u'Finished setup for monitor %s' % self.screens.monitor_number)
def createMediaObject(self):
self.mediaObject = Phonon.MediaObject(self)
self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
Phonon.createPath(self.mediaObject, self.videoWidget)
Phonon.createPath(self.mediaObject, self.audio)
QtCore.QObject.connect(self.mediaObject,
QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'),
self.videoState)
QtCore.QObject.connect(self.mediaObject,
QtCore.SIGNAL(u'finished()'),
self.videoFinished)
QtCore.QObject.connect(self.mediaObject,
QtCore.SIGNAL(u'tick(qint64)'),
self.videoTick)
def text(self, slide): def text(self, slide):
""" """
Add the slide text from slideController Add the slide text from slideController
@ -350,6 +358,8 @@ class MainDisplay(DisplayWidget):
""" """
Loads and starts a video to run with the option of sound Loads and starts a video to run with the option of sound
""" """
if not self.mediaObject:
self.createMediaObject()
log.debug(u'video') log.debug(u'video')
self.webLoaded = True self.webLoaded = True
self.setGeometry(self.screen[u'size']) self.setGeometry(self.screen[u'size'])