forked from openlp/openlp
Rename the video plugin to media
This commit is contained in:
parent
93a175a50e
commit
d59f80d819
@ -19,7 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from filelistdata import FileListData
|
from filelistdata import FileListData
|
||||||
from videotab import VideoTab
|
from mediatab import MediaTab
|
||||||
from mediaitem import VideoMediaItem
|
from mediaitem import MediaMediaItem
|
||||||
|
|
||||||
__all__ = ['VideoTab', 'VideoMediaItem', 'FileListData']
|
__all__ = ['MediaTab', 'MediaMediaItem', 'FileListData']
|
135
openlp/plugins/media/lib/mediaitem.py
Normal file
135
openlp/plugins/media/lib/mediaitem.py
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
|
"""
|
||||||
|
OpenLP - Open Source Lyrics Projection
|
||||||
|
Copyright (c) 2008 Raoul Snyman
|
||||||
|
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
|
||||||
|
|
||||||
|
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
|
||||||
|
import os
|
||||||
|
|
||||||
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
|
from openlp.core import translate
|
||||||
|
from openlp.core.lib import MediaManagerItem
|
||||||
|
|
||||||
|
from openlp.plugins.media.lib import MediaTab
|
||||||
|
from openlp.plugins.media.lib import FileListData
|
||||||
|
|
||||||
|
class MediaMediaItem(MediaManagerItem):
|
||||||
|
"""
|
||||||
|
This is the custom media manager item for Custom Slides.
|
||||||
|
"""
|
||||||
|
global log
|
||||||
|
log=logging.getLogger(u'MediaMediaItem')
|
||||||
|
log.info(u'Media Media Item loaded')
|
||||||
|
|
||||||
|
def __init__(self, parent, icon, title):
|
||||||
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
|
|
||||||
|
def setupUi(self):
|
||||||
|
# Add a toolbar
|
||||||
|
self.addToolbar()
|
||||||
|
# Create buttons for the toolbar
|
||||||
|
## New Media Button ##
|
||||||
|
self.addToolbarButton(
|
||||||
|
translate('MediaMediaItem',u'New Media'),
|
||||||
|
translate('MediaMediaItem',u'Load Media into openlp.org'),
|
||||||
|
':/videos/video_load.png', self.onMediaNewClick, 'MediaNewItem')
|
||||||
|
## Delete Media Button ##
|
||||||
|
self.addToolbarButton(
|
||||||
|
translate('MediaMediaItem',u'Delete Media'),
|
||||||
|
translate('MediaMediaItem',u'Delete the selected Media item'),
|
||||||
|
':/videos/video_delete.png', self.onMediaDeleteClick, 'MediaDeleteItem')
|
||||||
|
## Separator Line ##
|
||||||
|
self.addToolbarSeparator()
|
||||||
|
## Preview Media Button ##
|
||||||
|
self.addToolbarButton(
|
||||||
|
translate('MediaMediaItem',u'Preview Media'),
|
||||||
|
translate('MediaMediaItem',u'Preview the selected Media item'),
|
||||||
|
':/system/system_preview.png', self.onMediaPreviewClick, 'MediaPreviewItem')
|
||||||
|
## Live Media Button ##
|
||||||
|
self.addToolbarButton(
|
||||||
|
translate('MediaMediaItem',u'Go Live'),
|
||||||
|
translate('MediaMediaItem',u'Send the selected Media item live'),
|
||||||
|
':/system/system_live.png', self.onMediaLiveClick, 'MediaLiveItem')
|
||||||
|
## Add Media Button ##
|
||||||
|
self.addToolbarButton(
|
||||||
|
translate('MediaMediaItem',u'Add Media To Service'),
|
||||||
|
translate('MediaMediaItem',u'Add the selected Media items(s) to the service'),
|
||||||
|
':/system/system_add.png',self.onMediaAddClick, 'MediaAddItem')
|
||||||
|
## Add the Medialist widget ##
|
||||||
|
|
||||||
|
self.MediaListView = QtGui.QListView()
|
||||||
|
self.MediaListView.setAlternatingRowColors(True)
|
||||||
|
self.MediaListData = FileListData()
|
||||||
|
self.MediaListView.setModel(self.MediaListData)
|
||||||
|
|
||||||
|
self.PageLayout.addWidget(self.MediaListView)
|
||||||
|
|
||||||
|
#define and add the context menu
|
||||||
|
self.MediaListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
|
|
||||||
|
self.MediaListView.addAction(self.contextMenuAction(
|
||||||
|
self.MediaListView, ':/system/system_preview.png',
|
||||||
|
translate('MediaMediaItem',u'&Preview Media'), self.onMediaPreviewClick))
|
||||||
|
self.MediaListView.addAction(self.contextMenuAction(
|
||||||
|
self.MediaListView, ':/system/system_live.png',
|
||||||
|
translate('MediaMediaItem',u'&Show Live'), self.onMediaLiveClick))
|
||||||
|
self.MediaListView.addAction(self.contextMenuAction(
|
||||||
|
self.MediaListView, ':/system/system_add.png',
|
||||||
|
translate('MediaMediaItem',u'&Add to Service'), self.onMediaAddClick))
|
||||||
|
|
||||||
|
def initialise(self):
|
||||||
|
list = self.parent.config.load_list(u'Medias')
|
||||||
|
self.loadMediaList(list)
|
||||||
|
|
||||||
|
def onMediaNewClick(self):
|
||||||
|
files = QtGui.QFileDialog.getOpenFileNames(None,
|
||||||
|
translate('MediaMediaItem', u'Select Media(s) items'),
|
||||||
|
self.parent.config.get_last_dir(), u'Images (*.avi *.mpeg)')
|
||||||
|
if len(files) > 0:
|
||||||
|
self.loadMediaList(files)
|
||||||
|
dir, filename = os.path.split(str(files[0]))
|
||||||
|
self.parent.config.set_last_dir(dir)
|
||||||
|
self.parent.config.set_list(u'media', self.MediaListData.getFileList())
|
||||||
|
|
||||||
|
def getFileList(self):
|
||||||
|
filelist = [item[0] for item in self.MediaListView];
|
||||||
|
return filelist
|
||||||
|
|
||||||
|
def loadMediaList(self, list):
|
||||||
|
for files in list:
|
||||||
|
self.MediaListData.addRow(files)
|
||||||
|
|
||||||
|
def onMediaDeleteClick(self):
|
||||||
|
indexes = self.MediaListView.selectedIndexes()
|
||||||
|
for index in indexes:
|
||||||
|
current_row = int(index.row())
|
||||||
|
self.MediaListData.removeRow(current_row)
|
||||||
|
self.parent.config.set_list(u'media', self.MediaListData.getFileList())
|
||||||
|
|
||||||
|
def onMediaPreviewClick(self):
|
||||||
|
log.debug(u'Media Preview Button pressed')
|
||||||
|
items = self.MediaListView.selectedIndexes()
|
||||||
|
for item in items:
|
||||||
|
text = self.MediaListData.getValue(item)
|
||||||
|
print text
|
||||||
|
|
||||||
|
def onMediaLiveClick(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onMediaAddClick(self):
|
||||||
|
pass
|
@ -24,39 +24,39 @@ from openlp.core import translate
|
|||||||
from openlp import convertStringToBoolean
|
from openlp import convertStringToBoolean
|
||||||
from openlp.core.lib import SettingsTab
|
from openlp.core.lib import SettingsTab
|
||||||
|
|
||||||
class VideoTab(SettingsTab):
|
class MediaTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
VideoTab is the video settings tab in the settings dialog.
|
mediaTab is the media settings tab in the settings dialog.
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
SettingsTab.__init__(self, u'Videos')
|
SettingsTab.__init__(self, u'Media')
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.setObjectName(u'VideoTab')
|
self.setObjectName(u'MediaTab')
|
||||||
|
|
||||||
self.VideoLayout = QtGui.QFormLayout(self)
|
self.MediaLayout = QtGui.QFormLayout(self)
|
||||||
self.VideoLayout.setObjectName("VideoLayout")
|
self.MediaLayout.setObjectName("MediaLayout")
|
||||||
|
|
||||||
self.VideoModeGroupBox = QtGui.QGroupBox(self)
|
self.MediaModeGroupBox = QtGui.QGroupBox(self)
|
||||||
self.VideoModeGroupBox.setObjectName("VideoModeGroupBox")
|
self.MediaModeGroupBox.setObjectName("MediaModeGroupBox")
|
||||||
self.VideoModeLayout = QtGui.QVBoxLayout(self.VideoModeGroupBox)
|
self.MediaModeLayout = QtGui.QVBoxLayout(self.MediaModeGroupBox)
|
||||||
self.VideoModeLayout.setSpacing(8)
|
self.MediaModeLayout.setSpacing(8)
|
||||||
self.VideoModeLayout.setMargin(8)
|
self.MediaModeLayout.setMargin(8)
|
||||||
self.VideoModeLayout.setObjectName("VideoModeLayout")
|
self.MediaModeLayout.setObjectName("MediaModeLayout")
|
||||||
self.UseVMRCheckBox = QtGui.QCheckBox(self.VideoModeGroupBox)
|
self.UseVMRCheckBox = QtGui.QCheckBox(self.MediaModeGroupBox)
|
||||||
self.UseVMRCheckBox.setObjectName("UseVMRCheckBox")
|
self.UseVMRCheckBox.setObjectName("UseVMRCheckBox")
|
||||||
self.VideoModeLayout.addWidget(self.UseVMRCheckBox)
|
self.MediaModeLayout.addWidget(self.UseVMRCheckBox)
|
||||||
self.UseVMRLabel = QtGui.QLabel(self.VideoModeGroupBox)
|
self.UseVMRLabel = QtGui.QLabel(self.MediaModeGroupBox)
|
||||||
self.UseVMRLabel.setObjectName("UseVMRLabel")
|
self.UseVMRLabel.setObjectName("UseVMRLabel")
|
||||||
self.VideoModeLayout.addWidget(self.UseVMRLabel)
|
self.MediaModeLayout.addWidget(self.UseVMRLabel)
|
||||||
|
|
||||||
self.VideoLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.VideoModeGroupBox)
|
self.MediaLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.MediaModeGroupBox)
|
||||||
# Signals and slots
|
# Signals and slots
|
||||||
QtCore.QObject.connect(self.UseVMRCheckBox,
|
QtCore.QObject.connect(self.UseVMRCheckBox,
|
||||||
QtCore.SIGNAL("stateChanged(int)"), self.onVMRCheckBoxChanged)
|
QtCore.SIGNAL("stateChanged(int)"), self.onVMRCheckBoxChanged)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.VideoModeGroupBox.setTitle(translate("SettingsForm", "Video Mode"))
|
self.MediaModeGroupBox.setTitle(translate("SettingsForm", "Media Mode"))
|
||||||
self.UseVMRCheckBox.setText(translate("SettingsForm", "Use Video Mode Rendering"))
|
self.UseVMRCheckBox.setText(translate("SettingsForm", "Use Video Mode Rendering"))
|
||||||
self.UseVMRLabel.setText(translate("SettingsForm", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
self.UseVMRLabel.setText(translate("SettingsForm", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
@ -22,13 +22,13 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.resources import *
|
from openlp.core.resources import *
|
||||||
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab
|
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab
|
||||||
from openlp.plugins.videos.lib import VideoTab, VideoMediaItem
|
from openlp.plugins.media.lib import MediaTab,MediaMediaItem
|
||||||
|
|
||||||
class VideoPlugin(Plugin):
|
class MediaPlugin(Plugin):
|
||||||
|
|
||||||
def __init__(self, plugin_helpers):
|
def __init__(self, plugin_helpers):
|
||||||
# Call the parent constructor
|
# Call the parent constructor
|
||||||
Plugin.__init__(self, u'Videos', u'1.9.0', plugin_helpers)
|
Plugin.__init__(self, u'Media', u'1.9.0', plugin_helpers)
|
||||||
self.weight = -6
|
self.weight = -6
|
||||||
# Create the plugin icon
|
# Create the plugin icon
|
||||||
self.icon = QtGui.QIcon()
|
self.icon = QtGui.QIcon()
|
||||||
@ -36,11 +36,11 @@ class VideoPlugin(Plugin):
|
|||||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
|
||||||
def get_settings_tab(self):
|
def get_settings_tab(self):
|
||||||
self.VideosTab = VideoTab()
|
self.MediaTab = MediaTab()
|
||||||
return self.VideosTab
|
return self.MediaTab
|
||||||
|
|
||||||
def get_media_manager_item(self):
|
def get_media_manager_item(self):
|
||||||
# Create the MediaManagerItem object
|
# Create the MediaManagerItem object
|
||||||
self.media_item = VideoMediaItem(self, self.icon, u'Videos')
|
self.media_item = MediaMediaItem(self, self.icon, u'Media')
|
||||||
return self.media_item
|
return self.media_item
|
||||||
|
|
@ -1,135 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
||||||
"""
|
|
||||||
OpenLP - Open Source Lyrics Projection
|
|
||||||
Copyright (c) 2008 Raoul Snyman
|
|
||||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
|
|
||||||
|
|
||||||
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
|
|
||||||
import os
|
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
|
|
||||||
from openlp.core import translate
|
|
||||||
from openlp.core.lib import MediaManagerItem
|
|
||||||
|
|
||||||
from openlp.plugins.videos.lib import VideoTab
|
|
||||||
from openlp.plugins.videos.lib import FileListData
|
|
||||||
|
|
||||||
class VideoMediaItem(MediaManagerItem):
|
|
||||||
"""
|
|
||||||
This is the custom media manager item for Custom Slides.
|
|
||||||
"""
|
|
||||||
global log
|
|
||||||
log=logging.getLogger(u'VideoMediaItem')
|
|
||||||
log.info(u'Video Media Item loaded')
|
|
||||||
|
|
||||||
def __init__(self, parent, icon, title):
|
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
|
||||||
|
|
||||||
def setupUi(self):
|
|
||||||
# Add a toolbar
|
|
||||||
self.addToolbar()
|
|
||||||
# Create buttons for the toolbar
|
|
||||||
## New Video Button ##
|
|
||||||
self.addToolbarButton(
|
|
||||||
translate('VideoMediaItem',u'New Video'),
|
|
||||||
translate('VideoMediaItem',u'Load videos into openlp.org'),
|
|
||||||
':/videos/video_load.png', self.onVideoNewClick, 'VideoNewItem')
|
|
||||||
## Delete Video Button ##
|
|
||||||
self.addToolbarButton(
|
|
||||||
translate('VideoMediaItem',u'Delete Video'),
|
|
||||||
translate('VideoMediaItem',u'Delete the selected video'),
|
|
||||||
':/videos/video_delete.png', self.onVideoDeleteClick, 'VideoDeleteItem')
|
|
||||||
## Separator Line ##
|
|
||||||
self.addToolbarSeparator()
|
|
||||||
## Preview Video Button ##
|
|
||||||
self.addToolbarButton(
|
|
||||||
translate('VideoMediaItem',u'Preview Video'),
|
|
||||||
translate('VideoMediaItem',u'Preview the selected video'),
|
|
||||||
':/system/system_preview.png', self.onVideoPreviewClick, 'VideoPreviewItem')
|
|
||||||
## Live Video Button ##
|
|
||||||
self.addToolbarButton(
|
|
||||||
translate('VideoMediaItem',u'Go Live'),
|
|
||||||
translate('VideoMediaItem',u'Send the selected video live'),
|
|
||||||
':/system/system_live.png', self.onVideoLiveClick, 'VideoLiveItem')
|
|
||||||
## Add Video Button ##
|
|
||||||
self.addToolbarButton(
|
|
||||||
translate('VideoMediaItem',u'Add Video To Service'),
|
|
||||||
translate('VideoMediaItem',u'Add the selected video(s) to the service'),
|
|
||||||
':/system/system_add.png',self.onVideoAddClick, 'VideoAddItem')
|
|
||||||
## Add the videolist widget ##
|
|
||||||
|
|
||||||
self.VideoListView = QtGui.QListView()
|
|
||||||
self.VideoListView.setAlternatingRowColors(True)
|
|
||||||
self.VideoListData = FileListData()
|
|
||||||
self.VideoListView.setModel(self.VideoListData)
|
|
||||||
|
|
||||||
self.PageLayout.addWidget(self.VideoListView)
|
|
||||||
|
|
||||||
#define and add the context menu
|
|
||||||
self.VideoListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
|
||||||
|
|
||||||
self.VideoListView.addAction(self.contextMenuAction(
|
|
||||||
self.VideoListView, ':/system/system_preview.png',
|
|
||||||
translate('VideoMediaItem',u'&Preview Video'), self.onVideoPreviewClick))
|
|
||||||
self.VideoListView.addAction(self.contextMenuAction(
|
|
||||||
self.VideoListView, ':/system/system_live.png',
|
|
||||||
translate('VideoMediaItem',u'&Show Live'), self.onVideoLiveClick))
|
|
||||||
self.VideoListView.addAction(self.contextMenuAction(
|
|
||||||
self.VideoListView, ':/system/system_add.png',
|
|
||||||
translate('VideoMediaItem',u'&Add to Service'), self.onVideoAddClick))
|
|
||||||
|
|
||||||
def initialise(self):
|
|
||||||
list = self.parent.config.load_list(u'videos')
|
|
||||||
self.loadVideoList(list)
|
|
||||||
|
|
||||||
def onVideoNewClick(self):
|
|
||||||
files = QtGui.QFileDialog.getOpenFileNames(None,
|
|
||||||
translate('VideoMediaItem', u'Select Video(s)'),
|
|
||||||
self.parent.config.get_last_dir(), u'Images (*.avi *.mpeg)')
|
|
||||||
if len(files) > 0:
|
|
||||||
self.loadVideoList(files)
|
|
||||||
dir, filename = os.path.split(str(files[0]))
|
|
||||||
self.parent.config.set_last_dir(dir)
|
|
||||||
self.parent.config.set_list(u'videos', self.VideoListData.getFileList())
|
|
||||||
|
|
||||||
def getFileList(self):
|
|
||||||
filelist = [item[0] for item in self.VideoListView];
|
|
||||||
return filelist
|
|
||||||
|
|
||||||
def loadVideoList(self, list):
|
|
||||||
for files in list:
|
|
||||||
self.VideoListData.addRow(files)
|
|
||||||
|
|
||||||
def onVideoDeleteClick(self):
|
|
||||||
indexes = self.VideoListView.selectedIndexes()
|
|
||||||
for index in indexes:
|
|
||||||
current_row = int(index.row())
|
|
||||||
self.VideoListData.removeRow(current_row)
|
|
||||||
self.parent.config.set_list(u'videos', self.VideoListData.getFileList())
|
|
||||||
|
|
||||||
def onVideoPreviewClick(self):
|
|
||||||
log.debug(u'Video Preview Button pressed')
|
|
||||||
items = self.VideoListView.selectedIndexes()
|
|
||||||
for item in items:
|
|
||||||
text = self.VideoListData.getValue(item)
|
|
||||||
print text
|
|
||||||
|
|
||||||
def onVideoLiveClick(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def onVideoAddClick(self):
|
|
||||||
pass
|
|
Loading…
Reference in New Issue
Block a user