← Back to team overview

openlp-core team mailing list archive

[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)

What a mix.
Changes following Martins last merge to remove duplications. (Commented out code will be removed later)
Start looking at Presentation plugin of OpenOffice
Start building plugable slideControllers , wanted for Presentations and Videos.
Add Rebuild of ServiceList when Theme Changes.
-- 
https://code.launchpad.net/~trb143/openlp/servicing2/+merge/7960
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'cnvdb.py'
--- cnvdb.py	2009-06-23 16:25:40 +0000
+++ cnvdb.py	2009-06-25 19:42:22 +0000
@@ -1,4 +1,25 @@
+#!/usr/bin/env python
+# -*- 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 codecs
+import sys
 
 
 class Convert():
@@ -8,16 +29,17 @@
     def process(self, inname, outname):
         infile = codecs.open(inname, 'r', encoding='iso-8859-1')
         writefile = codecs.open(outname, 'w', encoding='utf-8')
-        count = 0
         for line in infile:
             writefile.write(line)
-            if count < 150:
-                print line
-                count += 1
         infile.close()
         writefile.close()
 
-
 if __name__ == '__main__':
+    if len(sys.argv) < 2:
+        print 'No action specified.'
+        sys.exit()
+    print u'Uncode conversion '
+    print u'Input file  = ',  sys.argv[1:]
+    print u'Output file = ',  sys.argv[2:]
     mig = Convert()
-    mig.process(u'/home/timali/.local/share/openlp/songs/songs.dmp',u'/home/timali/.local/share/openlp/songs/songs.dmp2')
+    mig.process(sys.argv[1:],sys.argv[2:])

=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2009-06-26 16:17:55 +0000
+++ openlp/core/lib/mediamanageritem.py	2009-06-26 16:40:49 +0000
@@ -50,6 +50,7 @@
         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)

