cleanups and minor fixes

This commit is contained in:
Tim Bentley 2012-11-01 18:45:12 +00:00
parent a91dc027d2
commit 6047657741
2 changed files with 18 additions and 22 deletions

View File

@ -50,11 +50,12 @@ class MediaController(object):
displayControllers are an array of controllers keyed on the displayControllers are an array of controllers keyed on the
slidecontroller or plugin which built them. ControllerType is the class slidecontroller or plugin which built them. ControllerType is the class
containing the keys. containing the key values.
mediaPlayers are an array of media players keyed on player name mediaPlayers are an array of media players keyed on player name.
currentMediaPlayer is an array of player instances keyed on @fixme.
currentMediaPlayer is an array of player instances keyed on fix me.
""" """
def __init__(self, parent): def __init__(self, parent):
@ -148,8 +149,8 @@ class MediaController(object):
if sys.platform == 'darwin' and filename == 'vlcplayer.py': if sys.platform == 'darwin' and filename == 'vlcplayer.py':
log.warn(u'Disabling vlc media player') log.warn(u'Disabling vlc media player')
continue continue
if filename.endswith(u'player.py')and not\ if filename.endswith(u'player.py') and \
filename == 'mediaplayer.py': not filename == 'mediaplayer.py':
path = os.path.join(controller_dir, filename) path = os.path.join(controller_dir, filename)
if os.path.isfile(path): if os.path.isfile(path):
modulename = u'openlp.core.ui.media.' + \ modulename = u'openlp.core.ui.media.' + \
@ -503,7 +504,7 @@ class MediaController(object):
for title in usedPlayers: for title in usedPlayers:
player = self.mediaPlayers[title] player = self.mediaPlayers[title]
if player.canFolder: if player.canFolder:
self.resize(controller, display, player) self.resize(display, player)
if player.load(display): if player.load(display):
self.currentMediaPlayer[display] = player self.currentMediaPlayer[display] = player
controller.media_info.media_type = MediaType.Video controller.media_info.media_type = MediaType.Video
@ -530,7 +531,6 @@ class MediaController(object):
The controller to be played The controller to be played
""" """
log.debug(u'media_play') log.debug(u'media_play')
display = self._define_display(controller) display = self._define_display(controller)
if not self.currentMediaPlayer[display].play(display): if not self.currentMediaPlayer[display].play(display):
return False return False
@ -538,11 +538,11 @@ class MediaController(object):
display.frame.evaluateJavaScript(u'show_blank("desktop");') display.frame.evaluateJavaScript(u'show_blank("desktop");')
self.currentMediaPlayer[display].set_visible(display, self.currentMediaPlayer[display].set_visible(display,
True) True)
controller.mediabar.actions[u'playbackPlay']\ controller.mediabar.actions[u'playbackPlay'] \
.setVisible(False) .setVisible(False)
controller.mediabar.actions[u'playbackStop']\ controller.mediabar.actions[u'playbackStop'] \
.setVisible(True) .setVisible(True)
controller.mediabar.actions[u'playbackPause']\ controller.mediabar.actions[u'playbackPause'] \
.setVisible(True) .setVisible(True)
if controller.isLive: if controller.isLive:
if controller.hideMenu.defaultAction().isChecked(): if controller.hideMenu.defaultAction().isChecked():
@ -572,11 +572,11 @@ 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[display].pause(display) self.currentMediaPlayer[display].pause(display)
controller.mediabar.actions[u'playbackPlay']\ controller.mediabar.actions[u'playbackPlay'] \
.setVisible(True) .setVisible(True)
controller.mediabar.actions[u'playbackStop']\ controller.mediabar.actions[u'playbackStop'] \
.setVisible(True) .setVisible(True)
controller.mediabar.actions[u'playbackPause']\ controller.mediabar.actions[u'playbackPause'] \
.setVisible(False) .setVisible(False)
def media_stop_msg(self, msg): def media_stop_msg(self, msg):
@ -603,11 +603,11 @@ class MediaController(object):
self.currentMediaPlayer[display].stop(display) self.currentMediaPlayer[display].stop(display)
self.currentMediaPlayer[display].set_visible(display, False) self.currentMediaPlayer[display].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']\ controller.mediabar.actions[u'playbackStop'] \
.setVisible(False) .setVisible(False)
controller.mediabar.actions[u'playbackPause']\ controller.mediabar.actions[u'playbackPause'] \
.setVisible(False) .setVisible(False)
def media_volume(self, msg): def media_volume(self, msg):
@ -634,8 +634,7 @@ class MediaController(object):
log.debug(u'media_seek') log.debug(u'media_seek')
controller = msg[0] controller = msg[0]
seekVal = msg[1][0] seekVal = msg[1][0]
for display in self.currentMediaPlayer.keys(): display = self._define_display(controller)
if display.controller == controller:
self.currentMediaPlayer[display].seek(display, seekVal) self.currentMediaPlayer[display].seek(display, seekVal)
def media_reset(self, controller): def media_reset(self, controller):

View File

@ -78,7 +78,6 @@ class PlayerTab(SettingsTab):
self.rightColumn.setSizePolicy( self.rightColumn.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.rightLayout.addStretch() self.rightLayout.addStretch()
self.mediaPlayerGroupBox = QtGui.QGroupBox(self.leftColumn) self.mediaPlayerGroupBox = QtGui.QGroupBox(self.leftColumn)
self.mediaPlayerGroupBox.setObjectName(u'mediaPlayerGroupBox') self.mediaPlayerGroupBox.setObjectName(u'mediaPlayerGroupBox')
self.mediaPlayerLayout = QtGui.QVBoxLayout(self.mediaPlayerGroupBox) self.mediaPlayerLayout = QtGui.QVBoxLayout(self.mediaPlayerGroupBox)
@ -208,8 +207,6 @@ class PlayerTab(SettingsTab):
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
settings.setValue(u'background color', QtCore.QVariant(self.bg_color)) settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
settings.endGroup() settings.endGroup()
if self.initial_color != self.bg_color:
Receiver.send_message(u'image_updated')
old_players, override_player = get_media_players() old_players, override_player = get_media_players()
if self.usedPlayers != old_players: if self.usedPlayers != old_players:
# clean old Media stuff # clean old Media stuff