Rename the video plugin to media

This commit is contained in:
Tim Bentley 2009-05-15 06:15:53 +01:00
parent 93a175a50e
commit d59f80d819
7 changed files with 164 additions and 164 deletions

View File

@ -19,7 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
"""
from filelistdata import FileListData
from videotab import VideoTab
from mediaitem import VideoMediaItem
from mediatab import MediaTab
from mediaitem import MediaMediaItem
__all__ = ['VideoTab', 'VideoMediaItem', 'FileListData']
__all__ = ['MediaTab', 'MediaMediaItem', 'FileListData']

View 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

View File

@ -24,39 +24,39 @@ from openlp.core import translate
from openlp import convertStringToBoolean
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):
SettingsTab.__init__(self, u'Videos')
SettingsTab.__init__(self, u'Media')
def setupUi(self):
self.setObjectName(u'VideoTab')
self.setObjectName(u'MediaTab')
self.VideoLayout = QtGui.QFormLayout(self)
self.VideoLayout.setObjectName("VideoLayout")
self.MediaLayout = QtGui.QFormLayout(self)
self.MediaLayout.setObjectName("MediaLayout")
self.VideoModeGroupBox = QtGui.QGroupBox(self)
self.VideoModeGroupBox.setObjectName("VideoModeGroupBox")
self.VideoModeLayout = QtGui.QVBoxLayout(self.VideoModeGroupBox)
self.VideoModeLayout.setSpacing(8)
self.VideoModeLayout.setMargin(8)
self.VideoModeLayout.setObjectName("VideoModeLayout")
self.UseVMRCheckBox = QtGui.QCheckBox(self.VideoModeGroupBox)
self.MediaModeGroupBox = QtGui.QGroupBox(self)
self.MediaModeGroupBox.setObjectName("MediaModeGroupBox")
self.MediaModeLayout = QtGui.QVBoxLayout(self.MediaModeGroupBox)
self.MediaModeLayout.setSpacing(8)
self.MediaModeLayout.setMargin(8)
self.MediaModeLayout.setObjectName("MediaModeLayout")
self.UseVMRCheckBox = QtGui.QCheckBox(self.MediaModeGroupBox)
self.UseVMRCheckBox.setObjectName("UseVMRCheckBox")
self.VideoModeLayout.addWidget(self.UseVMRCheckBox)
self.UseVMRLabel = QtGui.QLabel(self.VideoModeGroupBox)
self.MediaModeLayout.addWidget(self.UseVMRCheckBox)
self.UseVMRLabel = QtGui.QLabel(self.MediaModeGroupBox)
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
QtCore.QObject.connect(self.UseVMRCheckBox,
QtCore.SIGNAL("stateChanged(int)"), self.onVMRCheckBoxChanged)
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.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"

View File

@ -22,13 +22,13 @@ from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
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):
# 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
# Create the plugin icon
self.icon = QtGui.QIcon()
@ -36,11 +36,11 @@ class VideoPlugin(Plugin):
QtGui.QIcon.Normal, QtGui.QIcon.Off)
def get_settings_tab(self):
self.VideosTab = VideoTab()
return self.VideosTab
self.MediaTab = MediaTab()
return self.MediaTab
def get_media_manager_item(self):
# Create the MediaManagerItem object
self.media_item = VideoMediaItem(self, self.icon, u'Videos')
return self.media_item
self.media_item = MediaMediaItem(self, self.icon, u'Media')
return self.media_item

View File

@ -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