forked from openlp/openlp
correct merge proposal issues
This commit is contained in:
parent
38e08a5c8b
commit
18bda31ee9
@ -235,7 +235,7 @@ sup {
|
||||
</html>
|
||||
"""
|
||||
|
||||
def build_html(item, screen, alert, islive, background, plugins=None, \
|
||||
def build_html(item, screen, alert, islive, background, plugins=None,
|
||||
image=None):
|
||||
"""
|
||||
Build the full web paged structure for display
|
||||
|
@ -385,6 +385,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
if filename in names:
|
||||
duplicatesFound = True
|
||||
else:
|
||||
print file
|
||||
newFiles.append(file)
|
||||
if newFiles:
|
||||
self.loadList(newFiles)
|
||||
|
@ -127,7 +127,7 @@ class MainDisplay(Display):
|
||||
self.webView = QtWebKit.QWebView(self)
|
||||
self.webView.setGeometry(0, 0,
|
||||
self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||
self.webView.settings().setAttribute( \
|
||||
self.webView.settings().setAttribute(
|
||||
QtWebKit.QWebSettings.PluginsEnabled, True)
|
||||
self.page = self.webView.page()
|
||||
self.frame = self.page.mainFrame()
|
||||
@ -206,8 +206,8 @@ class MainDisplay(Display):
|
||||
The slide text to be displayed
|
||||
"""
|
||||
log.debug(u'alert to display')
|
||||
if self.height() != self.screen[u'size'].height() \
|
||||
or not self.isVisible():
|
||||
if self.height() != self.screen[u'size'].height() or \
|
||||
not self.isVisible():
|
||||
shrink = True
|
||||
else:
|
||||
shrink = False
|
||||
@ -216,19 +216,18 @@ class MainDisplay(Display):
|
||||
u'top' if shrink else u'')
|
||||
height = self.frame.evaluateJavaScript(js)
|
||||
if shrink:
|
||||
shrinkItem = self
|
||||
if text:
|
||||
alert_height = int(height.toString())
|
||||
shrinkItem.resize(self.width(), alert_height)
|
||||
shrinkItem.setVisible(True)
|
||||
self.resize(self.width(), alert_height)
|
||||
self.setVisible(True)
|
||||
if self.alertTab.location == 1:
|
||||
shrinkItem.move(self.screen[u'size'].left(),
|
||||
self.move(self.screen[u'size'].left(),
|
||||
(self.screen[u'size'].height() - alert_height) / 2)
|
||||
elif self.alertTab.location == 2:
|
||||
shrinkItem.move(self.screen[u'size'].left(),
|
||||
self.move(self.screen[u'size'].left(),
|
||||
self.screen[u'size'].height() - alert_height)
|
||||
else:
|
||||
shrinkItem.setVisible(False)
|
||||
self.setVisible(False)
|
||||
self.setGeometry(self.screen[u'size'])
|
||||
|
||||
def directImage(self, name, path, background):
|
||||
|
@ -36,6 +36,7 @@ class MediaState(object):
|
||||
Paused = 4
|
||||
Off = 6
|
||||
|
||||
|
||||
class MediaType(object):
|
||||
"""
|
||||
"""
|
||||
@ -46,6 +47,7 @@ class MediaType(object):
|
||||
DVD = 4
|
||||
Folder = 5
|
||||
|
||||
|
||||
class MediaInfo(object):
|
||||
"""
|
||||
This class hold the media related infos
|
||||
|
@ -30,15 +30,16 @@ from openlp.core.ui.media import MediaState
|
||||
class MediaAPI(object):
|
||||
"""
|
||||
A generic media API class to provide OpenLP
|
||||
with a pluggable media display framework.
|
||||
with a pluggable media display framework.
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, parent, name=u'MediaApi'):
|
||||
self.parent = parent
|
||||
self.name = name
|
||||
self.available = self.check_available()
|
||||
self.isActive = False
|
||||
self.canBackground = False
|
||||
self.canFolder = False
|
||||
self.state = MediaState.Off
|
||||
self.hasOwnWidget = False
|
||||
self.audio_extensions_list = []
|
||||
|
@ -39,35 +39,24 @@ log = logging.getLogger(__name__)
|
||||
|
||||
class MediaController(object):
|
||||
"""
|
||||
The implementation of a Media Manager
|
||||
The idea is to separate the media related implementation
|
||||
into the plugin files and unify the access from other parts of code
|
||||
The media manager adds an own class for every API
|
||||
The implementation of the Media Controller
|
||||
The Media Controller adds an own class for every API
|
||||
Currently these are QtWebkit, Phonon and planed Vlc.
|
||||
Manager
|
||||
- different API classes with specialised Access functions
|
||||
|
||||
Controller
|
||||
- have general and API specific control Elements
|
||||
- have one or more displays (Preview, Live, ...) with different settings
|
||||
|
||||
Display
|
||||
- have API-Specific Display Elements
|
||||
- have media info for current media
|
||||
"""
|
||||
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
self.APIs = {}
|
||||
self.controller = []
|
||||
self.overridenApi = ''
|
||||
self.curDisplayMediaAPI = {}
|
||||
# Timer for video state
|
||||
self.Timer = QtCore.QTimer()
|
||||
self.Timer.setInterval(200)
|
||||
self.timer = QtCore.QTimer()
|
||||
self.timer.setInterval(200)
|
||||
self.withLivePreview = False
|
||||
self.check_available_media_apis()
|
||||
# Signals
|
||||
QtCore.QObject.connect(self.Timer,
|
||||
QtCore.QObject.connect(self.timer,
|
||||
QtCore.SIGNAL("timeout()"), self.video_state)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'Media Start'), self.video_play)
|
||||
@ -85,6 +74,8 @@ class MediaController(object):
|
||||
QtCore.SIGNAL(u'media_blank'), self.video_blank)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_unblank'), self.video_unblank)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'media_overrideApi'), self.override_api)
|
||||
|
||||
def register_controllers(self, controller):
|
||||
"""
|
||||
@ -132,7 +123,7 @@ class MediaController(object):
|
||||
"""
|
||||
isAnyonePlaying = False
|
||||
if len(self.curDisplayMediaAPI.keys()) == 0:
|
||||
self.Timer.stop()
|
||||
self.timer.stop()
|
||||
else:
|
||||
for display in self.curDisplayMediaAPI.keys():
|
||||
self.curDisplayMediaAPI[display].resize(display)
|
||||
@ -141,7 +132,7 @@ class MediaController(object):
|
||||
.state == MediaState.Playing:
|
||||
isAnyonePlaying = True
|
||||
if not isAnyonePlaying:
|
||||
self.Timer.stop()
|
||||
self.timer.stop()
|
||||
|
||||
def get_media_display_css(self):
|
||||
"""
|
||||
@ -306,6 +297,10 @@ class MediaController(object):
|
||||
apiSettings = str(QtCore.QSettings().value(u'media/apis',
|
||||
QtCore.QVariant(u'Webkit')).toString())
|
||||
usedAPIs = apiSettings.split(u',')
|
||||
if QtCore.QSettings().value(u'media/override api',
|
||||
QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
|
||||
if self.overridenApi != '':
|
||||
usedAPIs = [self.overridenApi]
|
||||
if controller.media_info.file_info.isFile():
|
||||
suffix = u'*.%s' % controller.media_info.file_info.suffix()
|
||||
for title in usedAPIs:
|
||||
@ -323,6 +318,15 @@ class MediaController(object):
|
||||
self.curDisplayMediaAPI[display] = api
|
||||
controller.media_info.media_type = MediaType.Audio
|
||||
return True
|
||||
else:
|
||||
for title in usedAPIs:
|
||||
api = self.APIs[title]
|
||||
if api.canFolder:
|
||||
self.resize(controller, display, api)
|
||||
if api.load(display):
|
||||
self.curDisplayMediaAPI[display] = api
|
||||
controller.media_info.media_type = MediaType.Video
|
||||
return True
|
||||
# no valid api found
|
||||
return False
|
||||
|
||||
@ -341,8 +345,8 @@ class MediaController(object):
|
||||
return False
|
||||
self.curDisplayMediaAPI[display].set_visible(display, True)
|
||||
# Start Timer for ui updates
|
||||
if not self.Timer.isActive():
|
||||
self.Timer.start()
|
||||
if not self.timer.isActive():
|
||||
self.timer.start()
|
||||
return True
|
||||
|
||||
def video_pause(self, msg):
|
||||
@ -463,7 +467,16 @@ class MediaController(object):
|
||||
video_list.append(item)
|
||||
return video_list
|
||||
|
||||
def override_api(self, override_api):
|
||||
apiSettings = str(QtCore.QSettings().value(u'media/apis',
|
||||
QtCore.QVariant(u'Webkit')).toString())
|
||||
usedAPIs = apiSettings.split(u',')
|
||||
if override_api in usedAPIs:
|
||||
self.overridenApi = override_api
|
||||
else:
|
||||
self.overridenApi = ''
|
||||
|
||||
def finalise(self):
|
||||
self.Timer.stop()
|
||||
self.timer.stop()
|
||||
for controller in self.controller:
|
||||
self.video_reset(controller)
|
||||
|
@ -42,13 +42,14 @@ log = logging.getLogger(__name__)
|
||||
|
||||
class VlcAPI(MediaAPI):
|
||||
"""
|
||||
A specialised version of the MediaAPI class,
|
||||
A specialised version of the MediaAPI class,
|
||||
which provides a QtWebKit display.
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, parent):
|
||||
MediaAPI.__init__(self, parent, u'Vlc')
|
||||
self.parent = parent
|
||||
self.canFolder = True
|
||||
self.audio_extensions_list = [
|
||||
u'*.mp3'
|
||||
, u'*.wav'
|
||||
@ -136,7 +137,7 @@ class VlcAPI(MediaAPI):
|
||||
if display.vlcMedia.get_state() == vlc.State.Error:
|
||||
return False
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
if (datetime.now() - start).seconds > 5:
|
||||
if (datetime.now() - start).seconds > 50:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
28
openlp/plugins/media/forms/__init__.py
Normal file
28
openlp/plugins/media/forms/__init__.py
Normal file
@ -0,0 +1,28 @@
|
||||
# -*- 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
|
297
openlp/plugins/media/forms/mediaopendialog.py
Normal file
297
openlp/plugins/media/forms/mediaopendialog.py
Normal file
@ -0,0 +1,297 @@
|
||||
# -*- 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'))
|
||||
|
50
openlp/plugins/media/forms/mediaopenform.py
Normal file
50
openlp/plugins/media/forms/mediaopenform.py
Normal file
@ -0,0 +1,50 @@
|
||||
# -*- 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
|
||||
# QtCore.QObject.connect(self.previewButton,
|
||||
# QtCore.SIGNAL(u'pressed()'), self.onPreviewButtonPressed)
|
@ -33,8 +33,10 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
|
||||
SettingsManager, translate, check_item_selected, Receiver
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
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__)
|
||||
|
||||
@ -50,8 +52,10 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.IconPath = u'images/image'
|
||||
self.background = False
|
||||
self.PreviewFunction = CLAPPERBOARD
|
||||
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)
|
||||
@ -70,6 +74,8 @@ class MediaMediaItem(MediaManagerItem):
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'video_background_replaced'),
|
||||
self.videobackgroundReplaced)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'mediaitem_media_rebuild'), self.rebuild)
|
||||
# Allow DnD from the desktop
|
||||
self.listView.activateDnD()
|
||||
|
||||
@ -83,10 +89,19 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.replaceAction.setToolTip(UiStrings().ReplaceLiveBG)
|
||||
self.resetAction.setText(UiStrings().ResetBG)
|
||||
self.resetAction.setToolTip(UiStrings().ResetLiveBG)
|
||||
self.Automatic = translate('MediaPlugin.MediaItem',
|
||||
'Automatic')
|
||||
self.displayTypeLabel.setText(
|
||||
translate('MediaPlugin.MediaItem', 'Use Api:'))
|
||||
|
||||
def requiredIcons(self):
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
self.hasFileIcon = True
|
||||
apiSettings = str(QtCore.QSettings().value(u'media/apis',
|
||||
QtCore.QVariant(u'Webkit')).toString())
|
||||
usedAPIs = apiSettings.split(u',')
|
||||
for title in usedAPIs:
|
||||
api = self.plugin.mediaController.APIs[title]
|
||||
self.hasNewIcon = False
|
||||
self.hasEditIcon = False
|
||||
|
||||
@ -94,6 +109,10 @@ class MediaMediaItem(MediaManagerItem):
|
||||
MediaManagerItem.addListViewToToolBar(self)
|
||||
self.listView.addAction(self.replaceAction)
|
||||
|
||||
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'',
|
||||
@ -101,6 +120,36 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.resetAction = self.addToolbarButton(u'', u'',
|
||||
u':/system/system_close.png', self.onResetClick, False)
|
||||
self.resetAction.setVisible(False)
|
||||
self.mediaWidget = QtGui.QWidget(self)
|
||||
self.mediaWidget.setObjectName(u'mediaWidget')
|
||||
self.displayLayout = QtGui.QFormLayout(self.mediaWidget)
|
||||
self.displayLayout.setMargin(self.displayLayout.spacing())
|
||||
self.displayLayout.setObjectName(u'displayLayout')
|
||||
self.displayTypeLabel = QtGui.QLabel(self.mediaWidget)
|
||||
self.displayTypeLabel.setObjectName(u'displayTypeLabel')
|
||||
self.displayTypeComboBox = media_item_combo_box(
|
||||
self.mediaWidget, u'displayTypeComboBox')
|
||||
self.displayTypeLabel.setBuddy(self.displayTypeComboBox)
|
||||
self.displayLayout.addRow(self.displayTypeLabel,
|
||||
self.displayTypeComboBox)
|
||||
# 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)
|
||||
|
||||
def onMediaOpenClick(self):
|
||||
"""
|
||||
Add a folder to the list widget to make it available for showing
|
||||
"""
|
||||
self.mediaOpenForm.exec_()
|
||||
# folder = QtGui.QFileDialog.getExistingDirectory (
|
||||
# self, self.onNewPrompt,
|
||||
# SettingsManager.get_last_dir(self.settingsSection))
|
||||
# log.info(u'New folder(s) %s', unicode(folder))
|
||||
|
||||
def overrideApiChanged(self, index):
|
||||
Receiver.send_message(u'media_overrideApi', \
|
||||
u'%s' % self.displayTypeComboBox.currentText())
|
||||
|
||||
def onResetClick(self):
|
||||
"""
|
||||
@ -177,6 +226,36 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.listView.clear()
|
||||
self.listView.setIconSize(QtCore.QSize(88, 50))
|
||||
self.loadList(SettingsManager.load_list(self.settingsSection, u'media'))
|
||||
self.populateDisplayTypes()
|
||||
|
||||
def rebuild(self):
|
||||
"""
|
||||
Rebuild the tab in the media manager when changes are made in
|
||||
the settings
|
||||
"""
|
||||
self.populateDisplayTypes()
|
||||
|
||||
def populateDisplayTypes(self):
|
||||
"""
|
||||
Load the combobox with the enabled media apis,
|
||||
allowing user to select a specific api if settings allow
|
||||
"""
|
||||
self.displayTypeComboBox.clear()
|
||||
apiSettings = str(QtCore.QSettings().value(u'media/apis',
|
||||
QtCore.QVariant(u'Webkit')).toString())
|
||||
usedAPIs = apiSettings.split(u',')
|
||||
for title in usedAPIs:
|
||||
# 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',
|
||||
QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
|
||||
self.mediaWidget.show()
|
||||
else:
|
||||
self.mediaWidget.hide()
|
||||
|
||||
|
||||
def onDeleteClick(self):
|
||||
"""
|
||||
@ -197,10 +276,21 @@ class MediaMediaItem(MediaManagerItem):
|
||||
media.sort(cmp=locale.strcoll,
|
||||
key=lambda filename: os.path.split(unicode(filename))[1].lower())
|
||||
for track in media:
|
||||
filename = os.path.split(unicode(track))[1]
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setIcon(build_icon(CLAPPERBOARD))
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
||||
track_info = QtCore.QFileInfo(track)
|
||||
if not track_info.isFile():
|
||||
filename = os.path.split(unicode(track))[1]
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
item_name.setIcon(build_icon(CLAPPERBOARD))
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
||||
else:
|
||||
print "tus doch"
|
||||
filename = os.path.split(unicode(track))[1]
|
||||
item_name = QtGui.QListWidgetItem(filename)
|
||||
imageFile = u'F:/Computer/Platform/pythonDev/openlp/branches/media/media-optical-dvd-video.png'
|
||||
thumbFile = u'F:/Computer/Platform/pythonDev/openlp/branches/media/media-optical-dvd-video_thumb.png'
|
||||
icon = self.iconFromFile(imageFile, thumbFile)
|
||||
item_name.setIcon(icon)
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
||||
item_name.setToolTip(track)
|
||||
self.listView.addItem(item_name)
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
|
||||
class MediaTab(SettingsTab):
|
||||
"""
|
||||
@ -87,6 +88,14 @@ class MediaTab(SettingsTab):
|
||||
self.orderingButtonLayout.addWidget(self.orderingUpButton)
|
||||
self.apiOrderLayout.addWidget(self.orderingButtonsWidget)
|
||||
self.leftLayout.addWidget(self.apiOrderGroupBox)
|
||||
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.leftLayout.addWidget(self.AdvancedGroupBox)
|
||||
self.leftLayout.addStretch()
|
||||
self.rightLayout.addStretch()
|
||||
for key in self.apis:
|
||||
@ -102,7 +111,7 @@ class MediaTab(SettingsTab):
|
||||
|
||||
def retranslateUi(self):
|
||||
self.mediaAPIGroupBox.setTitle(
|
||||
translate('MediaPlugin.MediaTab', 'Media APIs'))
|
||||
translate('MediaPlugin.MediaTab', 'Available Media APIs'))
|
||||
for key in self.apis:
|
||||
api = self.apis[key]
|
||||
checkbox = self.ApiCheckBoxes[api.name]
|
||||
@ -118,6 +127,10 @@ class MediaTab(SettingsTab):
|
||||
translate('MediaPlugin.MediaTab', 'Down'))
|
||||
self.orderingUpButton.setText(
|
||||
translate('MediaPlugin.MediaTab', 'Up'))
|
||||
self.AdvancedGroupBox.setTitle(UiStrings().Advanced)
|
||||
self.OverrideApiCheckBox.setText(
|
||||
translate('MediaPlugin.MediaTab',
|
||||
'Allow media api to be overriden'))
|
||||
|
||||
def onApiCheckBoxChanged(self, check_state):
|
||||
api = self.sender().text()
|
||||
@ -160,8 +173,13 @@ class MediaTab(SettingsTab):
|
||||
if api.available and api.name in self.usedAPIs:
|
||||
checkbox.setChecked(True)
|
||||
self.updateApiList()
|
||||
self.OverrideApiCheckBox.setChecked(QtCore.QSettings().value(
|
||||
self.settingsSection + u'/override api',
|
||||
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',
|
||||
QtCore.QVariant(u'Webkit')).toString()
|
||||
@ -170,4 +188,16 @@ class MediaTab(SettingsTab):
|
||||
# clean old Media stuff
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/apis',
|
||||
QtCore.QVariant(newApiString))
|
||||
api_string_changed = True
|
||||
override_changed = True
|
||||
setting_key = self.settingsSection + u'/override api'
|
||||
if QtCore.QSettings().value(setting_key) != \
|
||||
self.OverrideApiCheckBox.checkState():
|
||||
QtCore.QSettings().setValue(setting_key,
|
||||
QtCore.QVariant(self.OverrideApiCheckBox.checkState()))
|
||||
override_changed = True
|
||||
if override_changed:
|
||||
Receiver.send_message(u'mediaitem_media_rebuild')
|
||||
if api_string_changed:
|
||||
Receiver.send_message(u'config_screen_changed')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user