openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00136
[Merge] lp:~trb143/openlp/servicing2 into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/servicing2 into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
Ok here it comes.
Changes to mediamanger superclass to allow it to work better with all plugins
removal of imagelistwithpreview from Images plugin.
Fixes to thememanager so delete does not eat ALL you themes.
Start of ImageSlideController plugin toolbar thinggy.
--
https://code.launchpad.net/~trb143/openlp/servicing2/+merge/8019
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2009-06-24 20:15:24 +0000
+++ openlp/core/lib/__init__.py 2009-06-29 05:13:06 +0000
@@ -39,7 +39,7 @@
ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
QtGui.QIcon.Off)
else:
- ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QImage(icon)),
+ ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
return ButtonIcon
@@ -75,7 +75,7 @@
from renderer import Renderer
from rendermanager import RenderManager
from mediamanageritem import MediaManagerItem
-from baselistwithdnd import BaseListWithDnD
+from baselistwithdnd import BaseListWithDnD
from listwithpreviews import ListWithPreviews
__all__ = [ 'translate', 'file_to_xml', 'str_to_bool',
=== modified file 'openlp/core/lib/baselistwithdnd.py'
--- openlp/core/lib/baselistwithdnd.py 2009-06-26 16:17:55 +0000
+++ openlp/core/lib/baselistwithdnd.py 2009-06-27 15:33:03 +0000
@@ -24,13 +24,13 @@
from openlp.core.lib.toolbar import *
from openlp.core.lib import translate
-class BaseListWithDnD(QtGui.QListView):
+class BaseListWithDnD(QtGui.QListWidget):
"""
Please put a short description of what this class does in here.
"""
def __init__(self,parent = None):
- QtGui.QListView.__init__(self,parent)
+ QtGui.QListWidget.__init__(self,parent)
# this must be set by the class which is inheriting
assert(self.PluginName)
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2009-06-26 16:40:49 +0000
+++ openlp/core/lib/mediamanageritem.py 2009-06-29 05:07:32 +0000
@@ -18,6 +18,7 @@
Place, Suite 330, Boston, MA 02111-1307 USA
"""
import types
+import os
from PyQt4 import QtCore, QtGui
@@ -50,7 +51,6 @@
if title is not None:
self.title = title
self.Toolbar = None
- #self.ConfigSection = None
self.PageLayout = QtGui.QVBoxLayout(self)
self.PageLayout.setSpacing(0)
self.PageLayout.setMargin(0)
@@ -118,13 +118,17 @@
# self.PluginTextShort # eg "Image" for the image plugin
# self.ConfigSection - where the items in the media manager are stored
# this could potentially be self.PluginTextShort.lower()
+ # self.IconPath=u'images/images' - allows specific icons to be used
+ # self.hasFileIcon - Is the file Icon required
+ # self.hasEditIcon - Is the edit Icon required
+ # self.hasNewIcon - Is the new Icon required
#
# self.OnNewPrompt=u'Select Image(s)'
# self.OnNewFileMasks=u'Images (*.jpg *jpeg *.gif *.png *.bmp)'
# assumes that the new action is to load a file. If not, override onnew
# self.ListViewWithDnD_class - there is a base list class with DnD assigned to it (openlp.core.lib.BaseListWithDnD())
- # each plugin needs to inherit a class from this and pass that *class* (not an instance) to here
- # via the ListViewWithDnD_class member
+ # each plugin needs to inherit a class from this and pass that *class* (not an instance) to here
+ # via the ListViewWithDnD_class member
# The assumption is that given that at least two plugins are of the form
# "text with an icon" then all this will help
# even for plugins of another sort, the setup of the right-click menu, common toolbar
@@ -139,16 +143,29 @@
# Add a toolbar
self.addToolbar()
# Create buttons for the toolbar
- ## New Song Button ##
- self.addToolbarButton(
- translate(self.TranslationContext, u'Load '+self.PluginTextShort),
- translate(self.TranslationContext, u'Load item into openlp.org'),
- u':/images/image_load.png', self.onNewClick, u'ImageNewItem')
- ## Delete Song Button ##
+ ## File Button ##
+ if self.hasFileIcon:
+ self.addToolbarButton(
+ translate(self.TranslationContext, u'Load '+self.PluginTextShort),
+ translate(self.TranslationContext, u'Load a new '+self.PluginTextShort),
+ u':'+self.IconPath+ u'_load.png', self.onFileClick, self.PluginTextShort+u'FileItem')
+ ## New Button ##
+ if self.hasNewIcon:
+ self.addToolbarButton(
+ translate(self.TranslationContext, u'New '+self.PluginTextShort),
+ translate(self.TranslationContext, u'Add a new '+self.PluginTextShort),
+ u':'+self.IconPath+ u'_load.png', self.onNewClick, self.PluginTextShort+u'NewItem')
+ ## Edit Button ##
+ if self.hasEditIcon:
+ self.addToolbarButton(
+ translate(self.TranslationContext, u'Edit '+self.PluginTextShort),
+ translate(self.TranslationContext, u'Edit the selected '+self.PluginTextShort),
+ u':'+self.IconPath+ u'_load.png', self.onEditClick, self.PluginTextShort+u'EditItem')
+ ## Delete Button ##
self.addToolbarButton(
translate(self.TranslationContext, u'Delete '+self.PluginTextShort),
translate(self.TranslationContext, u'Delete the selected item'),
- u':/images/image_delete.png', self.onDeleteClick, u'DeleteItem')
+ u':'+self.IconPath+ u'_delete.png', self.onDeleteClick, self.PluginTextShort+u'DeleteItem')
## Separator Line ##
self.addToolbarSeparator()
## Preview Button ##
@@ -166,20 +183,27 @@
translate(self.TranslationContext, u'Add '+self.PluginTextShort+u' To Service'),
translate(self.TranslationContext, u'Add the selected item(s) to the service'),
u':/system/system_add.png', self.onAddClick, self.PluginTextShort+u'AddItem')
+ #Allow the plugin to define it's own header
+ self.addHeaderBar()
#Add the List widget
self.ListView = self.ListViewWithDnD_class()
self.ListView.uniformItemSizes = True
- self.ListData = ListWithPreviews()
- self.ListView.setModel(self.ListData)
self.ListView.setGeometry(QtCore.QRect(10, 100, 256, 591))
self.ListView.setSpacing(1)
self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.ListView.setAlternatingRowColors(True)
self.ListView.setDragEnabled(True)
self.ListView.setObjectName(self.PluginTextShort+u'ListView')
+ #Add tp PageLayout
self.PageLayout.addWidget(self.ListView)
#define and add the context menu
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
+ if self.hasEditIcon:
+ self.ListView.addAction(self.contextMenuAction(self.ListView,
+ ':' +self.IconPath+u'_new.png',
+ translate(self.TranslationContext, u'&Edit '+self.PluginTextShort),
+ self.onEditClick))
+ self.ListView.addAction(self.contextMenuSeparator(self.SongListWidget))
self.ListView.addAction(self.contextMenuAction(
self.ListView, ':/system/system_preview.png',
translate(self.TranslationContext, u'&Preview '+self.PluginTextShort),
@@ -195,52 +219,63 @@
QtCore.QObject.connect(self.ListView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick)
- def initialise(self):
- self.loadList(self.parent.config.load_list(self.ConfigSection))
+ def addHeaderBar(self):
+ pass
- def onNewClick(self):
+ def onFileClick(self):
files = QtGui.QFileDialog.getOpenFileNames(None,
translate(self.TranslationContext, self.OnNewPrompt),
self.parent.config.get_last_dir(),
self.OnNewFileMasks)
- log.info(u'New files(s)', unicode(files))
+ log.info(u'New files(s)%s', unicode(files))
if len(files) > 0:
self.loadList(files)
dir, filename = os.path.split(unicode(files[0]))
self.parent.config.set_last_dir(dir)
- self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
+ #self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
+
+ def getFileList(self):
+ count = 0
+ while count < len(self.ListView):
+ filelist = [set.ListView.item(count).text()]
+ count += 1
+ return filelist
def loadList(self, list):
- for file in list:
- self.ListData.addRow(file)
+ raise NotImplementedError(u'MediaManagerItem.loadList needs to be defined by the plugin')
+
+ def onNewClick(self):
+ raise NotImplementedError(u'MediaManagerItem.onNewClick needs to be defined by the plugin')
+
+ def onEditClick(self):
+ raise NotImplementedError(u'MediaManagerItem.onEditClick needs to be defined by the plugin')
def onDeleteClick(self):
- indexes = self.ListView.selectedIndexes()
- for index in indexes:
- current_row = int(index.row())
- self.ListData.removeRow(current_row)
- self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
+ raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to be defined by the plugin')
- def generateSlideData(self):
+ def generateSlideData(self, item):
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin')
def onPreviewClick(self):
log.debug(self.PluginTextShort+u'Preview Requested')
service_item = ServiceItem(self.parent)
- service_item.addIcon(u':/media/media_image.png')
+ service_item.addIcon(u':/media/media_'+self.PluginTextShort.lower()+u'.png')
self.generateSlideData(service_item)
self.parent.preview_controller.addServiceItem(service_item)
+ self.ListView.clearSelection()
def onLiveClick(self):
- log.debug(self.PluginTextShort+u' Live Requested')
+ log.debug(self.PluginTextShort + u' Live Requested')
service_item = ServiceItem(self.parent)
- service_item.addIcon(u':/media/media_image.png')
+ service_item.addIcon(u':/media/media_'+self.PluginTextShort.lower()+u'.png')
self.generateSlideData(service_item)
self.parent.live_controller.addServiceItem(service_item)
+ self.ListView.clearSelection()
def onAddClick(self):
log.debug(self.PluginTextShort+u' Add Requested')
service_item = ServiceItem(self.parent)
- service_item.addIcon(u':/media/media_image.png')
+ service_item.addIcon(u':/media/media_'+self.PluginTextShort.lower()+u'.png')
self.generateSlideData(service_item)
self.parent.service_manager.addServiceItem(service_item)
+ self.ListView.clearSelection()
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2009-06-24 20:15:24 +0000
+++ openlp/core/lib/plugin.py 2009-06-28 06:54:12 +0000
@@ -101,7 +101,8 @@
self.event_manager = plugin_helpers[u'event']
self.render_manager = plugin_helpers[u'render']
self.service_manager = plugin_helpers[u'service']
- self.settings= plugin_helpers[u'settings']
+ self.settings = plugin_helpers[u'settings']
+ self.slideManager = plugin_helpers[u'slideManager']
self.dnd_id=None
def check_pre_conditions(self):
=== modified file 'openlp/core/lib/toolbar.py'
--- openlp/core/lib/toolbar.py 2009-06-16 18:21:24 +0000
+++ openlp/core/lib/toolbar.py 2009-06-29 05:07:32 +0000
@@ -28,7 +28,7 @@
Lots of toolbars around the place, so it makes sense to have a common way to manage them
"""
def __init__(self, parent):
- QtGui.QToolBar.__init__(self, parent)
+ QtGui.QToolBar.__init__(self, None)
# useful to be able to reuse button icons...
self.icons = {}
self.log = logging.getLogger(u'OpenLPToolbar')
=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py 2009-06-26 16:39:16 +0000
+++ openlp/core/ui/__init__.py 2009-06-29 05:07:32 +0000
@@ -17,6 +17,7 @@
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
+from slidecontroller import BaseToolbar
from slidecontrollermanager import SlideControllerManager
from maindisplay import MainDisplay
from amendthemeform import AmendThemeForm
@@ -32,5 +33,5 @@
from thememanager import ThemeManager
from mainwindow import MainWindow
-__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm',
+__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'BaseToolbar'
'MainWindow', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', 'AmendThemeForm']
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2009-06-26 16:39:16 +0000
+++ openlp/core/ui/mainwindow.py 2009-06-29 05:07:32 +0000
@@ -50,7 +50,7 @@
self.alertForm = AlertForm(self)
self.aboutForm = AboutForm()
self.settingsForm = SettingsForm(self.screenList, self)
- self.slideControllerManager = SlideControllerManager()
+ self.slideControllerManager = SlideControllerManager(self)
# Set up the path with plugins
pluginpath = os.path.split(os.path.abspath(__file__))[0]
pluginpath = os.path.abspath(
@@ -73,6 +73,7 @@
self.plugin_helpers[u'render'] = self.RenderManager
self.plugin_helpers[u'service'] = self.ServiceManagerContents
self.plugin_helpers[u'settings'] = self.settingsForm
+ self.plugin_helpers[u'slideManager'] = self.slideControllerManager
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers,
self.EventManager)
# hook methods have to happen after find_plugins. Find plugins needs the
@@ -168,11 +169,8 @@
self.ControlSplitter.setObjectName(u'ControlSplitter')
self.MainContentLayout.addWidget(self.ControlSplitter)
# Create slide controllers
- PreviewController = SlideController(self.ControlSplitter, self)
- 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')
+ self.PreviewController = SlideController(self)
+ self.LiveController = SlideController(self, True)
# Create menu
self.MenuBar = QtGui.QMenuBar(self.mainWindow)
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2009-06-26 16:39:16 +0000
+++ openlp/core/ui/servicemanager.py 2009-06-29 17:37:46 +0000
@@ -29,6 +29,22 @@
contextMenuAction, contextMenuSeparator
from openlp.core.utils import ConfigHelper
+class ServiceManagerList(QtGui.QTreeWidget):
+
+ def __init__(self,parent=None,name=None):
+ QtGui.QListView.__init__(self,parent)
+ self.parent = parent
+
+ def keyPressEvent(self, event):
+ if type(event) == QtGui.QKeyEvent:
+ #here accept the event and do something
+ if event.key() == QtCore.Qt.Key_Enter:
+ self.parent.makeLive()
+ event.accept()
+ event.ignore()
+ else:
+ event.ignore()
+
class ServiceManager(QtGui.QWidget):
"""
Manages the orders of service. Currently this involves taking
@@ -66,7 +82,7 @@
self.Toolbar.addAction(self.ThemeWidget)
self.Layout.addWidget(self.Toolbar)
# Create the service manager list
- self.ServiceManagerList = QtGui.QTreeWidget(self)
+ self.ServiceManagerList = ServiceManagerList(self)
self.ServiceManagerList.setEditTriggers(QtGui.QAbstractItemView.CurrentChanged|QtGui.QAbstractItemView.DoubleClicked|QtGui.QAbstractItemView.EditKeyPressed)
self.ServiceManagerList.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
self.ServiceManagerList.setAlternatingRowColors(True)
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-06-23 16:25:40 +0000
+++ openlp/core/ui/slidecontroller.py 2009-06-29 05:07:32 +0000
@@ -122,20 +122,20 @@
class SlideController(QtGui.QWidget):
"""
- SlideController is THE slide controller widget. This widget is what the user
+ SlideController is the slide controller widget. This widget is what the user
uses to control the displaying of verses/slides/etc on the screen.
"""
global log
log = logging.getLogger(u'SlideController')
- def __init__(self, controlSplitter, parent, isLive=False):
+ def __init__(self, parent, isLive=False):
"""
Set up the Slide Controller.
"""
QtGui.QWidget.__init__(self, parent.mainWindow)
self.isLive = isLive
self.parent = parent
- self.Panel = QtGui.QWidget(controlSplitter)
+ self.Panel = QtGui.QWidget(parent.ControlSplitter)
self.Splitter = QtGui.QSplitter(self.Panel)
self.Splitter.setOrientation(QtCore.Qt.Vertical)
# Layout for holding panel
@@ -166,39 +166,17 @@
self.PreviewListView.setSpacing(0)
self.PreviewListView.setObjectName(u'PreviewListView')
self.ControllerLayout.addWidget(self.PreviewListView)
- # Controller toolbar
- self.Toolbar = OpenLPToolbar(self.Controller)
- sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
- QtGui.QSizePolicy.Fixed)
- sizeToolbarPolicy.setHorizontalStretch(0)
- sizeToolbarPolicy.setVerticalStretch(0)
- sizeToolbarPolicy.setHeightForWidth(
- self.Toolbar.sizePolicy().hasHeightForWidth())
- if self.isLive:
- self.Toolbar.addToolbarButton(u'First Slide',
- u':/slides/slide_first.png',
- translate(u'SlideController', u'Move to first'),
- self.onSlideSelectedFirst)
- self.Toolbar.addToolbarButton(u'Last Slide',
- u':/slides/slide_previous.png',
- translate(u'SlideController', u'Move to previous'),
- self.onSlideSelectedPrevious)
- self.Toolbar.addToolbarButton(u'First Slide',
- u':/slides/slide_next.png',
- translate(u'SlideController', u'Move to next'),
- self.onSlideSelectedNext)
- if self.isLive:
- self.Toolbar.addToolbarButton(u'Last Slide',
- u':/slides/slide_last.png',
- translate(u'SlideController', u'Move to last'),
- self.onSlideSelectedLast)
- self.Toolbar.addSeparator()
- self.Toolbar.addToolbarButton(u'Close Screen',
- u':/slides/slide_close.png',
- translate(u'SlideController', u'Close Screen'),
- self.onBlankScreen)
- self.Toolbar.setSizePolicy(sizeToolbarPolicy)
+ # Plugin the Base Toolbar class
+ self.BaseToolbar = BaseToolbar(self.isLive)
+ self.Toolbar = self.BaseToolbar.getToolbar()
self.ControllerLayout.addWidget(self.Toolbar)
+ sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
+ QtGui.QSizePolicy.Fixed)
+ sizeToolbarPolicy.setHorizontalStretch(0)
+ sizeToolbarPolicy.setVerticalStretch(0)
+ sizeToolbarPolicy.setHeightForWidth(
+ self.Toolbar.sizePolicy().hasHeightForWidth())
+ self.Toolbar.setSizePolicy(sizeToolbarPolicy)
# Screen preview area
self.PreviewFrame = QtGui.QFrame(self.Splitter)
self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 250, 190))
@@ -226,11 +204,69 @@
self.SlidePreview.setScaledContents(True)
self.SlidePreview.setObjectName(u'SlidePreview')
self.grid.addWidget(self.SlidePreview, 0, 0, 1, 1)
- # Some events
- QtCore.QObject.connect(self.PreviewListView,
- QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
- QtCore.QObject.connect(self.PreviewListView,
- QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected)
+ QtCore.QObject.connect(self.PreviewListView,
+ QtCore.SIGNAL(u'clicked(QModelIndex)'), self.BaseToolbar.onSlideSelected)
+ QtCore.QObject.connect(self.PreviewListView,
+ QtCore.SIGNAL(u'activated(QModelIndex)'), self.BaseToolbar.onSlideSelected)
+ # Add Late Arrivals
+ self.BaseToolbar.PreviewListView = self.PreviewListView
+ self.BaseToolbar.PreviewListData = self.PreviewListData
+ self.BaseToolbar.SlidePreview = self.SlidePreview
+ self.BaseToolbar.mainDisplay = self.parent.mainDisplay
+
+ def addServiceItem(self, item):
+ self.BaseToolbar.addServiceItem(item)
+
+ def addServiceManagerItem(self, item, slideno):
+ self.BaseToolbar.addServiceManagerItem(item, slideno)
+
+class BaseToolbar(object):
+
+ def __init__(self, isLive):
+ self.Toolbar = None
+ self.PreviewListView = QtGui.QListWidget()
+ self.PreviewListData = None
+ self.isLive = isLive
+ self.defineToolbar()
+
+ def getToolbar(self):
+ return self.Toolbar
+
+ def defineToolbar(self):
+ # Controller toolbar
+ #self.Toolbar = OpenLPToolbar(self.Controller)
+ self.Toolbar = OpenLPToolbar(self)
+ sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
+ QtGui.QSizePolicy.Fixed)
+ sizeToolbarPolicy.setHorizontalStretch(0)
+ sizeToolbarPolicy.setVerticalStretch(0)
+ sizeToolbarPolicy.setHeightForWidth(
+ self.Toolbar.sizePolicy().hasHeightForWidth())
+ self.Toolbar.setSizePolicy(sizeToolbarPolicy)
+
+ if self.isLive:
+ self.Toolbar.addToolbarButton(u'First Slide',
+ u':/slides/slide_first.png',
+ translate(u'SlideController', u'Move to first'),
+ self.onSlideSelectedFirst)
+ self.Toolbar.addToolbarButton(u'Last Slide',
+ u':/slides/slide_previous.png',
+ translate(u'SlideController', u'Move to previous'),
+ self.onSlideSelectedPrevious)
+ self.Toolbar.addToolbarButton(u'First Slide',
+ u':/slides/slide_next.png',
+ translate(u'SlideController', u'Move to next'),
+ self.onSlideSelectedNext)
+ if self.isLive:
+ self.Toolbar.addToolbarButton(u'Last Slide',
+ u':/slides/slide_last.png',
+ translate(u'SlideController', u'Move to last'),
+ self.onSlideSelectedLast)
+ self.Toolbar.addSeparator()
+ self.Toolbar.addToolbarButton(u'Close Screen',
+ u':/slides/slide_close.png',
+ translate(u'SlideController', u'Close Screen'),
+ self.onBlankScreen)
def onSlideSelectedFirst(self):
"""
@@ -308,7 +344,7 @@
if self.isLive:
no = frame[1]
LiveFrame = self.serviceitem.frames[no][u'image']
- self.parent.mainDisplay.frameView(LiveFrame)
+ self.mainDisplay.frameView(LiveFrame)
def addServiceItem(self, serviceitem):
"""
=== added file 'openlp/core/ui/slidecontrollermanager.py'
--- openlp/core/ui/slidecontrollermanager.py 1970-01-01 00:00:00 +0000
+++ openlp/core/ui/slidecontrollermanager.py 2009-06-28 06:54:12 +0000
@@ -0,0 +1,52 @@
+# -*- 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
+
+class SlideControllerManager():
+ """
+ This class controls which SlideController is availabe to the
+ main window
+ """
+ global log
+ log = logging.getLogger(u'SlideControllerManager')
+
+ def __init__(self, parent):
+ """
+ Set up the Slide Controller. Manager
+ """
+ self.parent = parent
+ self.live = {}
+ self.preview = {}
+
+ def add_controllers(self, handle, preview, live):
+ self.live[handle] = live
+ self.preview[handle] = preview
+ print self.live
+
+ def getPreviewController(self, handle):
+ return self.preview[handle]
+
+ def getLiveController(self, handle):
+ print "---"
+ print self.live
+ print handle
+ print self.live[handle]
+ return self.live[handle]
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2009-06-24 05:17:41 +0000
+++ openlp/core/ui/thememanager.py 2009-06-29 05:07:32 +0000
@@ -175,30 +175,33 @@
def onEditTheme(self):
items = self.ThemeListView.selectedIndexes()
- for item in items:
- data = self.themeData.getValue(item)
- self.amendThemeForm.loadTheme(data[3])
- self.amendThemeForm.exec_()
+ if len(items) > 0:
+ for item in items:
+ print item
+ data = self.themeData.getValue(item)
+ self.amendThemeForm.loadTheme(data[3])
+ self.amendThemeForm.exec_()
def onDeleteTheme(self):
items = self.ThemeListView.selectedIndexes()
- theme = u''
- for item in items:
- data = self.themeData.getValue(item)
- theme = data[3]
- th = theme + u'.png'
- try:
- os.remove(os.path.join(self.path, th))
- except:
- #if not present do not worry
- pass
- try:
- shutil.rmtree(os.path.join(self.path, theme))
- except:
- #if not present do not worry
- pass
- self.themeData.clearItems()
- self.loadThemes()
+ if len(items) > 0:
+ theme = u''
+ for item in items:
+ data = self.themeData.getValue(item)
+ theme = data[3]
+ th = theme + u'.png'
+ try:
+ os.remove(os.path.join(self.path, th))
+ except:
+ #if not present do not worry
+ pass
+ try:
+ shutil.rmtree(os.path.join(self.path, theme))
+ except:
+ #if not present do not worry
+ pass
+ self.themeData.clearItems()
+ self.loadThemes()
def onExportTheme(self):
pass
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2009-06-26 17:51:43 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2009-06-29 05:07:32 +0000
@@ -57,8 +57,6 @@
self.TranslationContext = u'BiblePlugin'
self.PluginTextShort = u'Bible'
self.ConfigSection = u'bibles'
-# self.OnNewPrompt = u'Select Image(s)'
-# self.OnNewFileMasks = u'Images (*.jpg *jpeg *.gif *.png *.bmp)'
MediaManagerItem.__init__(self, parent, icon, title)
self.search_results = {} # place to store the search results
QtCore.QObject.connect(Receiver().get_receiver(),
@@ -192,11 +190,11 @@
self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced')
# Add the search tab widget to the page layout
self.PageLayout.addWidget(self.SearchTabWidget)
- self.BibleListWidget = BibleList()
- self.BibleListWidget.setAlternatingRowColors(True)
- self.BibleListWidget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
- self.BibleListWidget.setDragEnabled(True)
- self.PageLayout.addWidget(self.BibleListWidget)
+ self.ListView = BibleList()
+ self.ListView.setAlternatingRowColors(True)
+ self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
+ self.ListView.setDragEnabled(True)
+ self.PageLayout.addWidget(self.ListView)
# Combo Boxes
QtCore.QObject.connect(self.AdvancedVersionComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
@@ -213,18 +211,18 @@
QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton)
QtCore.QObject.connect(self.QuickSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton)
- QtCore.QObject.connect(self.BibleListWidget,
+ QtCore.QObject.connect(self.ListView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick)
# Context Menus
- self.BibleListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
- self.BibleListWidget.addAction(self.contextMenuAction(
- self.BibleListWidget, u':/system/system_preview.png',
+ self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
+ self.ListView.addAction(self.contextMenuAction(
+ self.ListView, u':/system/system_preview.png',
translate(u'BibleMediaItem',u'&Preview Verse'), self.onPreviewClick))
- self.BibleListWidget.addAction(self.contextMenuAction(
- self.BibleListWidget, u':/system/system_live.png',
+ self.ListView.addAction(self.contextMenuAction(
+ self.ListView, u':/system/system_live.png',
translate(u'BibleMediaItem',u'&Show Live'), self.onLiveClick))
- self.BibleListWidget.addAction(self.contextMenuAction(
- self.BibleListWidget, u':/system/system_add.png',
+ self.ListView.addAction(self.contextMenuAction(
+ self.ListView, u':/system/system_add.png',
translate(u'BibleMediaItem',u'&Add to Service'), self.onAddClick))
def retranslateUi(self):
@@ -309,7 +307,7 @@
self.search_results = self.parent.biblemanager.get_verse_text(bible, book,
chapter_from, chapter_to, verse_from, verse_to)
if self.ClearAdvancedSearchComboBox.currentIndex() == 0:
- self.BibleListWidget.clear()
+ self.ListView.clear()
self.displayResults(bible)
def onAdvancedFromChapter(self):
@@ -327,7 +325,7 @@
bible = unicode(self.QuickVersionComboBox.currentText())
text = unicode(self.QuickSearchEdit.displayText())
if self.ClearQuickSearchComboBox.currentIndex() == 0:
- self.BibleListWidget.clear()
+ self.ListView.clear()
if self.QuickSearchComboBox.currentIndex() == 1:
self.search_results = self.parent.biblemanager.get_verse_from_text(bible, text)
else:
@@ -335,33 +333,15 @@
if self.search_results is not None:
self.displayResults(bible)
-# def onLiveClick(self):
-# service_item = ServiceItem(self.parent)
-# service_item.addIcon( u':/media/media_verse.png')
-# self.generateSlideData(service_item)
-# self.parent.live_controller.addServiceItem(service_item)
-#
-# def onAddClick(self):
-# service_item = ServiceItem(self.parent)
-# service_item.addIcon(u':/media/media_verse.png')
-# self.generateSlideData(service_item)
-# self.parent.service_manager.addServiceItem(service_item)
-#
-# def onPreviewClick(self):
-# service_item = ServiceItem(self.parent)
-# service_item.addIcon(u':/media/media_verse.png')
-# self.generateSlideData(service_item)
-# self.parent.preview_controller.addServiceItem(service_item)
-
def generateSlideData(self, service_item):
log.debug(u'generating slide data')
- items = self.BibleListWidget.selectedIndexes()
+ items = self.ListView.selectedIndexes()
old_chapter = u''
raw_slides=[]
raw_footer = []
bible_text = u''
for item in items:
- bitem = self.BibleListWidget.item(item.row())
+ bitem = self.ListView.item(item.row())
text = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
verse = text[:text.find(u'(')]
bible = text[text.find(u'(') + 1:text.find(u')')]
@@ -440,7 +420,7 @@
bible_text = unicode(u' %s %d:%d (%s)'%(book , chap,vse, bible))
bible_verse = QtGui.QListWidgetItem(bible_text)
bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(bible_text))
- self.BibleListWidget.addItem(bible_verse)
+ self.ListView.addItem(bible_verse)
def searchByReference(self, bible, search):
log.debug(u'searchByReference %s ,%s', bible, search)
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2009-06-26 18:54:05 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2009-06-27 19:55:55 +0000
@@ -105,38 +105,38 @@
self.CustomWidget.setObjectName(u'CustomWidget')
# Add the Custom widget to the page layout
self.PageLayout.addWidget(self.CustomWidget)
- self.CustomListWidget = CustomList()
- self.CustomListWidget.setAlternatingRowColors(True)
- self.CustomListWidget.setDragEnabled(True)
- self.PageLayout.addWidget(self.CustomListWidget)
+ self.ListView = CustomList()
+ self.ListView.setAlternatingRowColors(True)
+ self.ListView.setDragEnabled(True)
+ self.PageLayout.addWidget(self.ListView)
# Signals
- QtCore.QObject.connect(self.CustomListWidget,
+ QtCore.QObject.connect(self.ListView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onCustomPreviewClick)
#define and add the context menu
- self.CustomListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
- self.CustomListWidget.addAction(self.contextMenuAction(self.CustomListWidget,
+ self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
+ self.ListView.addAction(self.contextMenuAction(self.ListView,
':/custom/custom_edit.png', translate(u'CustomMediaItem', u'&Edit Custom'),
self.onCustomEditClick))
- self.CustomListWidget.addAction(self.contextMenuSeparator(self.CustomListWidget))
- self.CustomListWidget.addAction(self.contextMenuAction(
- self.CustomListWidget, ':/system/system_preview.png',
+ self.ListView.addAction(self.contextMenuSeparator(self.ListView))
+ self.ListView.addAction(self.contextMenuAction(
+ self.ListView, ':/system/system_preview.png',
translate(u'CustomMediaItem',u'&Preview Custom'), self.onCustomPreviewClick))
- self.CustomListWidget.addAction(self.contextMenuAction(
- self.CustomListWidget, ':/system/system_live.png',
+ self.ListView.addAction(self.contextMenuAction(
+ self.ListView, ':/system/system_live.png',
translate(u'CustomMediaItem',u'&Show Live'), self.onCustomLiveClick))
- self.CustomListWidget.addAction(self.contextMenuAction(
- self.CustomListWidget, ':/system/system_add.png',
+ self.ListView.addAction(self.contextMenuAction(
+ self.ListView, ':/system/system_add.png',
translate(u'CustomMediaItem',u'&Add to Service'), self.onCustomAddClick))
def initialise(self):
self.loadCustomList(self.parent.custommanager.get_all_slides())
def loadCustomList(self, list):
- self.CustomListWidget.clear()
+ self.ListView.clear()
for CustomSlide in list:
custom_name = QtGui.QListWidgetItem(CustomSlide.title)
custom_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(CustomSlide.id))
- self.CustomListWidget.addItem(custom_name)
+ self.ListView.addItem(custom_name)
def onCustomNewClick(self):
self.parent.edit_custom_form.loadCustom(0)
@@ -144,8 +144,7 @@
self.initialise()
def onCustomEditClick(self):
- item = self.CustomListWidget.currentItem()
- item = self.CustomListWidget.currentItem()
+ item = self.ListView.currentItem()
if item is not None:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.edit_custom_form.loadCustom(item_id)
@@ -153,12 +152,12 @@
self.initialise()
def onCustomDeleteClick(self):
- item = self.CustomListWidget.currentItem()
+ item = self.ListView.currentItem()
if item is not None:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.custommanager.delete_custom(item_id)
- row = self.CustomListWidget.row(item)
- self.CustomListWidget.takeItem(row)
+ row = self.ListView.row(item)
+ self.ListView.takeItem(row)
def onCustomPreviewClick(self):
log.debug(u'Custom Preview Requested')
@@ -186,7 +185,7 @@
raw_footer = []
slide = None
theme = None
- item = self.CustomListWidget.currentItem()
+ item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
customSlide = self.parent.custommanager.get_custom(item_id)
title = customSlide.title
=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py 2009-06-26 17:51:43 +0000
+++ openlp/plugins/images/imageplugin.py 2009-06-27 15:33:03 +0000
@@ -47,4 +47,3 @@
def initialise(self):
log.info(u'Plugin Initialising')
-
=== modified file 'openlp/plugins/images/lib/__init__.py'
--- openlp/plugins/images/lib/__init__.py 2009-06-23 20:53:06 +0000
+++ openlp/plugins/images/lib/__init__.py 2009-06-29 05:07:32 +0000
@@ -17,6 +17,5 @@
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
-
-from listwithpreviews import ListWithPreviews
from mediaitem import ImageMediaItem
+from imageslidecontroller import ImageToolbar
=== added file 'openlp/plugins/images/lib/imageslidecontroller.py'
--- openlp/plugins/images/lib/imageslidecontroller.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/images/lib/imageslidecontroller.py 2009-06-29 05:07:32 +0000
@@ -0,0 +1,103 @@
+# -*- 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.lib import OpenLPToolbar, translate
+from openlp.core.ui.slidecontroller import BaseToolbar
+
+class ImageToolbar(BaseToolbar):
+
+ def __init__(self, isLive):
+ self.Toolbar = None
+ self.PreviewListView = QtGui.QListWidget()
+ self.PreviewListData = None
+ self.isLive = isLive
+ self.defineToolbar()
+
+ def getToolbar(self):
+ return self.Toolbar
+
+ def defineToolbar(self):
+ # Controller toolbar
+ #self.Toolbar = OpenLPToolbar(self.Controller)
+ sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
+ QtGui.QSizePolicy.Fixed)
+ sizeToolbarPolicy.setHorizontalStretch(0)
+ sizeToolbarPolicy.setVerticalStretch(0)
+ sizeToolbarPolicy.setHeightForWidth(
+ self.Toolbar.sizePolicy().hasHeightForWidth())
+ if self.isLive:
+ self.Toolbar.addToolbarButton(u'First Slide',
+ u':/slides/slide_first.png',
+ translate(u'SlideController', u'Move to first'),
+ self.onSlideSelectedFirst)
+ self.Toolbar.addToolbarButton(u'Last Slide',
+ u':/slides/slide_previous.png',
+ translate(u'SlideController', u'Move to previous'),
+ self.onSlideSelectedPrevious)
+ self.Toolbar.addToolbarButton(u'First Slide',
+ u':/slides/slide_next.png',
+ translate(u'SlideController', u'Move to next'),
+ self.onSlideSelectedNext)
+ if self.isLive:
+ self.Toolbar.addToolbarButton(u'Last Slide',
+ u':/slides/slide_last.png',
+ translate(u'SlideController', u'Move to last'),
+ self.onSlideSelectedLast)
+ self.Toolbar.addSeparator()
+ self.Toolbar.addToolbarButton(u'Close Screen',
+ u':/slides/slide_close.png',
+ translate(u'SlideController', u'Close Screen'),
+ self.onBlankScreen)
+ self.Toolbar.addSeparator()
+ self.Toolbar.addToolbarButton(u'Start Loop',
+ u':/slides/slide_last.png',
+ translate(u'SlideController', u'Start continuous loop'),
+ self.onStartLoop)
+ self.Toolbar.addToolbarButton(u'Stop Loop',
+ u':/slides/slide_last.png',
+ translate(u'SlideController', u'Start continuous loop'),
+ self.onStopLoop)
+ self.Toolbar.setSizePolicy(sizeToolbarPolicy)
+ self.ControllerLayout.addWidget(self.Toolbar)
+
+ def onStartLoop(self):
+ """
+ Go to the last slide.
+ """
+ row = self.PreviewListData.createIndex(
+ self.PreviewListData.rowCount() - 1, 0)
+ if row.isValid():
+ self.PreviewListView.selectionModel().setCurrentIndex(row,
+ QtGui.QItemSelectionModel.SelectCurrent)
+ self.onSlideSelected(row)
+
+ def onStopLoop(self):
+ """
+ Go to the last slide.
+ """
+ row = self.PreviewListData.createIndex(
+ self.PreviewListData.rowCount() - 1, 0)
+ if row.isValid():
+ self.PreviewListView.selectionModel().setCurrentIndex(row,
+ QtGui.QItemSelectionModel.SelectCurrent)
+ self.onSlideSelected(row)
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2009-06-26 16:39:16 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2009-06-29 05:13:06 +0000
@@ -21,10 +21,8 @@
import os
from PyQt4 import QtCore, QtGui
-
-# from openlp.plugins.images.lib import ListWithPreviews
-from listwithpreviews import ListWithPreviews
-from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD
+from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD, buildIcon
+from openlp.plugins.images.lib.imageslidecontroller import ImageToolbar
# We have to explicitly create separate classes for each plugin
# in order for DnD to the Service manager to work correctly.
@@ -45,19 +43,50 @@
self.TranslationContext = u'ImagePlugin'
self.PluginTextShort = u'Image'
self.ConfigSection = u'images'
+ self.IconPath = u'images/image'
+ self.hasFileIcon = True
+ self.hasNewIcon = False
+ self.hasEditIcon = False
self.OnNewPrompt = u'Select Image(s)'
self.OnNewFileMasks = u'Images (*.jpg *jpeg *.gif *.png *.bmp)'
+ self.slidecontroller = u'image'
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = ImageListView
MediaManagerItem.__init__(self, parent, icon, title)
+ #create and install our own slide controllers
+ #a=c
+# live_controller = ImageSlideController(self.parent.slideManager.parent, True)
+# preview_controller = ImageSlideController(self.parent.slideManager.parent)
+# self.parent.slideManager.add_controllers(u'image', preview_controller, live_controller)
+
+ def initialise(self):
+ self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
+ self.ListView.setIconSize(QtCore.QSize(88,50))
+ self.loadList(self.parent.config.load_list(self.ConfigSection))
+
+ def onDeleteClick(self):
+ item = self.ListView.currentItem()
+ if item is not None:
+ item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
+ row = self.ListView.row(item)
+ self.ListView.takeItem(row)
+ self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
+
+ def loadList(self, list):
+ for file in list:
+ (path, filename) = os.path.split(unicode(file))
+ item_name = QtGui.QListWidgetItem(filename)
+ item_name.setIcon(buildIcon(file))
+ item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
+ self.ListView.addItem(item_name)
def generateSlideData(self, service_item):
- indexes = self.ListView.selectedIndexes()
+ items = self.ListView.selectedIndexes()
service_item.title = u'Image(s)'
- for index in indexes:
- filename = self.ListData.getFilename(index)
+ for item in items:
+ bitem = self.ListView.item(item.row())
+ filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
frame = QtGui.QImage(unicode(filename))
(path, name) = os.path.split(filename)
service_item.add_from_image(path, name, frame)
-
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2009-06-26 16:39:16 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2009-06-27 19:55:55 +0000
@@ -43,107 +43,52 @@
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)'
+ self.hasFileIcon = True
+ self.hasNewIcon = False
+ self.hasEditIcon = False
+ self.IconPath = u'presentations/presentation'
+ self.OnNewPrompt = u'Select Presentation(s)'
+ self.OnNewFileMasks = u'Presentations (*.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 addHeaderBar(self):
+ 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 Presentation widget to the page layout
+ self.PageLayout.addWidget(self.PresentationWidget)
def initialise(self):
list = self.parent.config.load_list(u'presentations')
self.loadPresentationList(list)
-# self.DisplayTypeComboBox.addItem(u'Impress')
+ self.DisplayTypeComboBox.addItem(u'Impress')
# self.DisplayTypeComboBox.addItem(u'Powerpoint')
# self.DisplayTypeComboBox.addItem(u'Keynote')
- def onPresentationNewClick(self):
- files = QtGui.QFileDialog.getOpenFileNames(None,
- translate(u'PresentationsMediaItem', u'Select presentations(s)'),
- self.parent.config.get_last_dir(), u'Presentations (*.ppt *.pps *.odp)')
- if len(files) > 0:
- self.loadPresentationList(files)
- dir, filename = os.path.split(unicode(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
+ def loadList(self, list):
+ for file in list:
+ (path, filename) = os.path.split(unicode(file))
+ item_name = QtGui.QListWidgetItem(filename)
+ item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
+ self.ListView.addItem(item_name)
def loadPresentationList(self, list):
pass
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2009-06-17 05:11:16 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2009-06-27 19:55:55 +0000
@@ -317,11 +317,6 @@
self.TitleEditItem.setStyleSheet(u'background-color: red; color: white')
else:
self.TitleEditItem.setStyleSheet(u'')
- if len(self.CopyrightEditItem.displayText()) == 0:
- valid = False
- self.CopyrightEditItem.setStyleSheet(u'background-color: red; color: white')
- else:
- self.CopyrightEditItem.setStyleSheet(u'')
if self.VerseListWidget.count() == 0:
valid = False
self.VerseListWidget.setStyleSheet(u'background-color: red; color: white')
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2009-06-26 18:54:05 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2009-06-27 19:55:55 +0000
@@ -121,12 +121,12 @@
self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1)
# Add the song widget to the page layout
self.PageLayout.addWidget(self.SongWidget)
- self.SongListWidget = SongList()
- self.SongListWidget.setAlternatingRowColors(True)
- self.SongListWidget.setDragEnabled(True)
- self.SongListWidget.setObjectName(u'SongListWidget')
- self.PageLayout.addWidget(self.SongListWidget)
- self.SongListWidget.setDragEnabled(True)
+ self.ListView = SongList()
+ self.ListView.setAlternatingRowColors(True)
+ self.ListView.setDragEnabled(True)
+ self.ListView.setObjectName(u'ListView')
+ self.PageLayout.addWidget(self.ListView)
+ self.ListView.setDragEnabled(True)
# Signals and slots
QtCore.QObject.connect(self.SearchTextButton,
QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
@@ -134,21 +134,21 @@
QtCore.SIGNAL(u'pressed()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit,
QtCore.SIGNAL(u'textChanged(const QString&)'), self.onSearchTextEditChanged)
- QtCore.QObject.connect(self.SongListWidget,
+ QtCore.QObject.connect(self.ListView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onSongPreviewClick)
#define and add the context menu
- self.SongListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
- self.SongListWidget.addAction(self.contextMenuAction(self.SongListWidget,
+ self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
+ self.ListView.addAction(self.contextMenuAction(self.ListView,
':/songs/song_new.png', translate(u'SongMediaItem', u'&Edit Song'),
self.onSongEditClick))
- self.SongListWidget.addAction(self.contextMenuSeparator(self.SongListWidget))
- self.SongListWidget.addAction(self.contextMenuAction(self.SongListWidget,
+ self.ListView.addAction(self.contextMenuSeparator(self.ListView))
+ self.ListView.addAction(self.contextMenuAction(self.ListView,
':/system/system_preview.png', translate(u'SongMediaItem', u'&Preview Song'),
self.onSongPreviewClick))
- self.SongListWidget.addAction(self.contextMenuAction(self.SongListWidget,
+ self.ListView.addAction(self.contextMenuAction(self.ListView,
':/system/system_live.png', translate(u'SongMediaItem', u'&Show Live'),
self.onSongLiveClick))
- self.SongListWidget.addAction(self.contextMenuAction(self.SongListWidget,
+ self.ListView.addAction(self.contextMenuAction(self.ListView,
':/system/system_add.png', translate(u'SongMediaItem', u'&Add to Service'),
self.onSongAddClick))
@@ -182,7 +182,7 @@
def displayResultsSong(self, searchresults):
log.debug(u'display results Song')
- self.SongListWidget.clear()
+ self.ListView.clear()
#log.debug(u'Records returned from search %s", len(searchresults))
for song in searchresults:
author_list = u''
@@ -193,17 +193,17 @@
song_detail = unicode(u'%s (%s)' % (unicode(song.title), unicode(author_list)))
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
- self.SongListWidget.addItem(song_name)
+ self.ListView.addItem(song_name)
def displayResultsAuthor(self, searchresults):
log.debug(u'display results Author')
- self.SongListWidget.clear()
+ self.ListView.clear()
for author in searchresults:
for song in author.songs:
song_detail = unicode(u'%s (%s)' % (unicode(author.display_name), unicode(song.title)))
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
- self.SongListWidget.addItem(song_name)
+ self.ListView.addItem(song_name)
def onClearTextButtonClick(self):
"""
@@ -223,19 +223,19 @@
self.edit_song_form.exec_()
def onSongEditClick(self):
- item = self.SongListWidget.currentItem()
+ item = self.ListView.currentItem()
if item is not None:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.edit_song_form.loadSong(item_id)
self.edit_song_form.exec_()
def onSongDeleteClick(self):
- item = self.SongListWidget.currentItem()
+ item = self.ListView.currentItem()
if item is not None:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.songmanager.delete_song(item_id)
- row = self.SongListWidget.row(item)
- self.SongListWidget.takeItem(row)
+ row = self.ListView.row(item)
+ self.ListView.takeItem(row)
def onSongPreviewClick(self):
service_item = ServiceItem(self.parent)
@@ -248,7 +248,7 @@
raw_footer = []
author_list = u''
ccl = u''
- item = self.SongListWidget.currentItem()
+ item = self.ListView.currentItem()
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
song = self.parent.songmanager.get_song(item_id)
service_item.theme = song.theme_name
Follow ups