forked from openlp/openlp
Style cleanups
This commit is contained in:
parent
57ad90f1a6
commit
506fd80f89
@ -180,6 +180,7 @@ class MediaController(object):
|
|||||||
Check if there is a running media Player and do updating stuff (e.g.
|
Check if there is a running media Player and do updating stuff (e.g.
|
||||||
update the UI)
|
update the UI)
|
||||||
"""
|
"""
|
||||||
|
print "state"
|
||||||
if not self.currentMediaPlayer.keys():
|
if not self.currentMediaPlayer.keys():
|
||||||
self.timer.stop()
|
self.timer.stop()
|
||||||
else:
|
else:
|
||||||
@ -429,7 +430,8 @@ class MediaController(object):
|
|||||||
'Unsupported File')))
|
'Unsupported File')))
|
||||||
return False
|
return False
|
||||||
self.set_controls_visible(controller, True)
|
self.set_controls_visible(controller, True)
|
||||||
log.debug(u'use %s controller' % self.currentMediaPlayer[controller.controllerType])
|
log.debug(u'use %s controller' %
|
||||||
|
self.currentMediaPlayer[controller.controllerType])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def media_length(self, serviceItem):
|
def media_length(self, serviceItem):
|
||||||
@ -446,7 +448,7 @@ class MediaController(object):
|
|||||||
controller.media_info = MediaInfo()
|
controller.media_info = MediaInfo()
|
||||||
controller.media_info.volume = 0
|
controller.media_info.volume = 0
|
||||||
controller.media_info.file_info = QtCore.QFileInfo(serviceItem
|
controller.media_info.file_info = QtCore.QFileInfo(serviceItem
|
||||||
.get_filename())
|
.get_frame_path())
|
||||||
display = controller.previewDisplay
|
display = controller.previewDisplay
|
||||||
if not self._check_file_type(controller, display, serviceItem):
|
if not self._check_file_type(controller, display, serviceItem):
|
||||||
# Media could not be loaded correctly
|
# Media could not be loaded correctly
|
||||||
@ -463,7 +465,8 @@ class MediaController(object):
|
|||||||
return False
|
return False
|
||||||
serviceItem.set_media_length(controller.media_info.length)
|
serviceItem.set_media_length(controller.media_info.length)
|
||||||
self.media_stop(controller)
|
self.media_stop(controller)
|
||||||
log.debug(u'use %s controller' % self.currentMediaPlayer[controller.controllerType])
|
log.debug(u'use %s controller' %
|
||||||
|
self.currentMediaPlayer[controller.controllerType])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _check_file_type(self, controller, display, serviceItem):
|
def _check_file_type(self, controller, display, serviceItem):
|
||||||
@ -490,12 +493,14 @@ class MediaController(object):
|
|||||||
player.canBackground:
|
player.canBackground:
|
||||||
self.resize(display, player)
|
self.resize(display, player)
|
||||||
if player.load(display):
|
if player.load(display):
|
||||||
self.currentMediaPlayer[controller.controllerType] = player
|
self.currentMediaPlayer[controller.controllerType] \
|
||||||
|
= player
|
||||||
controller.media_info.media_type = MediaType.Video
|
controller.media_info.media_type = MediaType.Video
|
||||||
return True
|
return True
|
||||||
if suffix in player.audio_extensions_list:
|
if suffix in player.audio_extensions_list:
|
||||||
if player.load(display):
|
if player.load(display):
|
||||||
self.currentMediaPlayer[controller.controllerType] = player
|
self.currentMediaPlayer[controller.controllerType] \
|
||||||
|
= player
|
||||||
controller.media_info.media_type = MediaType.Audio
|
controller.media_info.media_type = MediaType.Audio
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
@ -504,7 +509,8 @@ class MediaController(object):
|
|||||||
if player.canFolder:
|
if player.canFolder:
|
||||||
self.resize(display, player)
|
self.resize(display, player)
|
||||||
if player.load(display):
|
if player.load(display):
|
||||||
self.currentMediaPlayer[controller.controllerType] = player
|
self.currentMediaPlayer[controller.controllerType] \
|
||||||
|
= player
|
||||||
controller.media_info.media_type = MediaType.Video
|
controller.media_info.media_type = MediaType.Video
|
||||||
return True
|
return True
|
||||||
# no valid player found
|
# no valid player found
|
||||||
@ -534,14 +540,11 @@ class MediaController(object):
|
|||||||
return False
|
return False
|
||||||
if status:
|
if status:
|
||||||
display.frame.evaluateJavaScript(u'show_blank("desktop");')
|
display.frame.evaluateJavaScript(u'show_blank("desktop");')
|
||||||
self.currentMediaPlayer[controller.controllerType].set_visible(display,
|
self.currentMediaPlayer[controller.controllerType]\
|
||||||
True)
|
.set_visible(display, True)
|
||||||
controller.mediabar.actions[u'playbackPlay'] \
|
controller.mediabar.actions[u'playbackPlay'].setVisible(False)
|
||||||
.setVisible(False)
|
controller.mediabar.actions[u'playbackStop'].setVisible(True)
|
||||||
controller.mediabar.actions[u'playbackStop'] \
|
controller.mediabar.actions[u'playbackPause'].setVisible(True)
|
||||||
.setVisible(True)
|
|
||||||
controller.mediabar.actions[u'playbackPause'] \
|
|
||||||
.setVisible(True)
|
|
||||||
if controller.isLive:
|
if controller.isLive:
|
||||||
if controller.hideMenu.defaultAction().isChecked():
|
if controller.hideMenu.defaultAction().isChecked():
|
||||||
controller.hideMenu.defaultAction().trigger()
|
controller.hideMenu.defaultAction().trigger()
|
||||||
@ -570,12 +573,9 @@ class MediaController(object):
|
|||||||
log.debug(u'media_pause')
|
log.debug(u'media_pause')
|
||||||
display = self._define_display(controller)
|
display = self._define_display(controller)
|
||||||
self.currentMediaPlayer[controller.controllerType].pause(display)
|
self.currentMediaPlayer[controller.controllerType].pause(display)
|
||||||
controller.mediabar.actions[u'playbackPlay'] \
|
controller.mediabar.actions[u'playbackPlay'].setVisible(True)
|
||||||
.setVisible(True)
|
controller.mediabar.actions[u'playbackStop'].setVisible(True)
|
||||||
controller.mediabar.actions[u'playbackStop'] \
|
controller.mediabar.actions[u'playbackPause'].setVisible(False)
|
||||||
.setVisible(True)
|
|
||||||
controller.mediabar.actions[u'playbackPause'] \
|
|
||||||
.setVisible(False)
|
|
||||||
|
|
||||||
def media_stop_msg(self, msg):
|
def media_stop_msg(self, msg):
|
||||||
"""
|
"""
|
||||||
@ -595,18 +595,17 @@ class MediaController(object):
|
|||||||
The controller that needs to be stopped
|
The controller that needs to be stopped
|
||||||
"""
|
"""
|
||||||
log.debug(u'media_stop')
|
log.debug(u'media_stop')
|
||||||
|
print "play"
|
||||||
display = self._define_display(controller)
|
display = self._define_display(controller)
|
||||||
if display in self.currentMediaPlayer:
|
if display in self.currentMediaPlayer:
|
||||||
display.frame.evaluateJavaScript(u'show_blank("black");')
|
display.frame.evaluateJavaScript(u'show_blank("black");')
|
||||||
self.currentMediaPlayer[controller.controllerType].stop(display)
|
self.currentMediaPlayer[controller.controllerType].stop(display)
|
||||||
self.currentMediaPlayer[controller.controllerType].set_visible(display, False)
|
self.currentMediaPlayer[controller.controllerType] \
|
||||||
|
.set_visible(display, False)
|
||||||
controller.seekSlider.setSliderPosition(0)
|
controller.seekSlider.setSliderPosition(0)
|
||||||
controller.mediabar.actions[u'playbackPlay'] \
|
controller.mediabar.actions[u'playbackPlay'].setVisible(True)
|
||||||
.setVisible(True)
|
controller.mediabar.actions[u'playbackStop'].setVisible(False)
|
||||||
controller.mediabar.actions[u'playbackStop'] \
|
controller.mediabar.actions[u'playbackPause'].setVisible(False)
|
||||||
.setVisible(False)
|
|
||||||
controller.mediabar.actions[u'playbackPause'] \
|
|
||||||
.setVisible(False)
|
|
||||||
|
|
||||||
def media_volume(self, msg):
|
def media_volume(self, msg):
|
||||||
"""
|
"""
|
||||||
@ -633,7 +632,8 @@ class MediaController(object):
|
|||||||
controller = msg[0]
|
controller = msg[0]
|
||||||
seekVal = msg[1][0]
|
seekVal = msg[1][0]
|
||||||
display = self._define_display(controller)
|
display = self._define_display(controller)
|
||||||
self.currentMediaPlayer[controller.controllerType].seek(display, seekVal)
|
self.currentMediaPlayer[controller.controllerType] \
|
||||||
|
.seek(display, seekVal)
|
||||||
|
|
||||||
def media_reset(self, controller):
|
def media_reset(self, controller):
|
||||||
"""
|
"""
|
||||||
@ -645,7 +645,8 @@ class MediaController(object):
|
|||||||
if display in self.currentMediaPlayer:
|
if display in self.currentMediaPlayer:
|
||||||
display.override = {}
|
display.override = {}
|
||||||
self.currentMediaPlayer[controller.controllerType].reset(display)
|
self.currentMediaPlayer[controller.controllerType].reset(display)
|
||||||
self.currentMediaPlayer[controller.controllerType].set_visible(display, False)
|
self.currentMediaPlayer[controller.controllerType] \
|
||||||
|
.set_visible(display, False)
|
||||||
display.frame.evaluateJavaScript(u'show_video( \
|
display.frame.evaluateJavaScript(u'show_video( \
|
||||||
"setBackBoard", null, null, null,"hidden");')
|
"setBackBoard", null, null, null,"hidden");')
|
||||||
del self.currentMediaPlayer[controller.controllerType]
|
del self.currentMediaPlayer[controller.controllerType]
|
||||||
@ -662,9 +663,11 @@ class MediaController(object):
|
|||||||
return
|
return
|
||||||
controller = self.mainWindow.liveController
|
controller = self.mainWindow.liveController
|
||||||
display = self._define_display(controller)
|
display = self._define_display(controller)
|
||||||
if self.currentMediaPlayer[controller.controllerType].state == MediaState.Playing:
|
if self.currentMediaPlayer[controller.controllerType].state \
|
||||||
|
== MediaState.Playing:
|
||||||
self.currentMediaPlayer[controller.controllerType].pause(display)
|
self.currentMediaPlayer[controller.controllerType].pause(display)
|
||||||
self.currentMediaPlayer[controller.controllerType].set_visible(display, False)
|
self.currentMediaPlayer[controller.controllerType] \
|
||||||
|
.set_visible(display, False)
|
||||||
|
|
||||||
def media_blank(self, msg):
|
def media_blank(self, msg):
|
||||||
"""
|
"""
|
||||||
@ -681,9 +684,11 @@ class MediaController(object):
|
|||||||
Receiver.send_message(u'live_display_hide', hide_mode)
|
Receiver.send_message(u'live_display_hide', hide_mode)
|
||||||
controller = self.mainWindow.liveController
|
controller = self.mainWindow.liveController
|
||||||
display = self._define_display(controller)
|
display = self._define_display(controller)
|
||||||
if self.currentMediaPlayer[controller.controllerType].state == MediaState.Playing:
|
if self.currentMediaPlayer[controller.controllerType].state \
|
||||||
|
== MediaState.Playing:
|
||||||
self.currentMediaPlayer[controller.controllerType].pause(display)
|
self.currentMediaPlayer[controller.controllerType].pause(display)
|
||||||
self.currentMediaPlayer[controller.controllerType].set_visible(display, False)
|
self.currentMediaPlayer[controller.controllerType] \
|
||||||
|
.set_visible(display, False)
|
||||||
|
|
||||||
def media_unblank(self, msg):
|
def media_unblank(self, msg):
|
||||||
"""
|
"""
|
||||||
@ -699,9 +704,11 @@ class MediaController(object):
|
|||||||
return
|
return
|
||||||
controller = self.mainWindow.liveController
|
controller = self.mainWindow.liveController
|
||||||
display = self._define_display(controller)
|
display = self._define_display(controller)
|
||||||
if self.currentMediaPlayer[controller.controllerType].state != MediaState.Playing:
|
if self.currentMediaPlayer[controller.controllerType].state \
|
||||||
|
!= MediaState.Playing:
|
||||||
if self.currentMediaPlayer[controller.controllerType].play(display):
|
if self.currentMediaPlayer[controller.controllerType].play(display):
|
||||||
self.currentMediaPlayer[controller.controllerType].set_visible(display, True)
|
self.currentMediaPlayer[controller.controllerType] \
|
||||||
|
.set_visible(display, True)
|
||||||
# Start Timer for ui updates
|
# Start Timer for ui updates
|
||||||
if not self.timer.isActive():
|
if not self.timer.isActive():
|
||||||
self.timer.start()
|
self.timer.start()
|
||||||
|
Loading…
Reference in New Issue
Block a user