diff --git a/openlp/core/ui/media/media_api.py b/openlp/core/lib/media_player.py similarity index 94% rename from openlp/core/ui/media/media_api.py rename to openlp/core/lib/media_player.py index 265126db0..9a86f708b 100644 --- a/openlp/core/ui/media/media_api.py +++ b/openlp/core/lib/media_player.py @@ -27,13 +27,13 @@ from openlp.core.ui.media import MediaState -class MediaAPI(object): +class MediaPlayer(object): """ - A generic media API class to provide OpenLP with a pluggable media display + This is the base class media Player class to provide OpenLP with a pluggable media display framework. """ - def __init__(self, parent, name=u'media_api'): + def __init__(self, parent, name=u'media_player'): self.parent = parent self.name = name self.available = self.check_available() @@ -47,7 +47,7 @@ class MediaAPI(object): def check_available(self): """ - API is available on this machine + Player is available on this machine """ return False diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index ea10c6190..caeb6736f 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -59,7 +59,7 @@ class Display(QtGui.QGraphicsView): QtGui.QGraphicsView.__init__(self, parent) self.isLive = live self.controller = controller - self.screen = None + self.screen = {} self.plugins = PluginManager.get_instance().plugins self.setViewport(QtOpenGL.QGLWidget()) diff --git a/openlp/core/ui/media/__init__.py b/openlp/core/ui/media/__init__.py index 3ce8b6707..d934c12b5 100644 --- a/openlp/core/ui/media/__init__.py +++ b/openlp/core/ui/media/__init__.py @@ -62,5 +62,4 @@ class MediaInfo(object): end_time = 0 media_type = MediaType() -from media_api import MediaAPI from mediacontroller import MediaController diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index e1bcd0eef..6cc133273 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -31,8 +31,9 @@ import sys, os,time from PyQt4 import QtCore, QtGui, QtWebKit from openlp.core.lib import OpenLPToolbar, Receiver, translate +from openlp.core.lib.media_player import MediaPlayer from openlp.core.lib.ui import UiStrings, critical_error_message_box -from openlp.core.ui.media import MediaAPI, MediaState, MediaInfo, MediaType +from openlp.core.ui.media import MediaState, MediaInfo, MediaType from openlp.core.utils import AppLocation log = logging.getLogger(__name__) @@ -40,20 +41,20 @@ log = logging.getLogger(__name__) class MediaController(object): """ The implementation of the Media Controller. The Media Controller adds an own - class for every API. Currently these are QtWebkit, Phonon and planed Vlc. + class for every Player. Currently these are QtWebkit, Phonon and planed Vlc. """ def __init__(self, parent): self.parent = parent - self.mediaApis = {} + self.mediaPlayers = {} self.controller = [] - self.overridenApi = '' - self.curDisplayMediaAPI = {} + self.overridenPlayer = '' + self.curDisplayMediaPlayer = {} # Timer for video state self.timer = QtCore.QTimer() self.timer.setInterval(200) self.withLivePreview = False - self.check_available_media_apis() + self.check_available_media_players() # Signals QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.video_state) @@ -74,7 +75,7 @@ class MediaController(object): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'media_unblank'), self.video_unblank) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'media_override_api'), self.override_api) + QtCore.SIGNAL(u'media_override_player'), self.override_player) # Signals for background video QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_hide'), self.video_hide) @@ -83,24 +84,24 @@ class MediaController(object): def register_controllers(self, controller): """ - Register each media API controller (Webkit, Phonon, etc) and store for + Register each media Player controller (Webkit, Phonon, etc) and store for later use """ if controller.check_available(): - self.mediaApis[controller.name] = controller + self.mediaPlayers[controller.name] = controller - def check_available_media_apis(self): + def check_available_media_players(self): """ - Check to see if we have any media API's available. If Not do not install + Check to see if we have any media Player's available. If Not do not install the plugin. """ - log.debug(u'check_available_media_apis') + log.debug(u'check_available_media_players') controller_dir = os.path.join( AppLocation.get_directory(AppLocation.AppDir), u'core', u'ui', u'media') for filename in os.listdir(controller_dir): - if filename.endswith(u'api.py') and \ - not filename == 'media_api.py': + if filename.endswith(u'player.py') and \ + not filename == 'media_player.py': path = os.path.join(controller_dir, filename) if os.path.isfile(path): modulename = u'openlp.core.ui.media.' + \ @@ -111,21 +112,21 @@ class MediaController(object): except ImportError: log.warn(u'Failed to import %s on path %s', modulename, path) - controller_classes = MediaAPI.__subclasses__() + controller_classes = MediaPlayer.__subclasses__() for controller_class in controller_classes: controller = controller_class(self) self.register_controllers(controller) - if self.mediaApis: - apiSettings = str(QtCore.QSettings().value(u'media/apis', + if self.mediaPlayers: + playerSettings = str(QtCore.QSettings().value(u'media/players', QtCore.QVariant(u'webkit')).toString()) - savedAPIs = apiSettings.split(u',') - invalidMediaAPIs = [mediaApi for mediaApi in savedAPIs \ - if not mediaApi in self.mediaApis] - if len(invalidMediaAPIs)>0: - [savedAPIs.remove(invalidApi) for invalidApi in invalidMediaAPIs] - newApiSetting = u','.join(savedAPIs) - QtCore.QSettings().setValue(u'media/apis', - QtCore.QVariant(newApiSetting)) + savedPlayers = playerSettings.split(u',') + invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers \ + if not mediaPlayer in self.mediaPlayers] + if len(invalidMediaPlayers)>0: + [savedPlayers.remove(invalidPlayer) for invalidPlayer in invalidMediaPlayers] + newPlayerSetting = u','.join(savedPlayers) + QtCore.QSettings().setValue(u'media/players', + QtCore.QVariant(newPlayerSetting)) return True else: return False @@ -135,13 +136,13 @@ class MediaController(object): Check if there is a running media Player and do updating stuff (e.g. update the UI) """ - if len(self.curDisplayMediaAPI.keys()) == 0: + if len(self.curDisplayMediaPlayer.keys()) == 0: self.timer.stop() else: - for display in self.curDisplayMediaAPI.keys(): - self.curDisplayMediaAPI[display].resize(display) - self.curDisplayMediaAPI[display].update_ui(display) - if self.curDisplayMediaAPI[display] \ + for display in self.curDisplayMediaPlayer.keys(): + self.curDisplayMediaPlayer[display].resize(display) + self.curDisplayMediaPlayer[display].update_ui(display) + if self.curDisplayMediaPlayer[display] \ .state == MediaState.Playing: return self.timer.stop() @@ -151,8 +152,8 @@ class MediaController(object): Add css style sheets to htmlbuilder """ css = u'' - for api in self.mediaApis.values(): - css += api.get_media_display_css() + for player in self.mediaPlayers.values(): + css += player.get_media_display_css() return css def get_media_display_javascript(self): @@ -160,8 +161,8 @@ class MediaController(object): Add javascript functions to htmlbuilder """ js = u'' - for api in self.mediaApis.values(): - js += api.get_media_display_javascript() + for player in self.mediaPlayers.values(): + js += player.get_media_display_javascript() return js def get_media_display_html(self): @@ -169,8 +170,8 @@ class MediaController(object): Add html code to htmlbuilder """ html = u'' - for api in self.mediaApis.values(): - html += api.get_media_display_html() + for player in self.mediaPlayers.values(): + html += player.get_media_display_html() return html def add_controller_items(self, controller, control_panel): @@ -248,8 +249,8 @@ class MediaController(object): if display == self.parent.previewController.previewDisplay or \ display == self.parent.liveController.previewDisplay: display.hasAudio = False - for api in self.mediaApis.values(): - api.setup(display) + for player in self.mediaPlayers.values(): + player.setup(display) def set_controls_visible(self, controller, value): # Generic controls @@ -258,12 +259,12 @@ class MediaController(object): # (e.g. for DVD control, ...) # TODO - def resize(self, controller, display, api): + def resize(self, controller, display, player): """ After Mainwindow changes or Splitter moved all related media widgets have to be resized """ - api.resize(display) + player.resize(display) def video(self, controller, file, muted, isBackground): """ @@ -316,7 +317,7 @@ class MediaController(object): display.frame.evaluateJavaScript(u'show_video( \ "setBackBoard", null, null, null,"visible");') self.set_controls_visible(controller, True) - log.debug(u'use %s controller' % self.curDisplayMediaAPI[display]) + log.debug(u'use %s controller' % self.curDisplayMediaPlayer[display]) return True else: critical_error_message_box( @@ -327,42 +328,42 @@ class MediaController(object): def check_file_type(self, controller, display): """ - Used to choose the right media API type from the prioritized API list + Used to choose the right media Player type from the prioritized Player list """ - apiSettings = str(QtCore.QSettings().value(u'media/apis', + playerSettings = str(QtCore.QSettings().value(u'media/players', QtCore.QVariant(u'webkit')).toString()) - usedAPIs = apiSettings.split(u',') - if QtCore.QSettings().value(u'media/override api', + usedPlayers = playerSettings.split(u',') + if QtCore.QSettings().value(u'media/override player', QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked: - if self.overridenApi != '': - usedAPIs = [self.overridenApi] + if self.overridenPlayer != '': + usedPlayers = [self.overridenPlayer] if controller.media_info.file_info.isFile(): suffix = u'*.%s' % controller.media_info.file_info.suffix().toLower() - for title in usedAPIs: - api = self.mediaApis[title] - if suffix in api.video_extensions_list: + for title in usedPlayers: + player = self.mediaPlayers[title] + if suffix in player.video_extensions_list: if not controller.media_info.is_background or \ - controller.media_info.is_background and api.canBackground: - self.resize(controller, display, api) - if api.load(display): - self.curDisplayMediaAPI[display] = api + controller.media_info.is_background and player.canBackground: + self.resize(controller, display, player) + if player.load(display): + self.curDisplayMediaPlayer[display] = player controller.media_info.media_type = MediaType.Video return True - if suffix in api.audio_extensions_list: - if api.load(display): - self.curDisplayMediaAPI[display] = api + if suffix in player.audio_extensions_list: + if player.load(display): + self.curDisplayMediaPlayer[display] = player controller.media_info.media_type = MediaType.Audio return True else: - for title in usedAPIs: - api = self.mediaApis[title] - if api.canFolder: - self.resize(controller, display, api) - if api.load(display): - self.curDisplayMediaAPI[display] = api + for title in usedPlayers: + player = self.mediaPlayers[title] + if player.canFolder: + self.resize(controller, display, player) + if player.load(display): + self.curDisplayMediaPlayer[display] = player controller.media_info.media_type = MediaType.Video return True - # no valid api found + # no valid player found return False def video_play(self, msg, status=True): @@ -371,16 +372,16 @@ class MediaController(object): """ log.debug(u'video_play') controller = msg[0] - for display in self.curDisplayMediaAPI.keys(): + for display in self.curDisplayMediaPlayer.keys(): if display.controller == controller: if controller.isLive: if controller.hideMenu.defaultAction().isChecked(): controller.hideMenu.defaultAction().trigger() - if not self.curDisplayMediaAPI[display].play(display): + if not self.curDisplayMediaPlayer[display].play(display): return False if status: display.frame.evaluateJavaScript(u'show_blank("desktop");') - self.curDisplayMediaAPI[display].set_visible(display, True) + self.curDisplayMediaPlayer[display].set_visible(display, True) # Start Timer for ui updates if not self.timer.isActive(): self.timer.start() @@ -392,9 +393,9 @@ class MediaController(object): """ log.debug(u'video_pause') controller = msg[0] - for display in self.curDisplayMediaAPI.keys(): + for display in self.curDisplayMediaPlayer.keys(): if display.controller == controller: - self.curDisplayMediaAPI[display].pause(display) + self.curDisplayMediaPlayer[display].pause(display) def video_stop(self, msg): """ @@ -402,11 +403,11 @@ class MediaController(object): """ log.debug(u'video_stop') controller = msg[0] - for display in self.curDisplayMediaAPI.keys(): + for display in self.curDisplayMediaPlayer.keys(): if display.controller == controller: display.frame.evaluateJavaScript(u'show_blank("black");') - self.curDisplayMediaAPI[display].stop(display) - self.curDisplayMediaAPI[display].set_visible(display, False) + self.curDisplayMediaPlayer[display].stop(display) + self.curDisplayMediaPlayer[display].set_visible(display, False) def video_volume(self, msg): """ @@ -415,9 +416,9 @@ class MediaController(object): controller = msg[0] vol = msg[1][0] log.debug(u'video_volume %d' % vol) - for display in self.curDisplayMediaAPI.keys(): + for display in self.curDisplayMediaPlayer.keys(): if display.controller == controller: - self.curDisplayMediaAPI[display].volume(display, vol) + self.curDisplayMediaPlayer[display].volume(display, vol) def video_seek(self, msg): """ @@ -426,23 +427,23 @@ class MediaController(object): log.debug(u'video_seek') controller = msg[0] seekVal = msg[1][0] - for display in self.curDisplayMediaAPI.keys(): + for display in self.curDisplayMediaPlayer.keys(): if display.controller == controller: - self.curDisplayMediaAPI[display].seek(display, seekVal) + self.curDisplayMediaPlayer[display].seek(display, seekVal) def video_reset(self, controller): """ Responds to the request to reset a loaded video """ log.debug(u'video_reset') - for display in self.curDisplayMediaAPI.keys(): + for display in self.curDisplayMediaPlayer.keys(): if display.controller == controller: display.override = {} - self.curDisplayMediaAPI[display].reset(display) - self.curDisplayMediaAPI[display].set_visible(display, False) + self.curDisplayMediaPlayer[display].reset(display) + self.curDisplayMediaPlayer[display].set_visible(display, False) display.frame.evaluateJavaScript(u'show_video( \ "setBackBoard", null, null, null,"hidden");') - del self.curDisplayMediaAPI[display] + del self.curDisplayMediaPlayer[display] self.set_controls_visible(controller, False) def video_hide(self, msg): @@ -452,12 +453,12 @@ class MediaController(object): isLive = msg[1] if isLive: controller = self.parent.liveController - for display in self.curDisplayMediaAPI.keys(): + for display in self.curDisplayMediaPlayer.keys(): if display.controller == controller: - if self.curDisplayMediaAPI[display] \ + if self.curDisplayMediaPlayer[display] \ .state == MediaState.Playing: - self.curDisplayMediaAPI[display].pause(display) - self.curDisplayMediaAPI[display] \ + self.curDisplayMediaPlayer[display].pause(display) + self.curDisplayMediaPlayer[display] \ .set_visible(display, False) def video_blank(self, msg): @@ -469,12 +470,12 @@ class MediaController(object): if isLive: Receiver.send_message(u'live_display_hide', hide_mode) controller = self.parent.liveController - for display in self.curDisplayMediaAPI.keys(): + for display in self.curDisplayMediaPlayer.keys(): if display.controller == controller: - if self.curDisplayMediaAPI[display] \ + if self.curDisplayMediaPlayer[display] \ .state == MediaState.Playing: - self.curDisplayMediaAPI[display].pause(display) - self.curDisplayMediaAPI[display] \ + self.curDisplayMediaPlayer[display].pause(display) + self.curDisplayMediaPlayer[display] \ .set_visible(display, False) def video_unblank(self, msg): @@ -485,12 +486,12 @@ class MediaController(object): isLive = msg[1] if isLive: controller = self.parent.liveController - for display in self.curDisplayMediaAPI.keys(): + for display in self.curDisplayMediaPlayer.keys(): if display.controller == controller: - if self.curDisplayMediaAPI[display] \ + if self.curDisplayMediaPlayer[display] \ .state == MediaState.Paused: - if self.curDisplayMediaAPI[display].play(display): - self.curDisplayMediaAPI[display] \ + if self.curDisplayMediaPlayer[display].play(display): + self.curDisplayMediaPlayer[display] \ .set_visible(display, True) # Start Timer for ui updates if not self.timer.isActive(): @@ -499,28 +500,28 @@ class MediaController(object): def get_audio_extensions_list(self): audio_list = [] - for api in self.mediaApis.values(): - for item in api.audio_extensions_list: + for player in self.mediaPlayers.values(): + for item in player.audio_extensions_list: if not item in audio_list: audio_list.append(item) return audio_list def get_video_extensions_list(self): video_list = [] - for api in self.mediaApis.values(): - for item in api.video_extensions_list: + for player in self.mediaPlayers.values(): + for item in player.video_extensions_list: if not item in video_list: video_list.append(item) return video_list - def override_api(self, override_api): - apiSettings = str(QtCore.QSettings().value(u'media/apis', + def override_player(self, override_player): + playerSettings = str(QtCore.QSettings().value(u'media/players', QtCore.QVariant(u'webkit')).toString()) - usedAPIs = apiSettings.split(u',') - if override_api in usedAPIs: - self.overridenApi = override_api + usedPlayers = playerSettings.split(u',') + if override_player in usedPlayers: + self.overridenPlayer = override_player else: - self.overridenApi = '' + self.overridenPlayer = '' def finalise(self): self.timer.stop() diff --git a/openlp/core/ui/media/phononapi.py b/openlp/core/ui/media/phononplayer.py similarity index 97% rename from openlp/core/ui/media/phononapi.py rename to openlp/core/ui/media/phononplayer.py index 0cd086ef6..3e7d68379 100644 --- a/openlp/core/ui/media/phononapi.py +++ b/openlp/core/ui/media/phononplayer.py @@ -33,7 +33,8 @@ from PyQt4 import QtCore, QtGui from PyQt4.phonon import Phonon from openlp.core.lib import Receiver -from openlp.core.ui.media import MediaAPI, MediaState +from openlp.core.lib.media_player import MediaPlayer +from openlp.core.ui.media import MediaState log = logging.getLogger(__name__) @@ -54,14 +55,14 @@ ADDITIONAL_EXT = { u'video/x-ms-wmv': [u'.wmv']} -class PhononAPI(MediaAPI): +class PhononPlayer(MediaPlayer): """ - A specialised version of the MediaAPI class, which provides a Phonon + A specialised version of the MediaPlayer class, which provides a Phonon display. """ def __init__(self, parent): - MediaAPI.__init__(self, parent, u'phonon') + MediaPlayer.__init__(self, parent, u'phonon') self.parent = parent self.additional_extensions = ADDITIONAL_EXT mimetypes.init() diff --git a/openlp/core/ui/media/vlcapi.py b/openlp/core/ui/media/vlcplayer.py similarity index 96% rename from openlp/core/ui/media/vlcapi.py rename to openlp/core/ui/media/vlcplayer.py index 74f89308b..dfe5860d6 100644 --- a/openlp/core/ui/media/vlcapi.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -37,7 +37,8 @@ except: from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver -from openlp.core.ui.media import MediaAPI, MediaState +from openlp.core.lib.media_player import MediaPlayer +from openlp.core.ui.media import MediaState log = logging.getLogger(__name__) @@ -73,14 +74,14 @@ VIDEO_EXT = [ ] -class VlcAPI(MediaAPI): +class VlcPlayer(MediaPlayer): """ - A specialised version of the MediaAPI class, which provides a QtWebKit + A specialised version of the MediaPlayer class, which provides a QtWebKit display. """ def __init__(self, parent): - MediaAPI.__init__(self, parent, u'vlc') + MediaPlayer.__init__(self, parent, u'vlc') self.parent = parent self.canFolder = True self.audio_extensions_list = AUDIO_EXT diff --git a/openlp/core/ui/media/webkitapi.py b/openlp/core/ui/media/webkitplayer.py similarity index 98% rename from openlp/core/ui/media/webkitapi.py rename to openlp/core/ui/media/webkitplayer.py index ee7a2c5b3..ad69c5bc9 100644 --- a/openlp/core/ui/media/webkitapi.py +++ b/openlp/core/ui/media/webkitplayer.py @@ -30,7 +30,8 @@ import logging from PyQt4 import QtCore, QtGui, QtWebKit from openlp.core.lib import OpenLPToolbar, translate -from openlp.core.ui.media import MediaAPI, MediaState +from openlp.core.lib.media_player import MediaPlayer +from openlp.core.ui.media import MediaState log = logging.getLogger(__name__) @@ -254,14 +255,14 @@ AUDIO_EXT = [ ] -class WebkitAPI(MediaAPI): +class WebkitPlayer(MediaPlayer): """ - A specialised version of the MediaAPI class, which provides a QtWebKit + A specialised version of the MediaPlayer class, which provides a QtWebKit display. """ def __init__(self, parent): - MediaAPI.__init__(self, parent, u'webkit') + MediaPlayer.__init__(self, parent, u'webkit') self.parent = parent self.canBackground = True self.audio_extensions_list = AUDIO_EXT @@ -403,12 +404,10 @@ class WebkitAPI(MediaAPI): (currentTime, ok) = display.frame.evaluateJavaScript( \ u'show_video("currentTime");').toFloat() # check if conversion was ok and value is not 'NaN' - print currentTime, if ok and currentTime != float('inf'): currentTime = int(currentTime*1000) (length, ok) = display.frame.evaluateJavaScript( \ u'show_video("length");').toFloat() - print length # check if conversion was ok and value is not 'NaN' if ok and length != float('inf'): length = int(length*1000) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 41d11967d..bbe419504 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -34,7 +34,7 @@ from PyQt4 import QtCore, QtGui from PyQt4.phonon import Phonon from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \ - translate, build_icon, ServiceItem, build_html + translate, build_icon, ServiceItem, build_html, PluginManager, ServiceItem from openlp.core.lib.ui import UiStrings, shortcut_action from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList from openlp.core.utils.actions import ActionList, CategoryOrder @@ -291,7 +291,7 @@ class SlideController(Controller): self.previewDisplay.setup() serviceItem = ServiceItem() self.previewDisplay.webView.setHtml(build_html(serviceItem, - self.previewDisplay.screen, None, self.isLive, None)) + self.previewDisplay.screen, None, self.isLive, None, PluginManager.get_instance().plugins)) # self.previewDisplay.webView.hide() self.slideLayout.insertWidget(0, self.previewDisplay) self.previewDisplay.hide() @@ -419,6 +419,10 @@ class SlideController(Controller): self.mediaController.setup_display(self.display) self.previewSizeChanged() self.previewDisplay.setup() + serviceItem = ServiceItem() + self.previewDisplay.webView.setHtml(build_html(serviceItem, + self.previewDisplay.screen, None, self.isLive, None, + plugins=PluginManager.get_instance().plugins)) self.mediaController.setup_display(self.previewDisplay) if self.serviceItem: self.refreshServiceItem() diff --git a/openlp/plugins/media/forms/__init__.py b/openlp/plugins/media/forms/__init__.py deleted file mode 100644 index 3cc42db26..000000000 --- a/openlp/plugins/media/forms/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # -# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # -# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # -# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # -# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # -# --------------------------------------------------------------------------- # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; version 2 of the License. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT # -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # -# more details. # -# # -# You should have received a copy of the GNU General Public License along # -# with this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -from mediaopenform import MediaOpenForm diff --git a/openlp/plugins/media/forms/mediaopendialog.py b/openlp/plugins/media/forms/mediaopendialog.py deleted file mode 100644 index 784d1a18c..000000000 --- a/openlp/plugins/media/forms/mediaopendialog.py +++ /dev/null @@ -1,297 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # -# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # -# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # -# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # -# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # -# --------------------------------------------------------------------------- # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; version 2 of the License. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT # -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # -# more details. # -# # -# You should have received a copy of the GNU General Public License along # -# with this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -from PyQt4 import QtCore, QtGui - -from openlp.core.lib import translate -from openlp.core.lib.ui import UiStrings - -class Ui_MediaOpenDialog(object): - def setupUi(self, mediaOpenDialog): - mediaOpenDialog.setObjectName(u'mediaOpenDialog') - mediaOpenDialog.resize(574, 431) - self.verticalLayout = QtGui.QVBoxLayout(mediaOpenDialog) - self.verticalLayout.setObjectName(u'verticalLayout') - self.MediaOpenWidget = QtGui.QTabWidget(mediaOpenDialog) - self.MediaOpenWidget.setTabPosition(QtGui.QTabWidget.North) - self.MediaOpenWidget.setTabShape(QtGui.QTabWidget.Rounded) - self.MediaOpenWidget.setTabsClosable(False) - self.MediaOpenWidget.setObjectName(u'MediaOpenWidget') - self.FileTab = QtGui.QWidget() - self.FileTab.setObjectName(u'FileTab') - self.verticalLayout_2 = QtGui.QVBoxLayout(self.FileTab) - self.verticalLayout_2.setObjectName(u'verticalLayout_2') - self.FileSelectionGroupBox = QtGui.QGroupBox(self.FileTab) - self.FileSelectionGroupBox.setObjectName(u'FileSelectionGroupBox') - self.verticalLayout_7 = QtGui.QVBoxLayout(self.FileSelectionGroupBox) - self.verticalLayout_7.setObjectName(u'verticalLayout_7') - self.ChooseFilesLabel = QtGui.QLabel(self.FileSelectionGroupBox) - self.ChooseFilesLabel.setObjectName(u'ChooseFilesLabel') - self.verticalLayout_7.addWidget(self.ChooseFilesLabel) - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName(u'horizontalLayout') - self.FilesListView = QtGui.QListWidget(self.FileSelectionGroupBox) - self.FilesListView.setObjectName(u'FilesListView') - self.horizontalLayout.addWidget(self.FilesListView) - self.AddRemovelLayout = QtGui.QVBoxLayout() - self.AddRemovelLayout.setObjectName(u'AddRemovelLayout') - self.FileAddButton = QtGui.QPushButton(self.FileSelectionGroupBox) - self.FileAddButton.setObjectName(u'FileAddButton') - self.AddRemovelLayout.addWidget(self.FileAddButton) - self.FileRemoveButton = QtGui.QPushButton(self.FileSelectionGroupBox) - self.FileRemoveButton.setObjectName(u'FileRemoveButton') - self.AddRemovelLayout.addWidget(self.FileRemoveButton) - spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Expanding) - self.AddRemovelLayout.addItem(spacerItem) - self.horizontalLayout.addLayout(self.AddRemovelLayout) - self.verticalLayout_7.addLayout(self.horizontalLayout) - spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Expanding) - self.verticalLayout_7.addItem(spacerItem1) - self.verticalLayout_2.addWidget(self.FileSelectionGroupBox) - self.MediaOpenWidget.addTab(self.FileTab, u'') - self.MediaTab = QtGui.QWidget() - self.MediaTab.setObjectName(u'MediaTab') - self.verticalLayout_3 = QtGui.QVBoxLayout(self.MediaTab) - self.verticalLayout_3.setObjectName(u'verticalLayout_3') - self.ChooseMediaGroupBox = QtGui.QGroupBox(self.MediaTab) - self.ChooseMediaGroupBox.setObjectName(u'ChooseMediaGroupBox') - self.verticalLayout_8 = QtGui.QVBoxLayout(self.ChooseMediaGroupBox) - self.verticalLayout_8.setObjectName(u'verticalLayout_8') - self.MediaTypeWidget = QtGui.QWidget(self.ChooseMediaGroupBox) - self.MediaTypeWidget.setObjectName(u'MediaTypeWidget') - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.MediaTypeWidget) - self.horizontalLayout_2.setMargin(0) - self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') - self.DvdRadioButton = QtGui.QRadioButton(self.MediaTypeWidget) - self.DvdRadioButton.setObjectName(u'DvdRadioButton') - self.horizontalLayout_2.addWidget(self.DvdRadioButton) - self.AudioCdRadioButton = QtGui.QRadioButton(self.MediaTypeWidget) - self.AudioCdRadioButton.setObjectName(u'AudioCdRadioButton') - self.horizontalLayout_2.addWidget(self.AudioCdRadioButton) - self.verticalLayout_8.addWidget(self.MediaTypeWidget) - self.DeviceWidget = QtGui.QWidget(self.ChooseMediaGroupBox) - self.DeviceWidget.setObjectName(u'DeviceWidget') - self.horizontalLayout_10 = QtGui.QHBoxLayout(self.DeviceWidget) - self.horizontalLayout_10.setMargin(0) - self.horizontalLayout_10.setObjectName(u'horizontalLayout_10') - self.DeviceLabel = QtGui.QLabel(self.DeviceWidget) - self.DeviceLabel.setObjectName(u'DeviceLabel') - self.horizontalLayout_10.addWidget(self.DeviceLabel) - self.DeviceComboBox = QtGui.QComboBox(self.DeviceWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, - QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( \ - self.DeviceComboBox.sizePolicy().hasHeightForWidth()) - self.DeviceComboBox.setSizePolicy(sizePolicy) - self.DeviceComboBox.setObjectName(u'DeviceComboBox') - self.horizontalLayout_10.addWidget(self.DeviceComboBox) - self.DeviceEject = QtGui.QPushButton(self.DeviceWidget) - sizePolicy = QtGui.QSizePolicy( \ - QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( \ - self.DeviceEject.sizePolicy().hasHeightForWidth()) - self.DeviceEject.setSizePolicy(sizePolicy) - self.DeviceEject.setObjectName(u'DeviceEject') - self.horizontalLayout_10.addWidget(self.DeviceEject) - self.DeviceSearchButton = QtGui.QPushButton(self.DeviceWidget) - self.DeviceSearchButton.setObjectName(u'DeviceSearchButton') - self.horizontalLayout_10.addWidget(self.DeviceSearchButton) - self.verticalLayout_8.addWidget(self.DeviceWidget) - self.verticalLayout_3.addWidget(self.ChooseMediaGroupBox) - self.StartpositionGroupBox = QtGui.QGroupBox(self.MediaTab) - self.StartpositionGroupBox.setObjectName(u'StartpositionGroupBox') - self.horizontalLayout_4 = QtGui.QHBoxLayout(self.StartpositionGroupBox) - self.horizontalLayout_4.setObjectName(u'horizontalLayout_4') - self.TitleWidget = QtGui.QWidget(self.StartpositionGroupBox) - self.TitleWidget.setObjectName(u'TitleWidget') - self.horizontalLayout_7 = QtGui.QHBoxLayout(self.TitleWidget) - self.horizontalLayout_7.setMargin(0) - self.horizontalLayout_7.setObjectName(u'horizontalLayout_7') - self.TitleLabel = QtGui.QLabel(self.TitleWidget) - sizePolicy = QtGui.QSizePolicy( \ - QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( \ - self.TitleLabel.sizePolicy().hasHeightForWidth()) - self.TitleLabel.setSizePolicy(sizePolicy) - self.TitleLabel.setObjectName(u'TitleLabel') - self.horizontalLayout_7.addWidget(self.TitleLabel) - self.horizontalLayout_4.addWidget(self.TitleWidget) - self.ChapterWidget = QtGui.QWidget(self.StartpositionGroupBox) - self.ChapterWidget.setEnabled(True) - self.ChapterWidget.setObjectName(u'ChapterWidget') - self.horizontalLayout_6 = QtGui.QHBoxLayout(self.ChapterWidget) - self.horizontalLayout_6.setMargin(0) - self.horizontalLayout_6.setObjectName(u'horizontalLayout_6') - self.ChapterLabel = QtGui.QLabel(self.ChapterWidget) - sizePolicy = QtGui.QSizePolicy( \ - QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( \ - self.ChapterLabel.sizePolicy().hasHeightForWidth()) - self.ChapterLabel.setSizePolicy(sizePolicy) - self.ChapterLabel.setObjectName(u'ChapterLabel') - self.horizontalLayout_6.addWidget(self.ChapterLabel) - self.ChapterSpinBox = QtGui.QSpinBox(self.ChapterWidget) - self.ChapterSpinBox.setObjectName(u'ChapterSpinBox') - self.horizontalLayout_6.addWidget(self.ChapterSpinBox) - self.horizontalLayout_4.addWidget(self.ChapterWidget) - self.verticalLayout_3.addWidget(self.StartpositionGroupBox) - self.AudioSubtitleGroupBox = QtGui.QGroupBox(self.MediaTab) - self.AudioSubtitleGroupBox.setObjectName(u'AudioSubtitleGroupBox') - self.horizontalLayout_5 = QtGui.QHBoxLayout(self.AudioSubtitleGroupBox) - self.horizontalLayout_5.setObjectName(u'horizontalLayout_5') - self.AudioTrackWidget = QtGui.QWidget(self.AudioSubtitleGroupBox) - self.AudioTrackWidget.setObjectName(u'AudioTrackWidget') - self.horizontalLayout_9 = QtGui.QHBoxLayout(self.AudioTrackWidget) - self.horizontalLayout_9.setMargin(0) - self.horizontalLayout_9.setObjectName(u'horizontalLayout_9') - self.AudioTrackLabel_2 = QtGui.QLabel(self.AudioTrackWidget) - sizePolicy = QtGui.QSizePolicy( \ - QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( \ - self.AudioTrackLabel_2.sizePolicy().hasHeightForWidth()) - self.AudioTrackLabel_2.setSizePolicy(sizePolicy) - self.AudioTrackLabel_2.setObjectName(u'AudioTrackLabel_2') - self.horizontalLayout_9.addWidget(self.AudioTrackLabel_2) - self.TitleSpinBox = QtGui.QSpinBox(self.AudioTrackWidget) - self.TitleSpinBox.setObjectName(u'TitleSpinBox') - self.horizontalLayout_9.addWidget(self.TitleSpinBox) - self.horizontalLayout_5.addWidget(self.AudioTrackWidget) - self.SubtitleTrackWidget = QtGui.QWidget(self.AudioSubtitleGroupBox) - self.SubtitleTrackWidget.setObjectName(u'SubtitleTrackWidget') - self.horizontalLayout_8 = QtGui.QHBoxLayout(self.SubtitleTrackWidget) - self.horizontalLayout_8.setMargin(0) - self.horizontalLayout_8.setObjectName(u'horizontalLayout_8') - self.SubtitleTrackLabel = QtGui.QLabel(self.SubtitleTrackWidget) - sizePolicy = QtGui.QSizePolicy( \ - QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( \ - self.SubtitleTrackLabel.sizePolicy().hasHeightForWidth()) - self.SubtitleTrackLabel.setSizePolicy(sizePolicy) - self.SubtitleTrackLabel.setObjectName(u'SubtitleTrackLabel') - self.horizontalLayout_8.addWidget(self.SubtitleTrackLabel) - self.SubtitleTrackSpinBox = QtGui.QSpinBox(self.SubtitleTrackWidget) - self.SubtitleTrackSpinBox.setObjectName(u'SubtitleTrackSpinBox') - self.horizontalLayout_8.addWidget(self.SubtitleTrackSpinBox) - self.horizontalLayout_5.addWidget(self.SubtitleTrackWidget) - self.verticalLayout_3.addWidget(self.AudioSubtitleGroupBox) - spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, \ - QtGui.QSizePolicy.Expanding) - self.verticalLayout_3.addItem(spacerItem2) - self.MediaOpenWidget.addTab(self.MediaTab, u'') - self.NetworkTab = QtGui.QWidget() - self.NetworkTab.setObjectName(u'NetworkTab') - self.verticalLayout_4 = QtGui.QVBoxLayout(self.NetworkTab) - self.verticalLayout_4.setObjectName(u'verticalLayout_4') - self.NetworkprotocolGroupBox = QtGui.QGroupBox(self.NetworkTab) - self.NetworkprotocolGroupBox.setObjectName(u'NetworkprotocolGroupBox') - self.verticalLayout_5 = QtGui.QVBoxLayout(self.NetworkprotocolGroupBox) - self.verticalLayout_5.setObjectName(u'verticalLayout_5') - self.NetworkAdressLabel = QtGui.QLabel(self.NetworkprotocolGroupBox) - self.NetworkAdressLabel.setObjectName(u'NetworkAdressLabel') - self.verticalLayout_5.addWidget(self.NetworkAdressLabel) - self.NetworkAdressEdit = QtGui.QLineEdit(self.NetworkprotocolGroupBox) - self.NetworkAdressEdit.setObjectName(u'NetworkAdressEdit') - self.verticalLayout_5.addWidget(self.NetworkAdressEdit) - spacerItem3 = QtGui.QSpacerItem(20, 259, QtGui.QSizePolicy.Minimum, \ - QtGui.QSizePolicy.Expanding) - self.verticalLayout_5.addItem(spacerItem3) - self.verticalLayout_4.addWidget(self.NetworkprotocolGroupBox) - self.MediaOpenWidget.addTab(self.NetworkTab, u'') - self.verticalLayout.addWidget(self.MediaOpenWidget) - self.ButtonBox = QtGui.QDialogButtonBox(mediaOpenDialog) - self.ButtonBox.setStandardButtons( \ - QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) - self.ButtonBox.setObjectName(u'ButtonBox') - self.verticalLayout.addWidget(self.ButtonBox) - - self.retranslateUi(mediaOpenDialog) - self.MediaOpenWidget.setCurrentIndex(0) - QtCore.QMetaObject.connectSlotsByName(mediaOpenDialog) - - def retranslateUi(self, mediaOpenDialog): - mediaOpenDialog.setWindowTitle( - translate('MediaPlugin', 'mediaOpenForm')) - self.FileSelectionGroupBox.setTitle(translate( - 'MediaPlugin', 'File Selection')) - self.ChooseFilesLabel.setText( - translate('MediaPlugin', 'Choose Files with the Buttons right.')) - self.FileAddButton.setText( - translate('MediaPlugin', 'Add ...')) - self.FileRemoveButton.setText( - translate('MediaPlugin', 'Remove')) - self.MediaOpenWidget.setTabText( - self.MediaOpenWidget.indexOf(self.FileTab), - translate('MediaPlugin', 'File(s)')) - self.ChooseMediaGroupBox.setTitle( - translate('MediaPlugin', 'Choose Media')) - self.DvdRadioButton.setText( - translate('MediaPlugin', 'DVD')) - self.AudioCdRadioButton.setText( - translate('MediaPlugin', 'Audio-CD')) - self.DeviceLabel.setText( - translate('MediaPlugin', 'Device')) - self.DeviceEject.setText( - translate('MediaPlugin', 'Eject')) - self.DeviceSearchButton.setText( - translate('MediaPlugin', 'Search ...')) - self.StartpositionGroupBox.setTitle( - translate('MediaPlugin', 'Startposition')) - self.TitleLabel.setText( - translate('MediaPlugin', 'Title')) - self.ChapterLabel.setText( - translate('MediaPlugin', 'Chapter')) - self.AudioSubtitleGroupBox.setTitle( - translate('MediaPlugin', 'Audio and Subtitle')) - self.AudioTrackLabel_2.setText( - translate('MediaPlugin', 'Audiotrack')) - self.SubtitleTrackLabel.setText( - translate('MediaPlugin', 'Subtitletrack')) - self.MediaOpenWidget.setTabText( - self.MediaOpenWidget.indexOf(self.MediaTab), - translate('MediaPlugin', 'Location')) - self.NetworkprotocolGroupBox.setTitle( - translate('MediaPlugin', 'Networkprotocol')) - self.NetworkAdressLabel.setText( - translate('MediaPlugin', 'Network adress:')) - self.MediaOpenWidget.setTabText( - self.MediaOpenWidget.indexOf(self.NetworkTab), - translate('MediaPlugin', 'Network')) - diff --git a/openlp/plugins/media/forms/mediaopenform.py b/openlp/plugins/media/forms/mediaopenform.py deleted file mode 100644 index 57d0d6362..000000000 --- a/openlp/plugins/media/forms/mediaopenform.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # -# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # -# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # -# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # -# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # -# --------------------------------------------------------------------------- # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; version 2 of the License. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT # -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # -# more details. # -# # -# You should have received a copy of the GNU General Public License along # -# with this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import logging - -from PyQt4 import QtCore, QtGui - -from openlp.core.lib import Receiver, translate -from mediaopendialog import Ui_MediaOpenDialog - -log = logging.getLogger(__name__) - -class MediaOpenForm(QtGui.QDialog, Ui_MediaOpenDialog): - """ - Class documentation goes here. - """ - log.info(u'Media Open Form loaded') - def __init__(self, parent): - """ - Constructor - """ - QtGui.QDialog.__init__(self, parent) - self.setupUi(self) - # Connecting signals and slots - diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 58575cb95..f161248ce 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -38,7 +38,6 @@ from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ media_item_combo_box from openlp.core.ui import Controller, Display -from openlp.plugins.media.forms import MediaOpenForm log = logging.getLogger(__name__) @@ -59,7 +58,6 @@ class MediaMediaItem(MediaManagerItem): self.Automatic = u'' MediaManagerItem.__init__(self, parent, plugin, icon) self.singleServiceItem = False - self.mediaOpenForm = MediaOpenForm(self.plugin.formparent) self.hasSearch = True self.mediaObject = None self.mediaController = Controller(parent) @@ -105,7 +103,7 @@ class MediaMediaItem(MediaManagerItem): self.Automatic = translate('MediaPlugin.MediaItem', 'Automatic') self.displayTypeLabel.setText( - translate('MediaPlugin.MediaItem', 'Use Api:')) + translate('MediaPlugin.MediaItem', 'Use Player:')) def requiredIcons(self): MediaManagerItem.requiredIcons(self) @@ -117,11 +115,6 @@ class MediaMediaItem(MediaManagerItem): MediaManagerItem.addListViewToToolBar(self) self.listView.addAction(self.replaceAction) -# TODO activate own media open menu -# def addStartHeaderBar(self): -# self.replaceAction = self.addToolbarButton(u'', u'', -# u':/general/general_open.png', self.onMediaOpenClick, False) - def addEndHeaderBar(self): # Replace backgrounds do not work at present so remove functionality. self.replaceAction = self.addToolbarButton(u'', u'', @@ -144,16 +137,10 @@ class MediaMediaItem(MediaManagerItem): # Add the Media widget to the page layout self.pageLayout.addWidget(self.mediaWidget) QtCore.QObject.connect(self.displayTypeComboBox, - QtCore.SIGNAL(u'currentIndexChanged (int)'), self.overrideApiChanged) + QtCore.SIGNAL(u'currentIndexChanged (int)'), self.overridePlayerChanged) - def onMediaOpenClick(self): - """ - Add a folder to the list widget to make it available for showing - """ - self.mediaOpenForm.exec_() - - def overrideApiChanged(self, index): - Receiver.send_message(u'media_override_api', \ + def overridePlayerChanged(self, index): + Receiver.send_message(u'media_override_player', \ u'%s' % self.displayTypeComboBox.currentText()) def onResetClick(self): @@ -244,20 +231,20 @@ class MediaMediaItem(MediaManagerItem): def populateDisplayTypes(self): """ - Load the combobox with the enabled media apis, - allowing user to select a specific api if settings allow + Load the combobox with the enabled media players, + allowing user to select a specific player if settings allow """ self.displayTypeComboBox.clear() - apiSettings = str(QtCore.QSettings().value(u'media/apis', + playerSettings = str(QtCore.QSettings().value(u'media/players', QtCore.QVariant(u'webkit')).toString()) - usedAPIs = apiSettings.split(u',') - for title in usedAPIs: + usedPlayers = playerSettings.split(u',') + for title in usedPlayers: # load the drop down selection self.displayTypeComboBox.addItem(title) if self.displayTypeComboBox.count() > 1: self.displayTypeComboBox.insertItem(0, self.Automatic) self.displayTypeComboBox.setCurrentIndex(0) - if QtCore.QSettings().value(self.settingsSection + u'/override api', + if QtCore.QSettings().value(self.settingsSection + u'/override player', QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked: self.mediaWidget.show() else: diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 4e261745d..c390ca82f 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -34,48 +34,48 @@ class MediaTab(SettingsTab): """ MediaTab is the Media settings tab in the settings dialog. """ - def __init__(self, parent, title, visible_title, media_apis, icon_path): - self.media_apis = media_apis + def __init__(self, parent, title, visible_title, media_players, icon_path): + self.media_players = media_players SettingsTab.__init__(self, parent, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'MediaTab') SettingsTab.setupUi(self) - self.mediaAPIGroupBox = QtGui.QGroupBox(self.leftColumn) - self.mediaAPIGroupBox.setObjectName(u'mediaAPIGroupBox') - self.mediaApiLayout = QtGui.QVBoxLayout(self.mediaAPIGroupBox) - self.mediaApiLayout.setObjectName(u'mediaApiLayout') - self.ApiCheckBoxes = {} - for key in self.media_apis: - api = self.media_apis[key] - checkbox = QtGui.QCheckBox(self.mediaAPIGroupBox) - checkbox.setEnabled(api.available) - checkbox.setObjectName(api.name + u'CheckBox') - self.ApiCheckBoxes[api.name] = checkbox - self.mediaApiLayout.addWidget(checkbox) - self.leftLayout.addWidget(self.mediaAPIGroupBox) - self.apiOrderGroupBox = QtGui.QGroupBox(self.leftColumn) - self.apiOrderGroupBox.setObjectName(u'apiOrderGroupBox') - self.apiOrderLayout = QtGui.QVBoxLayout(self.apiOrderGroupBox) - self.apiOrderLayout.setObjectName(u'apiOrderLayout') - self.apiOrderlistWidget = QtGui.QListWidget( \ - self.apiOrderGroupBox) + self.mediaPlayerGroupBox = QtGui.QGroupBox(self.leftColumn) + self.mediaPlayerGroupBox.setObjectName(u'mediaPlayerGroupBox') + self.mediaPlayerLayout = QtGui.QVBoxLayout(self.mediaPlayerGroupBox) + self.mediaPlayerLayout.setObjectName(u'mediaPlayerLayout') + self.PlayerCheckBoxes = {} + for key in self.media_players: + player = self.media_players[key] + checkbox = QtGui.QCheckBox(self.mediaPlayerGroupBox) + checkbox.setEnabled(player.available) + checkbox.setObjectName(player.name + u'CheckBox') + self.PlayerCheckBoxes[player.name] = checkbox + self.mediaPlayerLayout.addWidget(checkbox) + self.leftLayout.addWidget(self.mediaPlayerGroupBox) + self.playerOrderGroupBox = QtGui.QGroupBox(self.leftColumn) + self.playerOrderGroupBox.setObjectName(u'playerOrderGroupBox') + self.playerOrderLayout = QtGui.QVBoxLayout(self.playerOrderGroupBox) + self.playerOrderLayout.setObjectName(u'playerOrderLayout') + self.playerOrderlistWidget = QtGui.QListWidget( \ + self.playerOrderGroupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.apiOrderlistWidget. \ + sizePolicy.setHeightForWidth(self.playerOrderlistWidget. \ sizePolicy().hasHeightForWidth()) - self.apiOrderlistWidget.setSizePolicy(sizePolicy) - self.apiOrderlistWidget.setVerticalScrollBarPolicy( \ + self.playerOrderlistWidget.setSizePolicy(sizePolicy) + self.playerOrderlistWidget.setVerticalScrollBarPolicy( \ QtCore.Qt.ScrollBarAsNeeded) - self.apiOrderlistWidget.setHorizontalScrollBarPolicy( \ + self.playerOrderlistWidget.setHorizontalScrollBarPolicy( \ QtCore.Qt.ScrollBarAlwaysOff) - self.apiOrderlistWidget.setEditTriggers( \ + self.playerOrderlistWidget.setEditTriggers( \ QtGui.QAbstractItemView.NoEditTriggers) - self.apiOrderlistWidget.setObjectName(u'apiOrderlistWidget') - self.apiOrderLayout.addWidget(self.apiOrderlistWidget) - self.orderingButtonsWidget = QtGui.QWidget(self.apiOrderGroupBox) + self.playerOrderlistWidget.setObjectName(u'playerOrderlistWidget') + self.playerOrderLayout.addWidget(self.playerOrderlistWidget) + self.orderingButtonsWidget = QtGui.QWidget(self.playerOrderGroupBox) self.orderingButtonsWidget.setObjectName(u'orderingButtonsWidget') self.orderingButtonLayout = QtGui.QHBoxLayout( \ self.orderingButtonsWidget) @@ -83,120 +83,120 @@ class MediaTab(SettingsTab): self.orderingDownButton = QtGui.QPushButton(self.orderingButtonsWidget) self.orderingDownButton.setObjectName(u'orderingDownButton') self.orderingButtonLayout.addWidget(self.orderingDownButton) - self.orderingUpButton = QtGui.QPushButton(self.apiOrderGroupBox) + self.orderingUpButton = QtGui.QPushButton(self.playerOrderGroupBox) self.orderingUpButton.setObjectName(u'orderingUpButton') self.orderingButtonLayout.addWidget(self.orderingUpButton) - self.apiOrderLayout.addWidget(self.orderingButtonsWidget) - self.leftLayout.addWidget(self.apiOrderGroupBox) + self.playerOrderLayout.addWidget(self.orderingButtonsWidget) + self.leftLayout.addWidget(self.playerOrderGroupBox) self.AdvancedGroupBox = QtGui.QGroupBox(self.leftColumn) self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox') self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox) self.AdvancedLayout.setObjectName(u'AdvancedLayout') - self.OverrideApiCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox) - self.OverrideApiCheckBox.setObjectName(u'OverrideApiCheckBox') - self.AdvancedLayout.addWidget(self.OverrideApiCheckBox) + self.OverridePlayerCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox) + self.OverridePlayerCheckBox.setObjectName(u'OverridePlayerCheckBox') + self.AdvancedLayout.addWidget(self.OverridePlayerCheckBox) self.leftLayout.addWidget(self.AdvancedGroupBox) self.leftLayout.addStretch() self.rightLayout.addStretch() - for key in self.media_apis: - api = self.media_apis[key] - checkbox = self.ApiCheckBoxes[api.name] + for key in self.media_players: + player = self.media_players[key] + checkbox = self.PlayerCheckBoxes[player.name] QtCore.QObject.connect(checkbox, QtCore.SIGNAL(u'stateChanged(int)'), - self.onApiCheckBoxChanged) + self.onPlayerCheckBoxChanged) QtCore.QObject.connect(self.orderingUpButton, QtCore.SIGNAL(u'pressed()'), self.onOrderingUpButtonPressed) QtCore.QObject.connect(self.orderingDownButton, QtCore.SIGNAL(u'pressed()'), self.onOrderingDownButtonPressed) def retranslateUi(self): - self.mediaAPIGroupBox.setTitle( - translate('MediaPlugin.MediaTab', 'Available Media APIs')) - for key in self.media_apis: - api = self.media_apis[key] - checkbox = self.ApiCheckBoxes[api.name] - if api.available: - checkbox.setText(api.name) + self.mediaPlayerGroupBox.setTitle( + translate('MediaPlugin.MediaTab', 'Available Media Players')) + for key in self.media_players: + player = self.media_players[key] + checkbox = self.PlayerCheckBoxes[player.name] + if player.available: + checkbox.setText(player.name) else: checkbox.setText( unicode(translate('MediaPlugin.MediaTab', - '%s (unavailable)')) % api.name) - self.apiOrderGroupBox.setTitle( - translate('MediaPlugin.MediaTab', 'API Order')) + '%s (unavailable)')) % player.name) + self.playerOrderGroupBox.setTitle( + translate('MediaPlugin.MediaTab', 'Player Order')) self.orderingDownButton.setText( translate('MediaPlugin.MediaTab', 'Down')) self.orderingUpButton.setText( translate('MediaPlugin.MediaTab', 'Up')) self.AdvancedGroupBox.setTitle(UiStrings().Advanced) - self.OverrideApiCheckBox.setText( + self.OverridePlayerCheckBox.setText( translate('MediaPlugin.MediaTab', - 'Allow media api to be overriden')) + 'Allow media player to be overriden')) - def onApiCheckBoxChanged(self, check_state): - api = self.sender().text() + def onPlayerCheckBoxChanged(self, check_state): + player = self.sender().text() if check_state == QtCore.Qt.Checked: - if api not in self.usedAPIs: - self.usedAPIs.append(api) + if player not in self.usedPlayers: + self.usedPlayers.append(player) else: - self.usedAPIs.takeAt(self.usedAPIs.indexOf(api)) - self.updateApiList() + self.usedPlayers.takeAt(self.usedPlayers.indexOf(player)) + self.updatePlayerList() - def updateApiList(self): - self.apiOrderlistWidget.clear() - for api in self.usedAPIs: - if api in self.ApiCheckBoxes.keys(): - self.apiOrderlistWidget.addItem(api) + def updatePlayerList(self): + self.playerOrderlistWidget.clear() + for player in self.usedPlayers: + if player in self.PlayerCheckBoxes.keys(): + self.playerOrderlistWidget.addItem(player) def onOrderingUpButtonPressed(self): - currentRow = self.apiOrderlistWidget.currentRow() + currentRow = self.playerOrderlistWidget.currentRow() if currentRow > 0: - item = self.apiOrderlistWidget.takeItem(currentRow) - self.apiOrderlistWidget.insertItem(currentRow - 1, item) - self.apiOrderlistWidget.setCurrentRow(currentRow - 1) - self.usedAPIs.move(currentRow, currentRow - 1) + item = self.playerOrderlistWidget.takeItem(currentRow) + self.playerOrderlistWidget.insertItem(currentRow - 1, item) + self.playerOrderlistWidget.setCurrentRow(currentRow - 1) + self.usedPlayers.move(currentRow, currentRow - 1) def onOrderingDownButtonPressed(self): - currentRow = self.apiOrderlistWidget.currentRow() - if currentRow < self.apiOrderlistWidget.count() - 1: - item = self.apiOrderlistWidget.takeItem(currentRow) - self.apiOrderlistWidget.insertItem(currentRow + 1, item) - self.apiOrderlistWidget.setCurrentRow(currentRow + 1) - self.usedAPIs.move(currentRow, currentRow + 1) + currentRow = self.playerOrderlistWidget.currentRow() + if currentRow < self.playerOrderlistWidget.count() - 1: + item = self.playerOrderlistWidget.takeItem(currentRow) + self.playerOrderlistWidget.insertItem(currentRow + 1, item) + self.playerOrderlistWidget.setCurrentRow(currentRow + 1) + self.usedPlayers.move(currentRow, currentRow + 1) def load(self): - self.usedAPIs = QtCore.QSettings().value( - self.settingsSection + u'/apis', + self.usedPlayers = QtCore.QSettings().value( + self.settingsSection + u'/players', QtCore.QVariant(u'webkit')).toString().split(u',') - for key in self.media_apis: - api = self.media_apis[key] - checkbox = self.ApiCheckBoxes[api.name] - if api.available and api.name in self.usedAPIs: + for key in self.media_players: + player = self.media_players[key] + checkbox = self.PlayerCheckBoxes[player.name] + if player.available and player.name in self.usedPlayers: checkbox.setChecked(True) - self.updateApiList() - self.OverrideApiCheckBox.setChecked(QtCore.QSettings().value( - self.settingsSection + u'/override api', + self.updatePlayerList() + self.OverridePlayerCheckBox.setChecked(QtCore.QSettings().value( + self.settingsSection + u'/override player', QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0]) def save(self): override_changed = False - api_string_changed = False - oldApiString = QtCore.QSettings().value( - self.settingsSection + u'/apis', + player_string_changed = False + oldPlayerString = QtCore.QSettings().value( + self.settingsSection + u'/players', QtCore.QVariant(u'webkit')).toString() - newApiString = self.usedAPIs.join(u',') - if oldApiString != newApiString: + newPlayerString = self.usedPlayers.join(u',') + if oldPlayerString != newPlayerString: # clean old Media stuff - QtCore.QSettings().setValue(self.settingsSection + u'/apis', - QtCore.QVariant(newApiString)) - api_string_changed = True + QtCore.QSettings().setValue(self.settingsSection + u'/players', + QtCore.QVariant(newPlayerString)) + player_string_changed = True override_changed = True - setting_key = self.settingsSection + u'/override api' + setting_key = self.settingsSection + u'/override player' if QtCore.QSettings().value(setting_key) != \ - self.OverrideApiCheckBox.checkState(): + self.OverridePlayerCheckBox.checkState(): QtCore.QSettings().setValue(setting_key, - QtCore.QVariant(self.OverrideApiCheckBox.checkState())) + QtCore.QVariant(self.OverridePlayerCheckBox.checkState())) override_changed = True if override_changed: Receiver.send_message(u'mediaitem_media_rebuild') - if api_string_changed: + if player_string_changed: Receiver.send_message(u'config_screen_changed') diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 9629ea35e..13a84b289 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -59,7 +59,7 @@ class MediaPlugin(Plugin): """ visible_name = self.getString(StringContent.VisibleName) return MediaTab(parent, self.name, visible_name[u'title'], - self.mediaController.mediaApis, self.icon_path) + self.mediaController.mediaPlayers, self.icon_path) def about(self): about_text = translate('MediaPlugin', 'Media Plugin' diff --git a/resources/forms/mediafilesdialog.ui b/resources/forms/mediafilesdialog.ui deleted file mode 100644 index 427e27548..000000000 --- a/resources/forms/mediafilesdialog.ui +++ /dev/null @@ -1,95 +0,0 @@ - - - MediaFilesDialog - - - Qt::ApplicationModal - - - - 0 - 0 - 400 - 300 - - - - Select Media File(s) - - - true - - - - 8 - - - 8 - - - - - Select one or more audio files from the list below, and click OK to import them into this song. - - - true - - - - - - - true - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - buttonBox - accepted() - MediaFilesDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - MediaFilesDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/resources/pyinstaller/hook-openlp.media.py b/resources/pyinstaller/hook-openlp.core.ui.media.py similarity index 92% rename from resources/pyinstaller/hook-openlp.media.py rename to resources/pyinstaller/hook-openlp.core.ui.media.py index bdc44d2c8..45bc39734 100644 --- a/resources/pyinstaller/hook-openlp.media.py +++ b/resources/pyinstaller/hook-openlp.core.ui.media.py @@ -25,6 +25,5 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -hiddenimports = ['openlp.core.ui.media.phononapi', - 'openlp.core.ui.media.vlcapi', - 'openlp.core.ui.media.webkitapi'] +hiddenimports = ['openlp.core.ui.media.phononplayer', + 'openlp.core.ui.media.webkitplayer']