diff --git a/openlp/core/lib/ImageServiceItem.py b/openlp/core/lib/ImageServiceItem.py new file mode 100644 index 000000000..6d1fd7555 --- /dev/null +++ b/openlp/core/lib/ImageServiceItem.py @@ -0,0 +1,47 @@ +# -*- 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 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 +""" + +class ImageServiceItem(): + """ + The service item is a base class for the plugins to use to interact with + the service manager, the slide controller, and the renderer. + """ + + def __init__(self): + """ + Init Method + """ + pass + + def render(self): + """ + The render method is what the plugin uses to render its meda to the + screen. + """ + pass + + def get_parent_node(self): + """ + This method returns a parent node to be inserted into the Service + Manager. + """ + pass + + diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index a5c83d45c..c083605f6 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -26,6 +26,7 @@ from event import Event from xmlrootclass import XmlRootClass from serviceitem import ServiceItem from eventreceiver import Receiver +from imageserviceitem import ImageServiceItem __all__ = ['PluginConfig', 'Plugin', 'PluginUtils', 'SettingsTab', 'MediaManagerItem', 'Event', - 'XmlRootClass', 'ServiceItem', "Receiver"] + 'XmlRootClass', 'ServiceItem', 'Receiver', 'ImageServiceItem'] diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 0c4084a02..c9a96b1d7 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -21,9 +21,16 @@ Place, Suite 330, Boston, MA 02111-1307 USA class ServiceItem(): """ The service item is a base class for the plugins to use to interact with - the service manager, the slide controller, and the renderer. + the service manager, the slide controller, and the projection screen + compositor. """ + def __init__(self): + """ + Init Method + """ + pass + def render(self): """ The render method is what the plugin uses to render it's meda to the @@ -37,3 +44,22 @@ class ServiceItem(): Manager. """ pass + + def get_oos_repr(self): + """ + This method returns some text which can be saved into the OOS + file to represent this item + """ + pass + + def set_from_oos(self, oostext): + """ + This method takes some oostext (passed from the ServiceManager) + and parses it into the data actually required + """ + pass + + def set_from_plugin(self, data): + """ + Takes data from the plugin media chooser + """ diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 5f4c2a850..54e147f10 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -18,11 +18,11 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ +from slidecontroller import SlideController from splashscreen import SplashScreen from about import AboutForm from alertform import AlertForm from settings import SettingsDialog from mainwindow import MainWindow - -__all__ = ['SplashScreen', 'AboutForm', 'AlertForm', 'SettingsDialog', 'MainWindow'] +__all__ = ['SplashScreen', 'AboutForm', 'AlertForm', 'SettingsDialog', 'MainWindow', 'SlideController'] diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 12c232043..5a5594b18 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -24,8 +24,9 @@ from PyQt4 import * from PyQt4 import QtCore, QtGui from openlp.core.resources import * -from openlp.core.ui import AboutForm, AlertForm, SettingsDialog +from openlp.core.ui import AboutForm, AlertForm, SettingsDialog, SlideController from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab, Receiver + from openlp.core import PluginManager class MainWindow(object): @@ -70,47 +71,8 @@ class MainWindow(object): self.ControlSplitter = QtGui.QSplitter(self.MainContent) self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal) self.ControlSplitter.setObjectName("ControlSplitter") - self.PreviewPane = QtGui.QWidget(self.ControlSplitter) - self.PreviewPane.setObjectName("PreviewPane") - self.PreviewPaneLayout = QtGui.QVBoxLayout(self.PreviewPane) - self.PreviewPaneLayout.setSpacing(0) - self.PreviewPaneLayout.setMargin(0) - self.PreviewPaneLayout.setObjectName("PreviewPaneLayout") - self.PreviewSplitter = QtGui.QSplitter(self.PreviewPane) - self.PreviewSplitter.setOrientation(QtCore.Qt.Vertical) - self.PreviewSplitter.setObjectName("PreviewSplitter") - self.PreviewController = QtGui.QScrollArea(self.PreviewSplitter) - self.PreviewController.setWidgetResizable(True) - self.PreviewController.setObjectName("PreviewController") - self.PreviewControllerContents = QtGui.QWidget(self.PreviewController) - self.PreviewControllerContents.setGeometry(QtCore.QRect(0, 0, 228, 536)) - self.PreviewControllerContents.setObjectName("PreviewControllerContents") - self.PreviewController.setWidget(self.PreviewControllerContents) - self.PreviewScreen = QtGui.QGraphicsView(self.PreviewSplitter) - self.PreviewScreen.setMaximumSize(QtCore.QSize(16777215, 250)) - self.PreviewScreen.setObjectName("PreviewScreen") - self.PreviewPaneLayout.addWidget(self.PreviewSplitter) - self.LivePane = QtGui.QWidget(self.ControlSplitter) - self.LivePane.setObjectName("LivePane") - self.LivePaneLayout = QtGui.QVBoxLayout(self.LivePane) - self.LivePaneLayout.setSpacing(0) - self.LivePaneLayout.setMargin(0) - self.LivePaneLayout.setObjectName("LivePaneLayout") - self.LiveSplitter = QtGui.QSplitter(self.LivePane) - self.LiveSplitter.setOrientation(QtCore.Qt.Vertical) - self.LiveSplitter.setObjectName("LiveSplitter") - self.LiveController = QtGui.QScrollArea(self.LiveSplitter) - self.LiveController.setWidgetResizable(True) - self.LiveController.setObjectName("LiveController") - self.LiveControllerContents = QtGui.QWidget(self.LiveController) - self.LiveControllerContents.setGeometry(QtCore.QRect(0, 0, 227, 536)) - self.LiveControllerContents.setObjectName("LiveControllerContents") - self.LiveController.setWidget(self.LiveControllerContents) - self.LiveScreen = QtGui.QGraphicsView(self.LiveSplitter) - self.LiveScreen.setMaximumSize(QtCore.QSize(16777215, 250)) - self.LiveScreen.setObjectName("LiveScreen") - self.LivePaneLayout.addWidget(self.LiveSplitter) - self.MainContentLayout.addWidget(self.ControlSplitter) + self.PreviewController = SlideController(self.ControlSplitter) + self.LiveController = SlideController(self.ControlSplitter) self.main_window.setCentralWidget(self.MainContent) self.MenuBar = QtGui.QMenuBar(self.main_window) self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27)) @@ -398,7 +360,7 @@ class MainWindow(object): QtCore.QObject.connect(self.ViewMediaManagerItem, QtCore.SIGNAL("triggered(bool)"), self.MediaManagerDock.setVisible) QtCore.QObject.connect(self.ViewServiceManagerItem, QtCore.SIGNAL("triggered(bool)"), self.ServiceManagerDock.setVisible) QtCore.QObject.connect(self.ViewThemeManagerItem, QtCore.SIGNAL("triggered(bool)"), self.ThemeManagerDock.setVisible) - QtCore.QObject.connect(self.action_Preview_Pane, QtCore.SIGNAL("toggled(bool)"), self.PreviewPane.setVisible) + QtCore.QObject.connect(self.action_Preview_Pane, QtCore.SIGNAL("toggled(bool)"), self.PreviewController.Pane.setVisible) QtCore.QObject.connect(self.MediaManagerDock, QtCore.SIGNAL("visibilityChanged(bool)"), self.ViewMediaManagerItem.setChecked) QtCore.QObject.connect(self.ServiceManagerDock, QtCore.SIGNAL("visibilityChanged(bool)"), self.ViewServiceManagerItem.setChecked) QtCore.QObject.connect(self.ThemeManagerDock, QtCore.SIGNAL("visibilityChanged(bool)"), self.ViewThemeManagerItem.setChecked) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py new file mode 100644 index 000000000..99ea16f64 --- /dev/null +++ b/openlp/core/ui/slidecontroller.py @@ -0,0 +1,45 @@ +# -*- 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 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 os +from time import sleep +from PyQt4 import QtCore, QtGui + +class SlideController(object): + def __init__(self, control_splitter): + self.Pane = QtGui.QWidget(control_splitter) +# self.Pane.setObjectName("Pane") + self.PaneLayout = QtGui.QVBoxLayout(self.Pane) + self.PaneLayout.setSpacing(0) + self.PaneLayout.setMargin(0) +# self.PaneLayout.setObjectName("PaneLayout") + self.Splitter = QtGui.QSplitter(self.Pane) + self.Splitter.setOrientation(QtCore.Qt.Vertical) +# self.Splitter.setObjectName("Splitter") + self.Controller = QtGui.QScrollArea(self.Splitter) + self.Controller.setWidgetResizable(True) +# self.Controller.setObjectName("Controller") + self.ControllerContents = QtGui.QWidget(self.Controller) + self.ControllerContents.setGeometry(QtCore.QRect(0, 0, 228, 536)) +# self.ControllerContents.setObjectName("ControllerContents") + self.Controller.setWidget(self.ControllerContents) + self.Screen = QtGui.QGraphicsView(self.Splitter) + self.Screen.setMaximumSize(QtCore.QSize(16777215, 250)) +# self.Screen.setObjectName("Screen") + self.PaneLayout.addWidget(self.Splitter) diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 5a8dd5144..64be3b1a8 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -20,7 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA import os from PyQt4 import QtCore, QtGui from openlp.core.resources import * -from openlp.core.lib import Plugin, PluginUtils, MediaManagerItem +from openlp.core.lib import Plugin, PluginUtils, MediaManagerItem, ImageServiceItem #from forms import EditSongForm class ImagePlugin(Plugin, PluginUtils): @@ -33,6 +33,8 @@ class ImagePlugin(Plugin, PluginUtils): self.icon.addPixmap(QtGui.QPixmap(':/media/media_image.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.preview_service_item=ImageServiceItem() + self.live_service_item=ImageServiceItem() def get_media_manager_item(self): # Create the MediaManagerItem object @@ -114,7 +116,8 @@ class ImagePlugin(Plugin, PluginUtils): self._save_display_list(self.ImageListView) def onImagePreviewClick(self): - pass + self.preview_service_item.set_from_plugin(self.ImageListView.pathtofile) + self.preview_service_item.render() def onImageLiveClick(self): pass