diff --git a/openlp/plugins/presentations/lib/__init__.py b/openlp/plugins/presentations/lib/__init__.py index 36dee3045..c84152dd5 100644 --- a/openlp/plugins/presentations/lib/__init__.py +++ b/openlp/plugins/presentations/lib/__init__.py @@ -20,5 +20,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA from filelistdata import FileListData from mediaitem import PresentationMediaItem +from presentationtab import PresentationTab -__all__ = ['PresentationMediaItem', 'FileListData'] +__all__ = ['PresentationMediaItem', 'FileListData', 'PresentationTab'] diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 98a2faef5..0cd80a727 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -39,87 +39,110 @@ class PresentationMediaItem(MediaManagerItem): def __init__(self, parent, icon, title): MediaManagerItem.__init__(self, parent, icon, title) - def setupUi(self): + def setupUi(self): # Add a toolbar self.addToolbar() # Create buttons for the toolbar ## New Presentation Button ## self.addToolbarButton( - translate('PresentationsMediaItem',u'New presentations'), + translate('PresentationsMediaItem',u'New presentations'), translate('PresentationsMediaItem',u'Load presentations into openlp.org'), ':/presentations/presentation_load.png', self.onPresentationNewClick, 'PresentationNewItem') ## Delete Presentation Button ## self.addToolbarButton( - translate('PresentationsMediaItem',u'Delete Presentation'), + translate('PresentationsMediaItem',u'Delete Presentation'), translate('PresentationsMediaItem',u'Delete the selected presentation'), ':/presentations/presentation_delete.png', self.onPresentationDeleteClick, 'PresentationDeleteItem') ## Separator Line ## self.addToolbarSeparator() ## Preview Presentation Button ## self.addToolbarButton( - translate('PresentationsMediaItem',u'Preview Presentation'), + translate('PresentationsMediaItem',u'Preview Presentation'), translate('PresentationsMediaItem',u'Preview the selected Presentation'), ':/system/system_preview.png', self.onPresentationPreviewClick, 'PresentationPreviewItem') ## Live Presentation Button ## self.addToolbarButton( - translate('PresentationsMediaItem',u'Go Live'), + translate('PresentationsMediaItem',u'Go Live'), translate('PresentationsMediaItem',u'Send the selected presentation live'), ':/system/system_live.png', self.onPresentationLiveClick, 'PresentationLiveItem') ## Add Presentation Button ## self.addToolbarButton( translate('PresentationsMediaItem',u'Add Presentation To Service'), - translate('PresentationsMediaItem',u'Add the selected Presentations(s) to the service'), + translate('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('PresentationWidget') + self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget) + self.DisplayLayout.setObjectName('DisplayLayout') + self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget) + self.DisplayTypeComboBox.setObjectName('DisplayTypeComboBox') + self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2) + self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget) + self.DisplayTypeLabel.setObjectName('SearchTypeLabel') + self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1) + + self.DisplayTypeLabel.setText(translate('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', + self.PresentationsListView, ':/system/system_preview.png', translate('PresentationsMediaItem',u'&Preview presentations'), self.onPresentationPreviewClick)) self.PresentationsListView.addAction(self.contextMenuAction( - self.PresentationsListView, ':/system/system_live.png', + self.PresentationsListView, ':/system/system_live.png', translate('PresentationsMediaItem',u'&Show Live'), self.onPresentationLiveClick)) self.PresentationsListView.addAction(self.contextMenuAction( - self.PresentationsListView, ':/system/system_add.png', + self.PresentationsListView, ':/system/system_add.png', translate('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') def onPresentationNewClick(self): - files = QtGui.QFileDialog.getOpenFileNames(None, - translate('PresentationsMediaItem', u'Select presentations(s)'), + files = QtGui.QFileDialog.getOpenFileNames(None, + translate('PresentationsMediaItem', u'Select presentations(s)'), self.parent.config.get_last_dir(), u'Presentations (*.ppt *.pps *.odi)') if len(files) > 0: self.loadPresentationList(files) dir, filename = os.path.split(str(files[0])) self.parent.config.set_last_dir(dir) self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList()) - + def getFileList(self): filelist = [item[0] for item in self.PresentationsListView]; - return filelist + return filelist def loadPresentationList(self, list): for files in list: self.PresentationsListData.addRow(files) - + def onPresentationDeleteClick(self): indexes = self.PresentationsListView.selectedIndexes() for index in indexes: current_row = int(index.row()) self.PresentationsListData.removeRow(current_row) - self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList()) + self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList()) def onPresentationPreviewClick(self): pass @@ -128,4 +151,4 @@ class PresentationMediaItem(MediaManagerItem): pass def onPresentationAddClick(self): - pass + pass diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 4587039cf..575b48e1d 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -3,7 +3,7 @@ """ OpenLP - Open Source Lyrics Projection Copyright (c) 2008 Raoul Snyman -Portions copyright (c) 2008 Martin Thompson, Tim Bentley, +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 @@ -22,9 +22,8 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.resources import * from openlp.core.lib import Plugin, MediaManagerItem -from openlp.plugins.presentations.lib import PresentationMediaItem +from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab class PresentationPlugin(Plugin): @@ -38,7 +37,8 @@ class PresentationPlugin(Plugin): QtGui.QIcon.Normal, QtGui.QIcon.Off) def get_settings_tab(self): - pass + self.presentation_tab = PresentationTab() + return self.presentation_tab def get_media_manager_item(self): # Create the MediaManagerItem object