=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py	2009-04-28 19:20:03 +0000
+++ openlp/core/ui/__init__.py	2009-06-26 16:39:16 +0000
@@ -17,7 +17,7 @@
 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 Place, Suite 330, Boston, MA 02111-1307 USA
 """
-
+from slidecontrollermanager import SlideControllerManager
 from maindisplay import MainDisplay
 from amendthemeform import AmendThemeForm
 from slidecontroller import SlideController

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2009-06-20 07:08:17 +0000
+++ openlp/core/ui/mainwindow.py	2009-06-26 16:39:16 +0000
@@ -23,7 +23,7 @@
 from PyQt4 import QtCore, QtGui
 
 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, \
     EventManager, RenderManager, PluginConfig
 from openlp.core import PluginManager
@@ -50,6 +50,7 @@
         self.alertForm = AlertForm(self)
         self.aboutForm = AboutForm()
         self.settingsForm = SettingsForm(self.screenList, self)
+        self.slideControllerManager = SlideControllerManager()
         # Set up the path with plugins
         pluginpath = os.path.split(os.path.abspath(__file__))[0]
         pluginpath = os.path.abspath(
@@ -167,8 +168,11 @@
         self.ControlSplitter.setObjectName(u'ControlSplitter')
         self.MainContentLayout.addWidget(self.ControlSplitter)
         # Create slide controllers
-        self.PreviewController = SlideController(self.ControlSplitter, self)
-        self.LiveController = SlideController(self.ControlSplitter, self, True)
+        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')
         # 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-20 19:11:17 +0000
+++ openlp/core/ui/servicemanager.py	2009-06-26 16:39:16 +0000
@@ -280,6 +280,9 @@
         self.service_theme = self.ThemeComboBox.currentText()
         self.parent.RenderManager.set_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:
             tempServiceItems = self.serviceItems
             self.onNewService()
@@ -368,3 +371,4 @@
             self.service_theme = u''
         self.ThemeComboBox.setCurrentIndex(id)
         self.parent.RenderManager.set_service_theme(self.service_theme)
+        self.regenerateServiceItems()

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2009-06-19 19:49:00 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2009-06-26 17:51:43 +0000
@@ -41,6 +41,9 @@
             QtGui.QIcon.Normal, QtGui.QIcon.Off)
         #Register the bible Manager
         self.biblemanager = BibleManager(self.config)
+        # passed with drag and drop messages
+        self.dnd_id = u'Bibles'
+
 
     def get_settings_tab(self):
         self.bibles_tab = BiblesTab()
@@ -79,12 +82,4 @@
         if event.event_type == EventType.ThemeListChanged:
             log.debug(u'New Theme request received')
             self.bibles_tab.updateThemeList(self.theme_manager.getThemes())
-        if event.event_type == EventType.LoadServiceItem and event.payload == 'Bibles':
-            log.debug(u'Load Service Item received')
-            self.media_item.onBibleAddClick()
-        if event.event_type == EventType.PreviewShow and event.payload == 'Bibles':
-            log.debug(u'Load Preview Item received')
-            self.media_item.onBiblePreviewClick()
-        if event.event_type == EventType.LiveShow and event.payload == 'Bibles':
-            log.debug(u'Load Live Show Item received')
-            self.media_item.onBibleLiveClick()
+        Plugin.handle_event(self, event)

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2009-06-23 16:25:40 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2009-06-26 17:51:43 +0000
@@ -54,6 +54,11 @@
     log.info(u'Bible Media Item loaded')
 
     def __init__(self, parent, icon, title):
+        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(),
@@ -74,18 +79,18 @@
         self.addToolbarButton(
             translate(u'BibleMediaItem',u'Preview Bible'),
             translate(u'BibleMediaItem',u'Preview the selected Bible Verse'),
-            u':/system/system_preview.png', self.onBiblePreviewClick, u'BiblePreviewItem')
+            u':/system/system_preview.png', self.onPreviewClick, u'BiblePreviewItem')
         ## Live Bible Button ##
         self.addToolbarButton(
             translate(u'BibleMediaItem',u'Go Live'),
             translate(u'BibleMediaItem',u'Send the selected Bible Verse(s) live'),
-            u':/system/system_live.png', self.onBibleLiveClick, u'BibleLiveItem')
+            u':/system/system_live.png', self.onLiveClick, u'BibleLiveItem')
         ## Add Bible Button ##
         self.addToolbarButton(
             translate(u'BibleMediaItem',u'Add Bible Verse(s) To Service'),
             translate(u'BibleMediaItem',u'Add the selected Bible(s) to the service'),
             u':/system/system_add.png',
-            self.onBibleAddClick, u'BibleAddItem')
+            self.onAddClick, u'BibleAddItem')
         # Create the tab widget
         self.SearchTabWidget = QtGui.QTabWidget(self)
         sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
@@ -209,18 +214,18 @@
         QtCore.QObject.connect(self.QuickSearchButton,
             QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton)
         QtCore.QObject.connect(self.BibleListWidget,
-            QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onBiblePreviewClick)
+            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',
-            translate(u'BibleMediaItem',u'&Preview Verse'), self.onBiblePreviewClick))
+            translate(u'BibleMediaItem',u'&Preview Verse'), self.onPreviewClick))
         self.BibleListWidget.addAction(self.contextMenuAction(
             self.BibleListWidget, u':/system/system_live.png',
-            translate(u'BibleMediaItem',u'&Show Live'), self.onBibleLiveClick))
+            translate(u'BibleMediaItem',u'&Show Live'), self.onLiveClick))
         self.BibleListWidget.addAction(self.contextMenuAction(
             self.BibleListWidget, u':/system/system_add.png',
-            translate(u'BibleMediaItem',u'&Add to Service'), self.onBibleAddClick))
+            translate(u'BibleMediaItem',u'&Add to Service'), self.onAddClick))
 
     def retranslateUi(self):
         log.debug(u'retranslateUi')
@@ -330,23 +335,23 @@
         if self.search_results is not None:
             self.displayResults(bible)
 
-    def onBibleLiveClick(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 onBibleAddClick(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 onBiblePreviewClick(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 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')

=== modified file 'openlp/plugins/custom/customplugin.py'
--- openlp/plugins/custom/customplugin.py	2009-06-17 05:11:16 +0000
+++ openlp/plugins/custom/customplugin.py	2009-06-26 17:51:43 +0000
@@ -42,6 +42,8 @@
         self.icon = QtGui.QIcon()
         self.icon.addPixmap(QtGui.QPixmap(u':/media/media_custom.png'),
             QtGui.QIcon.Normal, QtGui.QIcon.Off)
+        # passed with drag and drop messages
+        self.dnd_id=u'Custom'
 
     def get_media_manager_item(self):
         # Create the CustomManagerItem object
@@ -56,12 +58,4 @@
         if event.event_type == EventType.ThemeListChanged:
             log.debug(u'New Theme request received')
             self.edit_custom_form.loadThemes(self.theme_manager.getThemes())
-        if event.event_type == EventType.LoadServiceItem and event.payload == 'Custom':
-            log.debug(u'Load Service Item received')
-            self.media_item.onCustomAddClick()
-        if event.event_type == EventType.PreviewShow and event.payload == 'Custom':
-            log.debug(u'Load Preview Item received ')
-            self.media_item.onCustomPreviewClick()
-        if event.event_type == EventType.LiveShow and event.payload == 'Custom':
-            log.debug(u'Load Live Show Item received')
-            self.media_item.onCustomLiveClick()
+        Plugin.handle_event(self, event)

=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py	2009-06-19 18:41:38 +0000
+++ openlp/plugins/custom/lib/mediaitem.py	2009-06-26 18:54:05 +0000
@@ -53,6 +53,9 @@
     log.info(u'Custom Media Item loaded')
 
     def __init__(self, parent, icon, title):
+        self.TranslationContext = u'CustomPlugin'
+        self.PluginTextShort = u'Custom'
+        self.ConfigSection = u'custom'
         MediaManagerItem.__init__(self, parent, icon, title)
         self.parent = parent
 

=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py	2009-06-24 20:15:24 +0000
+++ openlp/plugins/images/imageplugin.py	2009-06-26 17:51:43 +0000
@@ -37,7 +37,8 @@
         self.icon = QtGui.QIcon()
         self.icon.addPixmap(QtGui.QPixmap(u':/media/media_image.png'),
             QtGui.QIcon.Normal, QtGui.QIcon.Off)
-        self.dnd_id = u'Image' # passed with drag and drop messages
+        # passed with drag and drop messages
+        self.dnd_id = u'Image'
 
     def get_media_manager_item(self):
         # Create the MediaManagerItem object

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2009-06-25 20:01:02 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2009-06-26 16:39:16 +0000
@@ -32,7 +32,7 @@
     def __init__(self, parent=None):
         self.PluginName = u'Image'
         BaseListWithDnD.__init__(self, parent)
-        
+
 class ImageMediaItem(MediaManagerItem):
     """
     This is the custom media manager item for images.
