forked from openlp/openlp
Start of plugable SlideControllers
This commit is contained in:
parent
8040f10204
commit
2879a52416
|
@ -48,6 +48,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||||
if title is not None:
|
if title is not None:
|
||||||
self.title = title
|
self.title = title
|
||||||
self.Toolbar = None
|
self.Toolbar = None
|
||||||
|
#self.ConfigSection = None
|
||||||
self.PageLayout = QtGui.QVBoxLayout(self)
|
self.PageLayout = QtGui.QVBoxLayout(self)
|
||||||
self.PageLayout.setSpacing(0)
|
self.PageLayout.setSpacing(0)
|
||||||
self.PageLayout.setMargin(0)
|
self.PageLayout.setMargin(0)
|
||||||
|
@ -219,7 +220,8 @@ class MediaManagerItem(QtGui.QWidget):
|
||||||
self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
|
self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
|
||||||
|
|
||||||
def generateSlideData(self):
|
def generateSlideData(self):
|
||||||
assert (0, 'This fn needs to be defined by the plugin');
|
#assert (0, 'This fn needs to be defined by the plugin');
|
||||||
|
pass
|
||||||
|
|
||||||
def onPreviewClick(self):
|
def onPreviewClick(self):
|
||||||
log.debug(self.PluginTextShort+u'Preview Requested')
|
log.debug(self.PluginTextShort+u'Preview Requested')
|
||||||
|
|
|
@ -17,7 +17,7 @@ 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
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
|
from slidecontrollermanager import SlideControllerManager
|
||||||
from maindisplay import MainDisplay
|
from maindisplay import MainDisplay
|
||||||
from amendthemeform import AmendThemeForm
|
from amendthemeform import AmendThemeForm
|
||||||
from slidecontroller import SlideController
|
from slidecontroller import SlideController
|
||||||
|
|
|
@ -23,7 +23,7 @@ import logging
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, ServiceManager, \
|
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, ServiceManager, \
|
||||||
ThemeManager, MainDisplay, SlideController
|
ThemeManager, MainDisplay, SlideController, SlideControllerManager
|
||||||
from openlp.core.lib import translate, Plugin, MediaManagerItem, SettingsTab, \
|
from openlp.core.lib import translate, Plugin, MediaManagerItem, SettingsTab, \
|
||||||
EventManager, RenderManager, PluginConfig
|
EventManager, RenderManager, PluginConfig
|
||||||
from openlp.core import PluginManager
|
from openlp.core import PluginManager
|
||||||
|
@ -50,6 +50,7 @@ class MainWindow(object):
|
||||||
self.alertForm = AlertForm(self)
|
self.alertForm = AlertForm(self)
|
||||||
self.aboutForm = AboutForm()
|
self.aboutForm = AboutForm()
|
||||||
self.settingsForm = SettingsForm(self.screenList, self)
|
self.settingsForm = SettingsForm(self.screenList, self)
|
||||||
|
self.slideControllerManager = SlideControllerManager()
|
||||||
# Set up the path with plugins
|
# Set up the path with plugins
|
||||||
pluginpath = os.path.split(os.path.abspath(__file__))[0]
|
pluginpath = os.path.split(os.path.abspath(__file__))[0]
|
||||||
pluginpath = os.path.abspath(
|
pluginpath = os.path.abspath(
|
||||||
|
@ -167,8 +168,11 @@ class MainWindow(object):
|
||||||
self.ControlSplitter.setObjectName(u'ControlSplitter')
|
self.ControlSplitter.setObjectName(u'ControlSplitter')
|
||||||
self.MainContentLayout.addWidget(self.ControlSplitter)
|
self.MainContentLayout.addWidget(self.ControlSplitter)
|
||||||
# Create slide controllers
|
# Create slide controllers
|
||||||
self.PreviewController = SlideController(self.ControlSplitter, self)
|
PreviewController = SlideController(self.ControlSplitter, self)
|
||||||
self.LiveController = SlideController(self.ControlSplitter, self, True)
|
LiveController = SlideController(self.ControlSplitter, self, True)
|
||||||
|
self.slideControllerManager.add_controllers(u'base', PreviewController, LiveController)
|
||||||
|
self.PreviewController = self.slideControllerManager.getPreviewController(u'base')
|
||||||
|
self.LiveController = self.slideControllerManager.getLiveController(u'base')
|
||||||
# Create menu
|
# Create menu
|
||||||
self.MenuBar = QtGui.QMenuBar(self.mainWindow)
|
self.MenuBar = QtGui.QMenuBar(self.mainWindow)
|
||||||
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
|
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
|
||||||
|
|
|
@ -280,6 +280,9 @@ class ServiceManager(QtGui.QWidget):
|
||||||
self.service_theme = self.ThemeComboBox.currentText()
|
self.service_theme = self.ThemeComboBox.currentText()
|
||||||
self.parent.RenderManager.set_service_theme(self.service_theme)
|
self.parent.RenderManager.set_service_theme(self.service_theme)
|
||||||
self.config.set_config(u'theme service theme', self.service_theme)
|
self.config.set_config(u'theme service theme', self.service_theme)
|
||||||
|
self.regenerateServiceItems()
|
||||||
|
|
||||||
|
def regenerateServiceItems(self):
|
||||||
if len(self.serviceItems) > 0:
|
if len(self.serviceItems) > 0:
|
||||||
tempServiceItems = self.serviceItems
|
tempServiceItems = self.serviceItems
|
||||||
self.onNewService()
|
self.onNewService()
|
||||||
|
@ -368,3 +371,4 @@ class ServiceManager(QtGui.QWidget):
|
||||||
self.service_theme = u''
|
self.service_theme = u''
|
||||||
self.ThemeComboBox.setCurrentIndex(id)
|
self.ThemeComboBox.setCurrentIndex(id)
|
||||||
self.parent.RenderManager.set_service_theme(self.service_theme)
|
self.parent.RenderManager.set_service_theme(self.service_theme)
|
||||||
|
self.regenerateServiceItems()
|
||||||
|
|
|
@ -52,7 +52,6 @@ class ImageMediaItem(MediaManagerItem):
|
||||||
self.ListViewWithDnD_class = ImageListView
|
self.ListViewWithDnD_class = ImageListView
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
|
|
||||||
|
|
||||||
def generateSlideData(self, service_item):
|
def generateSlideData(self, service_item):
|
||||||
indexes = self.ListView.selectedIndexes()
|
indexes = self.ListView.selectedIndexes()
|
||||||
service_item.title = u'Image(s)'
|
service_item.title = u'Image(s)'
|
||||||
|
|
|
@ -62,6 +62,14 @@ class Openoffice(object):
|
||||||
self.oopid = retval.pid
|
self.oopid = retval.pid
|
||||||
|
|
||||||
def checkOoPid(self):
|
def checkOoPid(self):
|
||||||
|
if os.name == u'nt':
|
||||||
|
import win32api
|
||||||
|
handle = win32api.OpenProcess(PROCESS_TERMINATE, False, self.oopid)
|
||||||
|
#todo need some code here
|
||||||
|
return True
|
||||||
|
elif os.name == u'mac':
|
||||||
|
pass
|
||||||
|
else:
|
||||||
procfile = open("/proc/%d/stat" %(self.oopid))
|
procfile = open("/proc/%d/stat" %(self.oopid))
|
||||||
file = procfile.readline().split()[1]
|
file = procfile.readline().split()[1]
|
||||||
print file
|
print file
|
||||||
|
|
|
@ -21,8 +21,15 @@ import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import MediaManagerItem, translate
|
|
||||||
from openlp.plugins.presentations.lib import FileListData
|
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):
|
class PresentationMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
|
@ -33,88 +40,96 @@ class PresentationMediaItem(MediaManagerItem):
|
||||||
log.info(u'Presentations Media Item loaded')
|
log.info(u'Presentations Media Item loaded')
|
||||||
|
|
||||||
def __init__(self, parent, icon, title):
|
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)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
|
|
||||||
def setupUi(self):
|
# def setupUi(self):
|
||||||
# Add a toolbar
|
# # Add a toolbar
|
||||||
self.addToolbar()
|
# self.addToolbar()
|
||||||
# Create buttons for the toolbar
|
# # Create buttons for the toolbar
|
||||||
## New Presentation Button ##
|
# ## New Presentation Button ##
|
||||||
self.addToolbarButton(
|
# self.addToolbarButton(
|
||||||
translate(u'PresentationsMediaItem',u'New presentations'),
|
# translate(u'PresentationsMediaItem',u'New presentations'),
|
||||||
translate(u'PresentationsMediaItem',u'Load presentations into openlp.org'),
|
# translate(u'PresentationsMediaItem',u'Load presentations into openlp.org'),
|
||||||
':/presentations/presentation_load.png', self.onPresentationNewClick, 'PresentationNewItem')
|
# ':/presentations/presentation_load.png', self.onPresentationNewClick, 'PresentationNewItem')
|
||||||
## Delete Presentation Button ##
|
# ## Delete Presentation Button ##
|
||||||
self.addToolbarButton(
|
# self.addToolbarButton(
|
||||||
translate(u'PresentationsMediaItem',u'Delete Presentation'),
|
# translate(u'PresentationsMediaItem',u'Delete Presentation'),
|
||||||
translate(u'PresentationsMediaItem',u'Delete the selected presentation'),
|
# translate(u'PresentationsMediaItem',u'Delete the selected presentation'),
|
||||||
':/presentations/presentation_delete.png', self.onPresentationDeleteClick, 'PresentationDeleteItem')
|
# ':/presentations/presentation_delete.png', self.onPresentationDeleteClick, 'PresentationDeleteItem')
|
||||||
## Separator Line ##
|
# ## Separator Line ##
|
||||||
self.addToolbarSeparator()
|
# self.addToolbarSeparator()
|
||||||
## Preview Presentation Button ##
|
# ## Preview Presentation Button ##
|
||||||
self.addToolbarButton(
|
# self.addToolbarButton(
|
||||||
translate(u'PresentationsMediaItem',u'Preview Presentation'),
|
# translate(u'PresentationsMediaItem',u'Preview Presentation'),
|
||||||
translate(u'PresentationsMediaItem',u'Preview the selected Presentation'),
|
# translate(u'PresentationsMediaItem',u'Preview the selected Presentation'),
|
||||||
':/system/system_preview.png', self.onPresentationPreviewClick, 'PresentationPreviewItem')
|
# ':/system/system_preview.png', self.onPresentationPreviewClick, 'PresentationPreviewItem')
|
||||||
## Live Presentation Button ##
|
# ## Live Presentation Button ##
|
||||||
self.addToolbarButton(
|
# self.addToolbarButton(
|
||||||
translate(u'PresentationsMediaItem',u'Go Live'),
|
# translate(u'PresentationsMediaItem',u'Go Live'),
|
||||||
translate(u'PresentationsMediaItem',u'Send the selected presentation live'),
|
# translate(u'PresentationsMediaItem',u'Send the selected presentation live'),
|
||||||
':/system/system_live.png', self.onPresentationLiveClick, 'PresentationLiveItem')
|
# ':/system/system_live.png', self.onPresentationLiveClick, 'PresentationLiveItem')
|
||||||
## Add Presentation Button ##
|
# ## Add Presentation Button ##
|
||||||
self.addToolbarButton(
|
# self.addToolbarButton(
|
||||||
translate(u'PresentationsMediaItem',u'Add Presentation To Service'),
|
# translate(u'PresentationsMediaItem',u'Add Presentation To Service'),
|
||||||
translate(u'PresentationsMediaItem',u'Add the selected Presentations(s) to the service'),
|
# translate(u'PresentationsMediaItem',u'Add the selected Presentations(s) to the service'),
|
||||||
':/system/system_add.png',self.onPresentationAddClick, 'PresentationsAddItem')
|
# ':/system/system_add.png',self.onPresentationAddClick, 'PresentationsAddItem')
|
||||||
## Add the Presentationlist widget ##
|
# ## Add the Presentationlist widget ##
|
||||||
|
#
|
||||||
self.PresentationWidget = QtGui.QWidget(self)
|
# self.PresentationWidget = QtGui.QWidget(self)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
# sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
# sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
# sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.PresentationWidget.sizePolicy().hasHeightForWidth())
|
# sizePolicy.setHeightForWidth(self.PresentationWidget.sizePolicy().hasHeightForWidth())
|
||||||
self.PresentationWidget.setSizePolicy(sizePolicy)
|
# self.PresentationWidget.setSizePolicy(sizePolicy)
|
||||||
self.PresentationWidget.setObjectName(u'PresentationWidget')
|
# self.PresentationWidget.setObjectName(u'PresentationWidget')
|
||||||
self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget)
|
# self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget)
|
||||||
self.DisplayLayout.setObjectName(u'DisplayLayout')
|
# self.DisplayLayout.setObjectName(u'DisplayLayout')
|
||||||
self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget)
|
# self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget)
|
||||||
self.DisplayTypeComboBox.setObjectName(u'DisplayTypeComboBox')
|
# self.DisplayTypeComboBox.setObjectName(u'DisplayTypeComboBox')
|
||||||
self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2)
|
# self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2)
|
||||||
self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
|
# self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
|
||||||
self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
|
# self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
|
||||||
self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
|
# self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
|
||||||
|
#
|
||||||
self.DisplayTypeLabel.setText(translate(u'PresentationMediaItem', u'Present using:'))
|
# self.DisplayTypeLabel.setText(translate(u'PresentationMediaItem', u'Present using:'))
|
||||||
|
#
|
||||||
# Add the song widget to the page layout
|
# # Add the song widget to the page layout
|
||||||
self.PageLayout.addWidget(self.PresentationWidget)
|
# self.PageLayout.addWidget(self.PresentationWidget)
|
||||||
|
#
|
||||||
self.PresentationsListView = QtGui.QListView()
|
# self.PresentationsListView = QtGui.QListView()
|
||||||
self.PresentationsListView.setAlternatingRowColors(True)
|
# self.PresentationsListView.setAlternatingRowColors(True)
|
||||||
self.PresentationsListData = FileListData()
|
# self.PresentationsListData = FileListData()
|
||||||
self.PresentationsListView.setModel(self.PresentationsListData)
|
# self.PresentationsListView.setModel(self.PresentationsListData)
|
||||||
|
#
|
||||||
self.PageLayout.addWidget(self.PresentationsListView)
|
# self.PageLayout.addWidget(self.PresentationsListView)
|
||||||
|
#
|
||||||
#define and add the context menu
|
# #define and add the context menu
|
||||||
self.PresentationsListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
# self.PresentationsListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
|
#
|
||||||
self.PresentationsListView.addAction(self.contextMenuAction(
|
# self.PresentationsListView.addAction(self.contextMenuAction(
|
||||||
self.PresentationsListView, ':/system/system_preview.png',
|
# self.PresentationsListView, ':/system/system_preview.png',
|
||||||
translate(u'PresentationsMediaItem',u'&Preview presentations'), self.onPresentationPreviewClick))
|
# translate(u'PresentationsMediaItem',u'&Preview presentations'), self.onPresentationPreviewClick))
|
||||||
self.PresentationsListView.addAction(self.contextMenuAction(
|
# self.PresentationsListView.addAction(self.contextMenuAction(
|
||||||
self.PresentationsListView, ':/system/system_live.png',
|
# self.PresentationsListView, ':/system/system_live.png',
|
||||||
translate(u'PresentationsMediaItem',u'&Show Live'), self.onPresentationLiveClick))
|
# translate(u'PresentationsMediaItem',u'&Show Live'), self.onPresentationLiveClick))
|
||||||
self.PresentationsListView.addAction(self.contextMenuAction(
|
# self.PresentationsListView.addAction(self.contextMenuAction(
|
||||||
self.PresentationsListView, ':/system/system_add.png',
|
# self.PresentationsListView, ':/system/system_add.png',
|
||||||
translate(u'PresentationsMediaItem',u'&Add to Service'), self.onPresentationAddClick))
|
# translate(u'PresentationsMediaItem',u'&Add to Service'), self.onPresentationAddClick))
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
list = self.parent.config.load_list(u'presentations')
|
list = self.parent.config.load_list(u'presentations')
|
||||||
self.loadPresentationList(list)
|
self.loadPresentationList(list)
|
||||||
self.DisplayTypeComboBox.addItem(u'Impress')
|
# self.DisplayTypeComboBox.addItem(u'Impress')
|
||||||
self.DisplayTypeComboBox.addItem(u'Powerpoint')
|
# self.DisplayTypeComboBox.addItem(u'Powerpoint')
|
||||||
self.DisplayTypeComboBox.addItem(u'Keynote')
|
# self.DisplayTypeComboBox.addItem(u'Keynote')
|
||||||
|
|
||||||
def onPresentationNewClick(self):
|
def onPresentationNewClick(self):
|
||||||
files = QtGui.QFileDialog.getOpenFileNames(None,
|
files = QtGui.QFileDialog.getOpenFileNames(None,
|
||||||
|
@ -131,8 +146,9 @@ class PresentationMediaItem(MediaManagerItem):
|
||||||
return filelist
|
return filelist
|
||||||
|
|
||||||
def loadPresentationList(self, list):
|
def loadPresentationList(self, list):
|
||||||
for files in list:
|
pass
|
||||||
self.PresentationsListData.addRow(files)
|
# for files in list:
|
||||||
|
# self.PresentationsListData.addRow(files)
|
||||||
|
|
||||||
def onPresentationDeleteClick(self):
|
def onPresentationDeleteClick(self):
|
||||||
indexes = self.PresentationsListView.selectedIndexes()
|
indexes = self.PresentationsListView.selectedIndexes()
|
||||||
|
@ -140,12 +156,3 @@ class PresentationMediaItem(MediaManagerItem):
|
||||||
current_row = int(index.row())
|
current_row = int(index.row())
|
||||||
self.PresentationsListData.removeRow(current_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
|
|
||||||
|
|
||||||
def onPresentationLiveClick(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def onPresentationAddClick(self):
|
|
||||||
pass
|
|
Loading…
Reference in New Issue