|
|
|
@ -21,8 +21,15 @@ import logging
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
from PyQt4 import QtCore, QtGui
|
|
|
|
|
from openlp.core.lib import MediaManagerItem, translate
|
|
|
|
|
from openlp.plugins.presentations.lib import FileListData
|
|
|
|
|
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD
|
|
|
|
|
|
|
|
|
|
# We have to explicitly create separate classes for each plugin
|
|
|
|
|
# in order for DnD to the Service manager to work correctly.
|
|
|
|
|
class PresentationListView(BaseListWithDnD):
|
|
|
|
|
def __init__(self, parent=None):
|
|
|
|
|
self.PluginName = u'Presentation'
|
|
|
|
|
BaseListWithDnD.__init__(self, parent)
|
|
|
|
|
|
|
|
|
|
class PresentationMediaItem(MediaManagerItem):
|
|
|
|
|
"""
|
|
|
|
@ -33,88 +40,96 @@ class PresentationMediaItem(MediaManagerItem):
|
|
|
|
|
log.info(u'Presentations Media Item loaded')
|
|
|
|
|
|
|
|
|
|
def __init__(self, parent, icon, title):
|
|
|
|
|
self.TranslationContext = u'PresentationPlugin'
|
|
|
|
|
self.PluginTextShort = u'Presentation'
|
|
|
|
|
self.ConfigSection = u'presentation'
|
|
|
|
|
self.OnNewPrompt = u'Select Image(s)'
|
|
|
|
|
self.OnNewFileMasks = u'Images (*.ppt *.pps *.odp)'
|
|
|
|
|
# this next is a class, not an instance of a class - it will
|
|
|
|
|
# be instanced by the base MediaManagerItem
|
|
|
|
|
self.ListViewWithDnD_class = PresentationListView
|
|
|
|
|
MediaManagerItem.__init__(self, parent, icon, title)
|
|
|
|
|
|
|
|
|
|
def setupUi(self):
|
|
|
|
|
# Add a toolbar
|
|
|
|
|
self.addToolbar()
|
|
|
|
|
# Create buttons for the toolbar
|
|
|
|
|
## New Presentation Button ##
|
|
|
|
|
self.addToolbarButton(
|
|
|
|
|
translate(u'PresentationsMediaItem',u'New presentations'),
|
|
|
|
|
translate(u'PresentationsMediaItem',u'Load presentations into openlp.org'),
|
|
|
|
|
':/presentations/presentation_load.png', self.onPresentationNewClick, 'PresentationNewItem')
|
|
|
|
|
## Delete Presentation Button ##
|
|
|
|
|
self.addToolbarButton(
|
|
|
|
|
translate(u'PresentationsMediaItem',u'Delete Presentation'),
|
|
|
|
|
translate(u'PresentationsMediaItem',u'Delete the selected presentation'),
|
|
|
|
|
':/presentations/presentation_delete.png', self.onPresentationDeleteClick, 'PresentationDeleteItem')
|
|
|
|
|
## Separator Line ##
|
|
|
|
|
self.addToolbarSeparator()
|
|
|
|
|
## Preview Presentation Button ##
|
|
|
|
|
self.addToolbarButton(
|
|
|
|
|
translate(u'PresentationsMediaItem',u'Preview Presentation'),
|
|
|
|
|
translate(u'PresentationsMediaItem',u'Preview the selected Presentation'),
|
|
|
|
|
':/system/system_preview.png', self.onPresentationPreviewClick, 'PresentationPreviewItem')
|
|
|
|
|
## Live Presentation Button ##
|
|
|
|
|
self.addToolbarButton(
|
|
|
|
|
translate(u'PresentationsMediaItem',u'Go Live'),
|
|
|
|
|
translate(u'PresentationsMediaItem',u'Send the selected presentation live'),
|
|
|
|
|
':/system/system_live.png', self.onPresentationLiveClick, 'PresentationLiveItem')
|
|
|
|
|
## Add Presentation Button ##
|
|
|
|
|
self.addToolbarButton(
|
|
|
|
|
translate(u'PresentationsMediaItem',u'Add Presentation To Service'),
|
|
|
|
|
translate(u'PresentationsMediaItem',u'Add the selected Presentations(s) to the service'),
|
|
|
|
|
':/system/system_add.png',self.onPresentationAddClick, 'PresentationsAddItem')
|
|
|
|
|
## Add the Presentationlist widget ##
|
|
|
|
|
|
|
|
|
|
self.PresentationWidget = QtGui.QWidget(self)
|
|
|
|
|
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
|
|
|
|
sizePolicy.setHorizontalStretch(0)
|
|
|
|
|
sizePolicy.setVerticalStretch(0)
|
|
|
|
|
sizePolicy.setHeightForWidth(self.PresentationWidget.sizePolicy().hasHeightForWidth())
|
|
|
|
|
self.PresentationWidget.setSizePolicy(sizePolicy)
|
|
|
|
|
self.PresentationWidget.setObjectName(u'PresentationWidget')
|
|
|
|
|
self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget)
|
|
|
|
|
self.DisplayLayout.setObjectName(u'DisplayLayout')
|
|
|
|
|
self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget)
|
|
|
|
|
self.DisplayTypeComboBox.setObjectName(u'DisplayTypeComboBox')
|
|
|
|
|
self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2)
|
|
|
|
|
self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
|
|
|
|
|
self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
|
|
|
|
|
self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
|
|
|
|
|
|
|
|
|
|
self.DisplayTypeLabel.setText(translate(u'PresentationMediaItem', u'Present using:'))
|
|
|
|
|
|
|
|
|
|
# Add the song widget to the page layout
|
|
|
|
|
self.PageLayout.addWidget(self.PresentationWidget)
|
|
|
|
|
|
|
|
|
|
self.PresentationsListView = QtGui.QListView()
|
|
|
|
|
self.PresentationsListView.setAlternatingRowColors(True)
|
|
|
|
|
self.PresentationsListData = FileListData()
|
|
|
|
|
self.PresentationsListView.setModel(self.PresentationsListData)
|
|
|
|
|
|
|
|
|
|
self.PageLayout.addWidget(self.PresentationsListView)
|
|
|
|
|
|
|
|
|
|
#define and add the context menu
|
|
|
|
|
self.PresentationsListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
|
|
|
|
|
|
|
|
|
self.PresentationsListView.addAction(self.contextMenuAction(
|
|
|
|
|
self.PresentationsListView, ':/system/system_preview.png',
|
|
|
|
|
translate(u'PresentationsMediaItem',u'&Preview presentations'), self.onPresentationPreviewClick))
|
|
|
|
|
self.PresentationsListView.addAction(self.contextMenuAction(
|
|
|
|
|
self.PresentationsListView, ':/system/system_live.png',
|
|
|
|
|
translate(u'PresentationsMediaItem',u'&Show Live'), self.onPresentationLiveClick))
|
|
|
|
|
self.PresentationsListView.addAction(self.contextMenuAction(
|
|
|
|
|
self.PresentationsListView, ':/system/system_add.png',
|
|
|
|
|
translate(u'PresentationsMediaItem',u'&Add to Service'), self.onPresentationAddClick))
|
|
|
|
|
# def setupUi(self):
|
|
|
|
|
# # Add a toolbar
|
|
|
|
|
# self.addToolbar()
|
|
|
|
|
# # Create buttons for the toolbar
|
|
|
|
|
# ## New Presentation Button ##
|
|
|
|
|
# self.addToolbarButton(
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'New presentations'),
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'Load presentations into openlp.org'),
|
|
|
|
|
# ':/presentations/presentation_load.png', self.onPresentationNewClick, 'PresentationNewItem')
|
|
|
|
|
# ## Delete Presentation Button ##
|
|
|
|
|
# self.addToolbarButton(
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'Delete Presentation'),
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'Delete the selected presentation'),
|
|
|
|
|
# ':/presentations/presentation_delete.png', self.onPresentationDeleteClick, 'PresentationDeleteItem')
|
|
|
|
|
# ## Separator Line ##
|
|
|
|
|
# self.addToolbarSeparator()
|
|
|
|
|
# ## Preview Presentation Button ##
|
|
|
|
|
# self.addToolbarButton(
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'Preview Presentation'),
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'Preview the selected Presentation'),
|
|
|
|
|
# ':/system/system_preview.png', self.onPresentationPreviewClick, 'PresentationPreviewItem')
|
|
|
|
|
# ## Live Presentation Button ##
|
|
|
|
|
# self.addToolbarButton(
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'Go Live'),
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'Send the selected presentation live'),
|
|
|
|
|
# ':/system/system_live.png', self.onPresentationLiveClick, 'PresentationLiveItem')
|
|
|
|
|
# ## Add Presentation Button ##
|
|
|
|
|
# self.addToolbarButton(
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'Add Presentation To Service'),
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'Add the selected Presentations(s) to the service'),
|
|
|
|
|
# ':/system/system_add.png',self.onPresentationAddClick, 'PresentationsAddItem')
|
|
|
|
|
# ## Add the Presentationlist widget ##
|
|
|
|
|
#
|
|
|
|
|
# self.PresentationWidget = QtGui.QWidget(self)
|
|
|
|
|
# sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
|
|
|
|
# sizePolicy.setHorizontalStretch(0)
|
|
|
|
|
# sizePolicy.setVerticalStretch(0)
|
|
|
|
|
# sizePolicy.setHeightForWidth(self.PresentationWidget.sizePolicy().hasHeightForWidth())
|
|
|
|
|
# self.PresentationWidget.setSizePolicy(sizePolicy)
|
|
|
|
|
# self.PresentationWidget.setObjectName(u'PresentationWidget')
|
|
|
|
|
# self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget)
|
|
|
|
|
# self.DisplayLayout.setObjectName(u'DisplayLayout')
|
|
|
|
|
# self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget)
|
|
|
|
|
# self.DisplayTypeComboBox.setObjectName(u'DisplayTypeComboBox')
|
|
|
|
|
# self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2)
|
|
|
|
|
# self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
|
|
|
|
|
# self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
|
|
|
|
|
# self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
|
|
|
|
|
#
|
|
|
|
|
# self.DisplayTypeLabel.setText(translate(u'PresentationMediaItem', u'Present using:'))
|
|
|
|
|
#
|
|
|
|
|
# # Add the song widget to the page layout
|
|
|
|
|
# self.PageLayout.addWidget(self.PresentationWidget)
|
|
|
|
|
#
|
|
|
|
|
# self.PresentationsListView = QtGui.QListView()
|
|
|
|
|
# self.PresentationsListView.setAlternatingRowColors(True)
|
|
|
|
|
# self.PresentationsListData = FileListData()
|
|
|
|
|
# self.PresentationsListView.setModel(self.PresentationsListData)
|
|
|
|
|
#
|
|
|
|
|
# self.PageLayout.addWidget(self.PresentationsListView)
|
|
|
|
|
#
|
|
|
|
|
# #define and add the context menu
|
|
|
|
|
# self.PresentationsListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
|
|
|
|
#
|
|
|
|
|
# self.PresentationsListView.addAction(self.contextMenuAction(
|
|
|
|
|
# self.PresentationsListView, ':/system/system_preview.png',
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'&Preview presentations'), self.onPresentationPreviewClick))
|
|
|
|
|
# self.PresentationsListView.addAction(self.contextMenuAction(
|
|
|
|
|
# self.PresentationsListView, ':/system/system_live.png',
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'&Show Live'), self.onPresentationLiveClick))
|
|
|
|
|
# self.PresentationsListView.addAction(self.contextMenuAction(
|
|
|
|
|
# self.PresentationsListView, ':/system/system_add.png',
|
|
|
|
|
# translate(u'PresentationsMediaItem',u'&Add to Service'), self.onPresentationAddClick))
|
|
|
|
|
|
|
|
|
|
def initialise(self):
|
|
|
|
|
list = self.parent.config.load_list(u'presentations')
|
|
|
|
|
self.loadPresentationList(list)
|
|
|
|
|
self.DisplayTypeComboBox.addItem(u'Impress')
|
|
|
|
|
self.DisplayTypeComboBox.addItem(u'Powerpoint')
|
|
|
|
|
self.DisplayTypeComboBox.addItem(u'Keynote')
|
|
|
|
|
# self.DisplayTypeComboBox.addItem(u'Impress')
|
|
|
|
|
# self.DisplayTypeComboBox.addItem(u'Powerpoint')
|
|
|
|
|
# self.DisplayTypeComboBox.addItem(u'Keynote')
|
|
|
|
|
|
|
|
|
|
def onPresentationNewClick(self):
|
|
|
|
|
files = QtGui.QFileDialog.getOpenFileNames(None,
|
|
|
|
@ -131,8 +146,9 @@ class PresentationMediaItem(MediaManagerItem):
|
|
|
|
|
return filelist
|
|
|
|
|
|
|
|
|
|
def loadPresentationList(self, list):
|
|
|
|
|
for files in list:
|
|
|
|
|
self.PresentationsListData.addRow(files)
|
|
|
|
|
pass
|
|
|
|
|
# for files in list:
|
|
|
|
|
# self.PresentationsListData.addRow(files)
|
|
|
|
|
|
|
|
|
|
def onPresentationDeleteClick(self):
|
|
|
|
|
indexes = self.PresentationsListView.selectedIndexes()
|
|
|
|
@ -140,12 +156,3 @@ class PresentationMediaItem(MediaManagerItem):
|
|
|
|
|
current_row = int(index.row())
|
|
|
|
|
self.PresentationsListData.removeRow(current_row)
|
|
|
|
|
self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList())
|
|
|
|
|
|
|
|
|
|
def onPresentationPreviewClick(self):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def onPresentationLiveClick(self):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def onPresentationAddClick(self):
|
|
|
|
|
pass
|