@@ -49,10 +49,9 @@
         self.OnNewFileMasks = u'Images (*.jpg *jpeg *.gif *.png *.bmp)'
         # this next is a class, not an instance of a class - it will
         # be instanced by the base MediaManagerItem
-        self.ListViewWithDnD_class = ImageListView 
+        self.ListViewWithDnD_class = ImageListView
         MediaManagerItem.__init__(self, parent, icon, title)
 
-
     def generateSlideData(self, service_item):
         indexes = self.ListView.selectedIndexes()
         service_item.title = u'Image(s)'

=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py	2009-06-16 18:21:24 +0000
+++ openlp/plugins/media/mediaplugin.py	2009-06-26 17:51:43 +0000
@@ -33,6 +33,8 @@
         self.icon = QtGui.QIcon()
         self.icon.addPixmap(QtGui.QPixmap(u':/media/media_video.png'),
             QtGui.QIcon.Normal, QtGui.QIcon.Off)
+        # passed with drag and drop messages
+        self.dnd_id=u'Media'
 
     def get_settings_tab(self):
         self.MediaTab = MediaTab()

=== modified file 'openlp/plugins/presentations/lib/__init__.py'
--- openlp/plugins/presentations/lib/__init__.py	2009-05-18 16:04:34 +0000
+++ openlp/plugins/presentations/lib/__init__.py	2009-06-25 19:42:22 +0000
@@ -21,5 +21,6 @@
 from filelistdata import FileListData
 from mediaitem import PresentationMediaItem
 from presentationtab import PresentationTab
