forked from openlp/openlp
cleanup, correct settings tab
This commit is contained in:
parent
d39ecb8e8e
commit
82a14745e3
@ -405,7 +405,6 @@ class MainDisplay(QtGui.QGraphicsView):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'showDisplay')
|
log.debug(u'showDisplay')
|
||||||
self.frame.evaluateJavaScript('show_blank("show");')
|
self.frame.evaluateJavaScript('show_blank("show");')
|
||||||
print "showDisplay", self.isHidden()
|
|
||||||
if self.isHidden():
|
if self.isHidden():
|
||||||
self.setVisible(True)
|
self.setVisible(True)
|
||||||
self.hideMode = None
|
self.hideMode = None
|
||||||
|
@ -849,7 +849,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Tell the plugin to hide the display screen.
|
Tell the plugin to hide the display screen.
|
||||||
"""
|
"""
|
||||||
print "hidePlugin", hide
|
|
||||||
log.debug(u'hidePlugin %s ', hide)
|
log.debug(u'hidePlugin %s ', hide)
|
||||||
if self.serviceItem is not None:
|
if self.serviceItem is not None:
|
||||||
if hide:
|
if hide:
|
||||||
|
@ -63,7 +63,7 @@ class MediaController(object):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def load(self, display, path, volume):
|
def load(self, display, path, volume, isBackground):
|
||||||
"""
|
"""
|
||||||
Load a new media file and check if it is valid
|
Load a new media file and check if it is valid
|
||||||
"""
|
"""
|
||||||
|
@ -152,30 +152,26 @@ class MediaManager(object):
|
|||||||
#stop running videos
|
#stop running videos
|
||||||
self.video_reset(controller)
|
self.video_reset(controller)
|
||||||
if controller.isLive:
|
if controller.isLive:
|
||||||
# if isBackground:
|
|
||||||
# We are running a background theme
|
|
||||||
controller.display.override[u'theme'] = u''
|
|
||||||
controller.display.override[u'video'] = True
|
|
||||||
if self.withLivePreview:
|
if self.withLivePreview:
|
||||||
display = controller.previewDisplay
|
display = controller.previewDisplay
|
||||||
if self.check_file_type(display, videoPath, False):
|
if self.check_file_type(display, videoPath, False):
|
||||||
#check size of all media_widgets
|
#check size of all media_widgets
|
||||||
self.resize(controller)
|
self.resize(controller)
|
||||||
self.curDisplayMediaController[display] \
|
self.curDisplayMediaController[display] \
|
||||||
.load(display, videoPath, volume)
|
.load(display, videoPath, volume, isBackground)
|
||||||
display = controller.display
|
display = controller.display
|
||||||
if self.check_file_type(display, videoPath, isBackground):
|
if self.check_file_type(display, videoPath, isBackground):
|
||||||
#check size of all media_widgets
|
#check size of all media_widgets
|
||||||
self.resize(controller)
|
self.resize(controller)
|
||||||
isValid = self.curDisplayMediaController[display] \
|
isValid = self.curDisplayMediaController[display] \
|
||||||
.load(display, videoPath, volume)
|
.load(display, videoPath, volume, isBackground)
|
||||||
else:
|
else:
|
||||||
display = controller.previewDisplay
|
display = controller.previewDisplay
|
||||||
if self.check_file_type(display, videoPath, isBackground):
|
if self.check_file_type(display, videoPath, isBackground):
|
||||||
#check size of all media_widgets
|
#check size of all media_widgets
|
||||||
self.resize(controller)
|
self.resize(controller)
|
||||||
isValid = self.curDisplayMediaController[display] \
|
isValid = self.curDisplayMediaController[display] \
|
||||||
.load(display, videoPath, volume)
|
.load(display, videoPath, volume, isBackground)
|
||||||
if not isValid:
|
if not isValid:
|
||||||
#Media could not be loaded correctly
|
#Media could not be loaded correctly
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
|
@ -131,28 +131,13 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
unicode(translate('MediaPlugin.MediaItem',
|
unicode(translate('MediaPlugin.MediaItem',
|
||||||
'The file %s no longer exists.')) % filename)
|
'The file %s no longer exists.')) % filename)
|
||||||
return False
|
return False
|
||||||
# File too big for processing
|
self.mediaLength = 0
|
||||||
if os.path.getsize(filename) <= 52428800: # 50MiB
|
service_item.media_length = self.mediaLength
|
||||||
# self.mediaObject.play()
|
service_item.add_capability(
|
||||||
# if not self.mediaStateWait(Phonon.Playing) \
|
|
||||||
# or self.mediaObject.currentSource().type() \
|
|
||||||
# == Phonon.MediaSource.Invalid:
|
|
||||||
# # Due to string freeze, borrow a message from presentations
|
|
||||||
# # This will be corrected in 1.9.6
|
|
||||||
# self.mediaObject.stop()
|
|
||||||
# critical_error_message_box(
|
|
||||||
# translate('PresentationPlugin.MediaItem',
|
|
||||||
# 'Unsupported File'),
|
|
||||||
# unicode(translate('PresentationPlugin.MediaItem',
|
|
||||||
# 'Unsupported File')))
|
|
||||||
# #return False
|
|
||||||
# self.mediaLength = self.mediaObject.totalTime() / 1000
|
|
||||||
# self.mediaObject.stop()
|
|
||||||
# service_item.media_length = self.mediaLength
|
|
||||||
service_item.add_capability(
|
|
||||||
ItemCapabilities.AllowsVariableStartTime)
|
ItemCapabilities.AllowsVariableStartTime)
|
||||||
service_item.title = unicode(self.plugin.nameStrings[u'singular'])
|
service_item.title = unicode(self.plugin.nameStrings[u'singular'])
|
||||||
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
service_item.add_capability(ItemCapabilities.RequiresMedia)
|
||||||
|
#Receiver.send_message(u'media_video', [self.parent.liveController, filename, 0, False])
|
||||||
# force a non-existent theme
|
# force a non-existent theme
|
||||||
service_item.theme = -1
|
service_item.theme = -1
|
||||||
frame = u':/media/image_clapperboard.png'
|
frame = u':/media/image_clapperboard.png'
|
||||||
|
@ -38,26 +38,32 @@ class MediaTab(SettingsTab):
|
|||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.setObjectName(u'MediaTab')
|
self.setObjectName(u'MediaTab')
|
||||||
SettingsTab.setupUi(self)
|
SettingsTab.setupUi(self)
|
||||||
self.mediaLayoutWidget = QtGui.QWidget(self.leftColumn)
|
self.mediaBackendsGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.mediaBackendLayout = QtGui.QVBoxLayout(self.mediaLayoutWidget)
|
|
||||||
self.mediaBackendLayout.setObjectName(u'mediaBackendLayout')
|
|
||||||
self.mediaBackendsGroupBox = QtGui.QGroupBox(self.mediaLayoutWidget)
|
|
||||||
self.mediaBackendsGroupBox.setObjectName(u'mediaBackendsGroupBox')
|
self.mediaBackendsGroupBox.setObjectName(u'mediaBackendsGroupBox')
|
||||||
self.mediaBackendsGroupLayout = QtGui.QVBoxLayout( \
|
self.mediaBackendLayout = QtGui.QVBoxLayout(self.mediaBackendsGroupBox)
|
||||||
self.mediaBackendsGroupBox)
|
self.mediaBackendLayout.setObjectName(u'mediaBackendLayout')
|
||||||
self.mediaBackendsGroupLayout.setObjectName( \
|
|
||||||
u'mediaBackendsGroupLayout')
|
|
||||||
self.usePhononCheckBox = QtGui.QCheckBox(self.mediaBackendsGroupBox)
|
self.usePhononCheckBox = QtGui.QCheckBox(self.mediaBackendsGroupBox)
|
||||||
self.usePhononCheckBox.setObjectName(u'usePhononCheckBox')
|
self.usePhononCheckBox.setObjectName(u'usePhononCheckBox')
|
||||||
self.mediaBackendsGroupLayout.addWidget(self.usePhononCheckBox)
|
self.mediaBackendLayout.addWidget(self.usePhononCheckBox)
|
||||||
self.useVlcCheckBox = QtGui.QCheckBox(self.mediaBackendsGroupBox)
|
self.useVlcCheckBox = QtGui.QCheckBox(self.mediaBackendsGroupBox)
|
||||||
self.useVlcCheckBox.setObjectName(u'useVlcCheckBox')
|
self.useVlcCheckBox.setObjectName(u'useVlcCheckBox')
|
||||||
self.mediaBackendsGroupLayout.addWidget(self.useVlcCheckBox)
|
self.mediaBackendLayout.addWidget(self.useVlcCheckBox)
|
||||||
self.mediaBackendLayout.addWidget(self.mediaBackendsGroupBox)
|
self.leftLayout.addWidget(self.mediaBackendsGroupBox)
|
||||||
self.backendOrderLabel = QtGui.QLabel(self.mediaLayoutWidget)
|
|
||||||
self.backendOrderLabel.setObjectName(u'backendOrderLabel')
|
self.backendOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.mediaBackendLayout.addWidget(self.backendOrderLabel)
|
self.backendOrderGroupBox.setObjectName(u'backendOrderGroupBox')
|
||||||
self.backendOrderlistWidget = QtGui.QListWidget(self.mediaLayoutWidget)
|
self.backendOrderLayout = QtGui.QVBoxLayout(self.backendOrderGroupBox)
|
||||||
|
self.backendOrderLayout.setObjectName(u'backendOrderLayout')
|
||||||
|
self.backendOrderlistWidget = QtGui.QListWidget( \
|
||||||
|
self.backendOrderGroupBox)
|
||||||
|
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
||||||
|
QtGui.QSizePolicy.Expanding)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(self.backendOrderlistWidget. \
|
||||||
|
sizePolicy().hasHeightForWidth())
|
||||||
|
self.backendOrderlistWidget.setSizePolicy(sizePolicy)
|
||||||
|
|
||||||
self.backendOrderlistWidget.setVerticalScrollBarPolicy( \
|
self.backendOrderlistWidget.setVerticalScrollBarPolicy( \
|
||||||
QtCore.Qt.ScrollBarAsNeeded)
|
QtCore.Qt.ScrollBarAsNeeded)
|
||||||
self.backendOrderlistWidget.setHorizontalScrollBarPolicy( \
|
self.backendOrderlistWidget.setHorizontalScrollBarPolicy( \
|
||||||
@ -65,18 +71,19 @@ class MediaTab(SettingsTab):
|
|||||||
self.backendOrderlistWidget.setEditTriggers( \
|
self.backendOrderlistWidget.setEditTriggers( \
|
||||||
QtGui.QAbstractItemView.NoEditTriggers)
|
QtGui.QAbstractItemView.NoEditTriggers)
|
||||||
self.backendOrderlistWidget.setObjectName(u'backendOrderlistWidget')
|
self.backendOrderlistWidget.setObjectName(u'backendOrderlistWidget')
|
||||||
self.mediaBackendLayout.addWidget(self.backendOrderlistWidget)
|
self.backendOrderLayout.addWidget(self.backendOrderlistWidget)
|
||||||
self.orderingButtonLayout = QtGui.QHBoxLayout()
|
self.orderingButtonsWidget = QtGui.QWidget(self.backendOrderGroupBox)
|
||||||
|
self.orderingButtonsWidget.setObjectName(u'orderingButtonsWidget')
|
||||||
|
self.orderingButtonLayout = QtGui.QHBoxLayout(self.orderingButtonsWidget)
|
||||||
self.orderingButtonLayout.setObjectName(u'orderingButtonLayout')
|
self.orderingButtonLayout.setObjectName(u'orderingButtonLayout')
|
||||||
self.orderingDownButton = QtGui.QPushButton(self.mediaLayoutWidget)
|
self.orderingDownButton = QtGui.QPushButton(self.orderingButtonsWidget)
|
||||||
self.orderingDownButton.setObjectName(u'orderingDownButton')
|
self.orderingDownButton.setObjectName(u'orderingDownButton')
|
||||||
self.orderingButtonLayout.addWidget(self.orderingDownButton)
|
self.orderingButtonLayout.addWidget(self.orderingDownButton)
|
||||||
self.orderingUpButton = QtGui.QPushButton(self.mediaLayoutWidget)
|
self.orderingUpButton = QtGui.QPushButton(self.backendOrderGroupBox)
|
||||||
self.orderingUpButton.setObjectName(u'orderingUpButton')
|
self.orderingUpButton.setObjectName(u'orderingUpButton')
|
||||||
self.orderingButtonLayout.addWidget(self.orderingUpButton)
|
self.orderingButtonLayout.addWidget(self.orderingUpButton)
|
||||||
self.mediaBackendLayout.addLayout(self.orderingButtonLayout)
|
self.backendOrderLayout.addWidget(self.orderingButtonsWidget)
|
||||||
|
self.leftLayout.addWidget(self.backendOrderGroupBox)
|
||||||
self.leftLayout.addWidget(self.mediaLayoutWidget)
|
|
||||||
self.leftLayout.addStretch()
|
self.leftLayout.addStretch()
|
||||||
self.rightLayout.addStretch()
|
self.rightLayout.addStretch()
|
||||||
QtCore.QObject.connect(self.usePhononCheckBox,
|
QtCore.QObject.connect(self.usePhononCheckBox,
|
||||||
@ -91,12 +98,14 @@ class MediaTab(SettingsTab):
|
|||||||
QtCore.SIGNAL(u'pressed()'), self.onOrderingDownButtonPressed)
|
QtCore.SIGNAL(u'pressed()'), self.onOrderingDownButtonPressed)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
|
self.mediaBackendsGroupBox.setTitle(
|
||||||
|
translate('MediaPlugin.MediaTab', 'Media Backends'))
|
||||||
self.usePhononCheckBox.setText(
|
self.usePhononCheckBox.setText(
|
||||||
translate('MediaPlugin.MediaTab', 'use Phonon'))
|
translate('MediaPlugin.MediaTab', 'use Phonon'))
|
||||||
self.useVlcCheckBox.setText(
|
self.useVlcCheckBox.setText(
|
||||||
translate('MediaPlugin.MediaTab', 'use Vlc'))
|
translate('MediaPlugin.MediaTab', 'use Vlc'))
|
||||||
self.backendOrderLabel.setText(
|
self.backendOrderGroupBox.setTitle(
|
||||||
translate('MediaPlugin.MediaTab', 'Backend Order'))
|
translate('MediaPlugin.MediaTab', 'Backends Order'))
|
||||||
self.orderingDownButton.setText(
|
self.orderingDownButton.setText(
|
||||||
translate('MediaPlugin.MediaTab', 'Down'))
|
translate('MediaPlugin.MediaTab', 'Down'))
|
||||||
self.orderingUpButton.setText(
|
self.orderingUpButton.setText(
|
||||||
@ -157,7 +166,7 @@ class MediaTab(SettingsTab):
|
|||||||
def save(self):
|
def save(self):
|
||||||
oldBackendString = QtCore.QSettings().value(
|
oldBackendString = QtCore.QSettings().value(
|
||||||
self.settingsSection + u'/backends',
|
self.settingsSection + u'/backends',
|
||||||
QtCore.QVariant(True)).toString()
|
QtCore.QVariant(u'Webkit')).toString()
|
||||||
newBackendString = self.usedBackends.join(u',')
|
newBackendString = self.usedBackends.join(u',')
|
||||||
if oldBackendString != newBackendString:
|
if oldBackendString != newBackendString:
|
||||||
QtCore.QSettings().setValue(self.settingsSection + u'/backends',
|
QtCore.QSettings().setValue(self.settingsSection + u'/backends',
|
||||||
|
@ -126,7 +126,7 @@ class PhononController(MediaController):
|
|||||||
u'video/x-wmv': [u'.wmv'],
|
u'video/x-wmv': [u'.wmv'],
|
||||||
u'video/x-ms-wmv': [u'.wmv']}
|
u'video/x-ms-wmv': [u'.wmv']}
|
||||||
|
|
||||||
def load(self, display, path, volume):
|
def load(self, display, path, volume, isBackground):
|
||||||
log.debug(u'load vid in Phonon Controller')
|
log.debug(u'load vid in Phonon Controller')
|
||||||
display.mediaObject.setCurrentSource(Phonon.MediaSource(path))
|
display.mediaObject.setCurrentSource(Phonon.MediaSource(path))
|
||||||
if not self.mediaStateWait(display, Phonon.StoppedState):
|
if not self.mediaStateWait(display, Phonon.StoppedState):
|
||||||
@ -185,14 +185,17 @@ class PhononController(MediaController):
|
|||||||
|
|
||||||
def update_ui(self, controller, display):
|
def update_ui(self, controller, display):
|
||||||
controller.seekSlider.setMaximum(display.mediaObject.totalTime())
|
controller.seekSlider.setMaximum(display.mediaObject.totalTime())
|
||||||
|
if display.serviceItem.end_time > 0:
|
||||||
|
if display.mediaObject.currentTime() > \
|
||||||
|
display.serviceItem.end_time:
|
||||||
|
self.stop(display)
|
||||||
|
if display.serviceItem.start_time > 0:
|
||||||
|
if display.mediaObject.currentTime() < \
|
||||||
|
display.serviceItem.start_time:
|
||||||
|
self.seek(display, self.serviceItem.start_time * 1000)
|
||||||
if not controller.seekSlider.isSliderDown():
|
if not controller.seekSlider.isSliderDown():
|
||||||
controller.seekSlider.setSliderPosition( \
|
controller.seekSlider.setSliderPosition( \
|
||||||
display.mediaObject.currentTime())
|
display.mediaObject.currentTime())
|
||||||
# if newState == Phonon.Playing \
|
|
||||||
# and oldState != Phonon.Paused \
|
|
||||||
# and self.serviceItem.start_time > 0:
|
|
||||||
# # set start time in milliseconds
|
|
||||||
# self.mediaObject.seek(self.serviceItem.start_time * 1000)
|
|
||||||
|
|
||||||
def get_supported_file_types(self):
|
def get_supported_file_types(self):
|
||||||
pass
|
pass
|
||||||
|
@ -121,7 +121,7 @@ class VlcController(MediaController):
|
|||||||
u'video/x-wmv': [u'.wmv'],
|
u'video/x-wmv': [u'.wmv'],
|
||||||
u'video/x-ms-wmv': [u'.wmv']}
|
u'video/x-ms-wmv': [u'.wmv']}
|
||||||
|
|
||||||
def load(self, display, path, volume):
|
def load(self, display, path, volume, isBackground):
|
||||||
log.debug(u'load vid in Vlc Controller')
|
log.debug(u'load vid in Vlc Controller')
|
||||||
vol = float(volume) / float(10)
|
vol = float(volume) / float(10)
|
||||||
# create the media
|
# create the media
|
||||||
|
@ -65,7 +65,7 @@ class WebkitController(MediaController):
|
|||||||
, u'*.ogg'
|
, u'*.ogg'
|
||||||
, u'*.ogv'
|
, u'*.ogv'
|
||||||
, u'*.webm'
|
, u'*.webm'
|
||||||
, u'*.swf', u'*.mpg', u'*.wmv'
|
, u'*.swf', u'*.mpg', u'*.wmv', u'*.mpeg', u'*.avi'
|
||||||
]
|
]
|
||||||
|
|
||||||
def setup(self, display, hasAudio):
|
def setup(self, display, hasAudio):
|
||||||
@ -79,17 +79,21 @@ class WebkitController(MediaController):
|
|||||||
def get_supported_file_types(self):
|
def get_supported_file_types(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def load(self, display, path, volume):
|
def load(self, display, path, volume, isBackground):
|
||||||
log.debug(u'load vid in Webkit Controller')
|
log.debug(u'load vid in Webkit Controller')
|
||||||
vol = float(volume) / float(10)
|
vol = float(volume) / float(10)
|
||||||
|
if isBackground:
|
||||||
|
loop = u'true'
|
||||||
|
else:
|
||||||
|
loop = u'false'
|
||||||
display.webView.setVisible(True)
|
display.webView.setVisible(True)
|
||||||
if path.endswith(u'.swf'):
|
if path.endswith(u'.swf'):
|
||||||
js = u'show_flash("load","%s");' % \
|
js = u'show_flash("load","%s");' % \
|
||||||
(path.replace(u'\\', u'\\\\'))
|
(path.replace(u'\\', u'\\\\'))
|
||||||
self.isFlash = True
|
self.isFlash = True
|
||||||
else:
|
else:
|
||||||
js = u'show_video("init", "%s", %s, false);' % \
|
js = u'show_video("init", "%s", %s, %s);' % \
|
||||||
(path.replace(u'\\', u'\\\\'), str(vol))
|
(path.replace(u'\\', u'\\\\'), str(vol), loop)
|
||||||
self.isFlash = False
|
self.isFlash = False
|
||||||
display.frame.evaluateJavaScript(js)
|
display.frame.evaluateJavaScript(js)
|
||||||
return True
|
return True
|
||||||
@ -99,6 +103,9 @@ class WebkitController(MediaController):
|
|||||||
display.webView.resize(display.size())
|
display.webView.resize(display.size())
|
||||||
|
|
||||||
def play(self, display):
|
def play(self, display):
|
||||||
|
display.override[u'theme'] = u''
|
||||||
|
display.override[u'video'] = True
|
||||||
|
display.webLoaded = True
|
||||||
self.set_visible(display, True)
|
self.set_visible(display, True)
|
||||||
if self.isFlash:
|
if self.isFlash:
|
||||||
display.frame.evaluateJavaScript(u'show_flash("play","");')
|
display.frame.evaluateJavaScript(u'show_flash("play","");')
|
||||||
|
Loading…
Reference in New Issue
Block a user