forked from openlp/openlp
Fix bugs and more simplifications
This commit is contained in:
parent
cf635c1459
commit
8e5dafb715
@ -44,7 +44,6 @@ from openlp.core.lib.settings import Settings
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MediaManagerItem(QtGui.QWidget):
|
||||
"""
|
||||
MediaManagerItem is a helper widget for plugins.
|
||||
|
@ -52,7 +52,7 @@ class ServiceItemType(object):
|
||||
|
||||
class ItemCapabilities(object):
|
||||
"""
|
||||
Provides an enumeration of a serviceitem's capabilities
|
||||
Provides an enumeration of a service item's capabilities
|
||||
"""
|
||||
CanPreview = 1
|
||||
CanEdit = 2
|
||||
@ -310,7 +310,9 @@ class ServiceItem(object):
|
||||
The item to extract data from.
|
||||
|
||||
``path``
|
||||
Defaults to *None*. Any path data, usually for images.
|
||||
Defaults to *None*. This is the service manager path for things
|
||||
which have their files saved with them or None when the saved
|
||||
service is lite and the original file paths need to be preserved..
|
||||
"""
|
||||
log.debug(u'set_from_service called with path %s' % path)
|
||||
header = serviceitem[u'serviceitem'][u'header']
|
||||
|
@ -71,6 +71,25 @@ class AlertLocation(object):
|
||||
Middle = 1
|
||||
Bottom = 2
|
||||
|
||||
class DisplayControllerType(object):
|
||||
"""
|
||||
This is an enumeration class which controls where Alerts are placed on the
|
||||
screen.
|
||||
|
||||
``Top``
|
||||
Place the text at the top of the screen.
|
||||
|
||||
``Middle``
|
||||
Place the text in the middle of the screen.
|
||||
|
||||
``Bottom``
|
||||
Place the text at the bottom of the screen.
|
||||
"""
|
||||
Live = 0
|
||||
Preview = 1
|
||||
Plugin = 2
|
||||
|
||||
|
||||
from firsttimeform import FirstTimeForm
|
||||
from firsttimelanguageform import FirstTimeLanguageForm
|
||||
from themelayoutform import ThemeLayoutForm
|
||||
|
@ -38,6 +38,7 @@ from openlp.core.ui.media import MediaState, MediaInfo, MediaType, \
|
||||
get_media_players, set_media_players
|
||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.core.ui import DisplayControllerType
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -51,6 +52,7 @@ class MediaController(object):
|
||||
self.mainWindow = parent
|
||||
self.mediaPlayers = {}
|
||||
self.controller = []
|
||||
self.displayControllers = {}
|
||||
self.curDisplayMediaPlayer = {}
|
||||
# Timer for video state
|
||||
self.timer = QtCore.QTimer()
|
||||
@ -116,7 +118,7 @@ class MediaController(object):
|
||||
|
||||
def register_players(self, player):
|
||||
"""
|
||||
Register each media Player controller (Webkit, Phonon, etc) and store
|
||||
Register each media Player (Webkit, Phonon, etc) and store
|
||||
for later use
|
||||
|
||||
``player``
|
||||
@ -126,8 +128,7 @@ class MediaController(object):
|
||||
|
||||
def check_available_media_players(self):
|
||||
"""
|
||||
Check to see if we have any media Player's available. If Not do not
|
||||
install the plugin.
|
||||
Check to see if we have any media Player's available.
|
||||
"""
|
||||
log.debug(u'_check_available_media_players')
|
||||
controller_dir = os.path.join(
|
||||
@ -221,7 +222,7 @@ class MediaController(object):
|
||||
html += player.get_media_display_html()
|
||||
return html
|
||||
|
||||
def register_controller(self, controller, control_panel):
|
||||
def register_controller(self, controller ,source, control_panel):
|
||||
"""
|
||||
Registers media controls where the players will be placed to run.
|
||||
|
||||
@ -231,6 +232,7 @@ class MediaController(object):
|
||||
``controller_panel``
|
||||
The controllers toolbar where the widgets reside
|
||||
"""
|
||||
#self.displayControllers[source] = controller
|
||||
self.controller.append(controller)
|
||||
self.setup_generic_controls(controller, control_panel)
|
||||
|
||||
@ -293,21 +295,23 @@ class MediaController(object):
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), controller.sendToPlugins)
|
||||
|
||||
|
||||
def setup_display(self, display):
|
||||
def setup_display(self, display, preview):
|
||||
"""
|
||||
After a new display is configured, all media related widget will be
|
||||
created too
|
||||
|
||||
``display``
|
||||
Display on which the output is to be played
|
||||
|
||||
``preview``
|
||||
Whether the display is a main or preview display
|
||||
"""
|
||||
# clean up possible running old media files
|
||||
self.finalise()
|
||||
# update player status
|
||||
self._set_active_players()
|
||||
display.hasAudio = True
|
||||
if display == self.mainWindow.previewController.previewDisplay or \
|
||||
display == self.mainWindow.liveController.previewDisplay:
|
||||
if preview:
|
||||
display.hasAudio = False
|
||||
for player in self.mediaPlayers.values():
|
||||
if player.isActive:
|
||||
|
@ -46,7 +46,7 @@ class PlayerTab(SettingsTab):
|
||||
MediaTab is the Media settings tab in the settings dialog.
|
||||
"""
|
||||
def __init__(self, parent, mainWindow):
|
||||
self.settingsForm = parent
|
||||
self.parent = parent
|
||||
self.mainWindow = mainWindow
|
||||
self.mediaPlayers = mainWindow.mediaController.mediaPlayers
|
||||
self.savedUsedPlayers = None
|
||||
@ -222,8 +222,8 @@ class PlayerTab(SettingsTab):
|
||||
|
||||
def postSetUp(self, postUpdate=False):
|
||||
"""
|
||||
Late stup for players as the MediaController has to be initialised
|
||||
firest.
|
||||
Late setup for players as the MediaController has to be initialised
|
||||
first.
|
||||
"""
|
||||
for key, player in self.mediaPlayers.iteritems():
|
||||
player = self.mediaPlayers[key]
|
||||
@ -231,6 +231,7 @@ class PlayerTab(SettingsTab):
|
||||
checkbox.setEnabled(player.available)
|
||||
checkbox.setObjectName(player.name + u'CheckBox')
|
||||
checkbox.setToolTip(player.get_info())
|
||||
checkbox.setPlayerName(player.name)
|
||||
self.playerCheckBoxes[player.name] = checkbox
|
||||
QtCore.QObject.connect(checkbox,QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onPlayerCheckBoxChanged)
|
||||
@ -239,6 +240,7 @@ class PlayerTab(SettingsTab):
|
||||
checkbox.setChecked(True)
|
||||
else:
|
||||
checkbox.setChecked(False)
|
||||
self.updatePlayerList()
|
||||
self.retranslatePlayers()
|
||||
|
||||
def retranslatePlayers(self):
|
||||
|
@ -38,7 +38,8 @@ from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
|
||||
from openlp.core.lib.ui import UiStrings, create_action
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib import SlideLimits, ServiceItemAction
|
||||
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList
|
||||
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList, \
|
||||
DisplayControllerType
|
||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -192,7 +193,9 @@ class SlideController(DisplayController):
|
||||
category=self.category, triggers=self.onSlideSelectedNextAction)
|
||||
self.toolbar.addAction(self.nextItem)
|
||||
self.toolbar.addSeparator()
|
||||
self.controllerType = DisplayControllerType.Preview
|
||||
if self.isLive:
|
||||
self.controllerType = DisplayControllerType.Live
|
||||
# Hide Menu
|
||||
self.hideMenu = QtGui.QToolButton(self.toolbar)
|
||||
self.hideMenu.setObjectName(u'hideMenu')
|
||||
@ -270,7 +273,8 @@ class SlideController(DisplayController):
|
||||
'Edit and reload song preview.'), triggers=self.onEditSong)
|
||||
self.controllerLayout.addWidget(self.toolbar)
|
||||
# Build the Media Toolbar
|
||||
self.mediaController.register_controller(self, self.controllerLayout)
|
||||
self.mediaController.register_controller(self,
|
||||
self.controllerType, self.controllerLayout)
|
||||
if self.isLive:
|
||||
# Build the Song Toolbar
|
||||
self.songMenu = QtGui.QToolButton(self.toolbar)
|
||||
@ -593,14 +597,14 @@ class SlideController(DisplayController):
|
||||
float(self.screens.current[u'size'].height())
|
||||
except ZeroDivisionError:
|
||||
self.ratio = 1
|
||||
self.mediaController.setup_display(self.display)
|
||||
self.mediaController.setup_display(self.display, False)
|
||||
self.previewSizeChanged()
|
||||
self.previewDisplay.setup()
|
||||
serviceItem = ServiceItem()
|
||||
self.previewDisplay.webView.setHtml(build_html(serviceItem,
|
||||
self.previewDisplay.screen, None, self.isLive,
|
||||
plugins=PluginManager.get_instance().plugins))
|
||||
self.mediaController.setup_display(self.previewDisplay)
|
||||
self.mediaController.setup_display(self.previewDisplay,True)
|
||||
if self.serviceItem:
|
||||
self.refreshServiceItem()
|
||||
|
||||
|
@ -37,7 +37,7 @@ from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
|
||||
from openlp.core.lib.settings import Settings
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
|
||||
create_horizontal_adjusting_combo_box
|
||||
from openlp.core.ui import DisplayController, Display
|
||||
from openlp.core.ui import DisplayController, Display, DisplayControllerType
|
||||
from openlp.core.ui.media import get_media_players, set_media_players
|
||||
from openlp.core.utils import locale_compare
|
||||
|
||||
@ -65,8 +65,9 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.mediaObject = None
|
||||
self.mediaController = DisplayController(parent)
|
||||
self.mediaController.controllerLayout = QtGui.QVBoxLayout()
|
||||
self.plugin.mediaController.register_controller(self
|
||||
.mediaController, self.mediaController.controllerLayout)
|
||||
self.plugin.mediaController.register_controller(self.mediaController,
|
||||
DisplayControllerType.Plugin,
|
||||
self.mediaController.controllerLayout)
|
||||
self.plugin.mediaController.set_controls_visible(self.mediaController,
|
||||
False)
|
||||
self.mediaController.previewDisplay = Display(self.mediaController,
|
||||
@ -76,15 +77,8 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.mediaController.previewDisplay.screen = \
|
||||
{u'size':self.mediaController.previewDisplay.geometry()}
|
||||
self.mediaController.previewDisplay.setup()
|
||||
serviceItem = ServiceItem()
|
||||
self.mediaController.previewDisplay.webView.setHtml(build_html(
|
||||
serviceItem, self.mediaController.previewDisplay.screen, None,
|
||||
False, None))
|
||||
self.mediaController.previewDisplay.setup()
|
||||
self.plugin.mediaController.setup_display(
|
||||
self.mediaController.previewDisplay)
|
||||
self.mediaController.previewDisplay.hide()
|
||||
|
||||
self.mediaController.previewDisplay, False)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'video_background_replaced'),
|
||||
self.videobackgroundReplaced)
|
||||
@ -97,11 +91,6 @@ class MediaMediaItem(MediaManagerItem):
|
||||
|
||||
def retranslateUi(self):
|
||||
self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
||||
#self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
|
||||
# 'Videos (%s);;Audio (%s);;%s (*)')) % (
|
||||
# u' '.join(self.plugin.video_extensions_list),
|
||||
# u' '.join(self.plugin.audio_extensions_list),
|
||||
# UiStrings().AllFiles)
|
||||
self.replaceAction.setText(UiStrings().ReplaceBG)
|
||||
self.replaceAction.setToolTip(UiStrings().ReplaceLiveBG)
|
||||
self.resetAction.setText(UiStrings().ResetBG)
|
||||
@ -253,7 +242,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
|
||||
def displaySetup(self):
|
||||
self.plugin.mediaController.setup_display(
|
||||
self.mediaController.previewDisplay)
|
||||
self.mediaController.previewDisplay, False)
|
||||
|
||||
def populateDisplayTypes(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user