+from impresscom import Openoffice
 
-__all__ = ['PresentationMediaItem', 'FileListData', 'PresentationTab']
+__all__ = ['PresentationMediaItem', 'FileListData', 'PresentationTab', 'OpenOffice']

=== modified file 'openlp/plugins/presentations/lib/impresscom.py'
--- openlp/plugins/presentations/lib/impresscom.py	2009-06-23 16:25:40 +0000
+++ openlp/plugins/presentations/lib/impresscom.py	2009-06-26 19:06:28 +0000
@@ -1,5 +1,22 @@
-#from win32com.client import Dispatch
-
+# -*- 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
+"""
 # OOo API documentation:
 # http://api.openoffice.org/docs/common/ref/com/sun/star/presentation/XSlideShowController.html
 # http://docs.go-oo.org/sd/html/classsd_1_1SlideShow.html
@@ -7,15 +24,65 @@
 # http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Working_with_Presentations
 # http://mail.python.org/pipermail/python-win32/2008-January/006676.html
 
-class ImpressCOMApp(object):
+import os ,  subprocess
+import time
+import uno
+
+class Openoffice(object):
     def __init__(self):
+        self.startOpenoffice()
+
+    def createResolver(self):
+        self.localContext = uno.getComponentContext()
+        self.resolver = self.localContext.ServiceManager.createInstanceWithContext(u'com.sun.star.bridge.UnoUrlResolver', self.localContext)
+        try:
+            self.ctx = self.resolver.resolve(u'uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext')
+        except:
+            return False
+        return True
+
+    def buildEnvironment(self):
+        self.smgr = self.ctx.ServiceManager
+        self.desktop = self.smgr.createInstanceWithContext( "com.sun.star.frame.Desktop", self.ctx )
+        self.model = self.desktop.getCurrentComponent()
+        text = self.model.Text
+        cursor = text.createTextCursor()
+        text.insertString(cursor, "Hello world", 0)
+        self.ctx.ServiceManager
         self.createApp()
+        if self._sm == None:
+            # start OO here
+            # Create output log file
+            time.sleep(10)
+            self.createApp()
+
+    def startOpenoffice(self):
+        cmd = u'openoffice.org -nologo -norestore -minimized -impress' + u'"' + u'-accept=socket,host=localhost,port=2002;urp;'+ u'"'
+        retval = subprocess.Popen(cmd,  shell=True)
+        self.oopid = retval.pid
+
+    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))
+            file = procfile.readline().split()[1]
+            print file
+            if file == u'(soffice)' or file == u'(openoffice.org)':
+                return True
+            return False
 
     def createApp(self):
         try:
-            self._sm = Dispatch(u'com.sun.star.ServiceManager')
             self._app = self._sm.createInstance( "com.sun.star.frame.Desktop" )
+            print "started"
         except:
+            print "oops"
             self._sm = None
             self._app = None
             return
@@ -35,6 +102,7 @@
         self._sm = None
 
 class ImpressCOMPres(object):
+
     def __init__(self, oooApp, filename):
         self.oooApp = oooApp
         self.filename = filename
@@ -111,8 +179,9 @@
         return self.preview
 
 if __name__ == '__main__':
-    ooo = ImpressCOMApp()
-    show = ImpressCOMPres(ooo, u'c:/test1.ppt')
-    show.go()
-    show.resume()
-    show.nextStep()
+    ooo = Openoffice()
+    ooo.createResolver()
+    #show = ImpressCOMPres(ooo, u'/home/timali/test1.odp')
+    #show.go()
+    #show.resume()
+    #show.nextStep()

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2009-06-16 18:21:24 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2009-06-26 16:39:16 +0000
@@ -21,8 +21,15 @@
 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 @@
     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 @@
         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 @@
             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
\ No newline at end of file

=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py	2009-06-16 18:21:24 +0000
+++ openlp/plugins/presentations/presentationplugin.py	2009-06-25 19:42:22 +0000
@@ -19,16 +19,21 @@
 """
 
 import os
+import logging
 
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import Plugin,  MediaManagerItem
-from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab
+from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab,  Openoffice
 
 class PresentationPlugin(Plugin):
 
+    global log
+    log = logging.getLogger(u'PresentationPlugin')
+
     def __init__(self, plugin_helpers):
         # Call the parent constructor
+        log.debug('Initialised')
         Plugin.__init__(self, u'Presentations', u'1.9.0', plugin_helpers)
         self.weight = -8
         # Create the plugin icon
@@ -43,4 +48,9 @@
     def get_media_manager_item(self):
         # Create the MediaManagerItem object
         self.media_item = PresentationMediaItem(self, self.icon, u'Presentations')
-        return self.media_item
\ No newline at end of file
+        return self.media_item
+
+    def check_pre_conditions(self):
+        log.debug('check_pre_conditions')
+        self.openoffice = Openoffice()
+        return self.openoffice.checkOoPid()

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2009-06-21 17:45:59 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2009-06-26 18:54:05 +0000
@@ -54,6 +54,9 @@
     log.info(u'Song Media Item loaded')
 
     def __init__(self, parent, icon, title):
+        self.TranslationContext = u'SongPlugin'
+        self.PluginTextShort = u'Song'
+        self.ConfigSection = u'song'
         MediaManagerItem.__init__(self, parent, icon, title)
         self.edit_song_form = EditSongForm(self.parent.songmanager, self.parent.event_manager)
 

=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py	2009-06-23 15:48:31 +0000
+++ openlp/plugins/songs/songsplugin.py	2009-06-26 18:54:05 +0000
@@ -45,6 +45,8 @@
         self.icon = QtGui.QIcon()
         self.icon.addPixmap(QtGui.QPixmap(u':/media/media_song.png'),
             QtGui.QIcon.Normal, QtGui.QIcon.Off)
+        # passed with drag and drop messages
+        self.dnd_id=u'Song'
 
     def get_media_manager_item(self):
         # Create the MediaManagerItem object
@@ -125,15 +127,7 @@
         if event.event_type == EventType.ThemeListChanged:
             log.debug(u'New Theme request received')
             self.media_item.edit_song_form.loadThemes(self.theme_manager.getThemes())
-        if event.event_type == EventType.LoadServiceItem and event.payload == 'Song':
-            log.debug(u'Load Service Item received')
-            self.media_item.onSongAddClick()
-        if event.event_type == EventType.PreviewShow and event.payload == 'Song':
-            log.debug(u'Load Preview Item received ')
-            self.media_item.onSongPreviewClick()
-        if event.event_type == EventType.LiveShow and event.payload == 'Song':
-            log.debug(u'Load Live Show Item received')
-            self.media_item.onSongLiveClick()
         if event.event_type == EventType.LoadSongList :
             log.debug(u'Load Load Song List Item received')
             self.media_item.displayResultsSong(self.songmanager.get_songs())
+        Plugin.handle_event(self, event)


Follow ups