← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bugfixes into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bugfixes into lp:openlp.

Requested reviews:
    openlp.org Core (openlp-core)

Various fixes all over the shop.
Plugins now work with nothing selected
ServiceManager saves and Loads presentations
Blank lines work in songs.
Logging is more configurable

-- 
https://code.launchpad.net/~trb143/openlp/bugfixes/+merge/11001
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw	2009-08-24 04:30:04 +0000
+++ openlp.pyw	2009-09-01 05:17:32 +0000
@@ -20,7 +20,8 @@
 """
 
 import sys
-import logging
+import logging, logging.handlers
+from optparse import OptionParser
 
 from PyQt4 import QtCore, QtGui
 
@@ -28,9 +29,15 @@
 from openlp.core.resources import *
 from openlp.core.ui import MainWindow, SplashScreen
 
-logging.basicConfig(level=logging.DEBUG,
-    format=u'%(asctime)s:%(msecs)3d %(name)-15s %(levelname)-8s %(message)s',
-    datefmt=u'%m-%d %H:%M:%S', filename=u'openlp.log', filemode=u'w')
+filename=u'openlp.log'
+log = logging.getLogger()
+log.setLevel(logging.INFO)
+
+logfile = logging.handlers.RotatingFileHandler(filename ,maxBytes=200000, backupCount=5)
+logfile.setLevel(logging.DEBUG)
+logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
+
+log.addHandler(logfile)
 
 class OpenLP(QtGui.QApplication):
     """
@@ -38,8 +45,7 @@
     class in order to provide the core of the application.
     """
     global log
-    log = logging.getLogger(u'OpenLP Application')
-    log.info(u'Application Loaded')
+    log.info(u'OpenLP Application Loaded')
 
     def run(self):
         """
@@ -74,10 +80,19 @@
         self.splash.finish(self.mainWindow)
         sys.exit(app.exec_())
 
+def main():
+    usage = "usage: %prog [options] arg1 arg2"
+    parser = OptionParser(usage=usage)
+    parser.add_option("-d", "--debug",dest="debug",action="store_true",
+                      help="Switch on Debugging ")
+    (options, args) = parser.parse_args()
+    if options.debug is not None:
+        log.setLevel(logging.DEBUG)
 if __name__ == u'__main__':
     """
     Instantiate and run the application.
     """
+    main()
     app = OpenLP(sys.argv)
     #import cProfile
     #cProfile.run("app.run()", "profile.out")

=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2009-08-26 05:00:19 +0000
+++ openlp/core/lib/__init__.py	2009-08-27 05:17:20 +0000
@@ -66,6 +66,7 @@
 from xmlrootclass import XmlRootClass
 from serviceitem import ServiceItem
 from eventreceiver import Receiver
+from serviceitem import ServiceType
 from serviceitem import ServiceItem
 from toolbar import OpenLPToolbar
 from songxmlhandler import SongXMLBuilder

=== modified file 'openlp/core/lib/eventreceiver.py'
--- openlp/core/lib/eventreceiver.py	2009-08-26 05:00:19 +0000
+++ openlp/core/lib/eventreceiver.py	2009-08-29 07:17:56 +0000
@@ -29,27 +29,31 @@
 
     ``stop_import``
         Stops the Bible Import
+
     ``pre_load_bibles``
         Triggers the plugin to relaod the bible lists
+
     ``process_events``
         Requests the Application to flush the events queue
-    ``{preview|live}_slide_first``
-        display the first slide on the list
-    ``{preview|live}_slide_previous``
-        display the previous slide on the list
-    ``{preview|live}_slide_next``
-        display the next slide on the list
-    ``{preview|live}_slide_last``
-        display the last slide on the list
+
     ``{plugin}_add_service_item ``
         ask the plugin to push the selected items to the service item
+
     ``update_themes ``
         send out message with new themes
+
     ``update_global_theme ``
         Tell the components we have a new global theme
+
     ``load_song_list``
         Tells the the song plugin to reload the song list
 
+    ``update_spin_delay``
+        Pushes out the Image loop delay
+
+    ``request_spin_delay``
+        Requests a spin delay
+
     """
     global log
     log = logging.getLogger(u'EventReceiver')

=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2009-07-08 16:40:42 +0000
+++ openlp/core/lib/mediamanageritem.py	2009-08-31 21:53:35 +0000
@@ -234,17 +234,20 @@
     def onPreviewClick(self):
         log.debug(self.PluginTextShort+u' Preview Requested')
         service_item = self.buildServiceItem()
-        self.parent.preview_controller.addServiceItem(service_item)
+        if service_item is not None:
+            self.parent.preview_controller.addServiceItem(service_item)
 
     def onLiveClick(self):
         log.debug(self.PluginTextShort + u' Live Requested')
         service_item = self.buildServiceItem()
-        self.parent.live_controller.addServiceItem(service_item)
+        if service_item is not None:
+            self.parent.live_controller.addServiceItem(service_item)
 
     def onAddClick(self):
         log.debug(self.PluginTextShort+u' Add Requested')
         service_item = self.buildServiceItem()
-        self.parent.service_manager.addServiceItem(service_item)
+        if service_item is not None:
+            self.parent.service_manager.addServiceItem(service_item)
 
     def buildServiceItem(self):
         """
@@ -252,6 +255,8 @@
         """
         service_item = ServiceItem(self.parent)
         service_item.addIcon(u':/media/media_'+self.PluginTextShort.lower()+u'.png')
-        self.generateSlideData(service_item)
-        self.ListView.clearSelection()
-        return service_item
+        if self.generateSlideData(service_item):
+            self.ListView.clearSelection()
+            return service_item
+        else:
+            return None

=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py	2009-08-09 18:38:44 +0000
+++ openlp/core/lib/renderer.py	2009-08-31 06:53:55 +0000
@@ -147,7 +147,8 @@
 #        print words
         verses = []
         words = words.replace(u'\r\n', u'\n')
-        verses_text = words.split(u'\n\n')
+        verses_text = words.split(u'\n')
+        #print verses_text
         text = []
         for verse in verses_text:
             lines = verse.split(u'\n')
@@ -173,7 +174,10 @@
         split_lines = []
         count = 0
         for line in text:
-#            print "C", line ,  len(line)
+            #print "C", line ,  len(line)
+            #Must be a blank line so keep it.
+            if len(line) == 0:
+                line = u' '
             while len(line) > 0:
 #                print "C1", line ,  len(line)
                 if len(line) > ave_line_width:
@@ -391,29 +395,8 @@
             Defaults to *False*. Whether or not this is a live screen.
         """
         x, y = tlcorner
-        # We draw the text to see how big it is and then iterate to make it fit
-        # when we line wrap we do in in the "lyrics" style, so the second line is
-        # right aligned with a "hanging indent"
-        #print "----------------------------"
-        #print line
-#        words = line.split(u' ')
-#        thisline = u' '.join(words)
-#        lastword = len(words)
-#        lines = []
         maxx = self._rect.width();
         maxy = self._rect.height();
-#        while (len(words) > 0):
-#            w , h = self._get_extent_and_render(thisline, footer)
-#            print "m", w, h, x, maxx
-#            rhs = w + x
-#            if rhs < maxx - self._right_margin:
-#                lines.append(thisline)
-#                words = words[lastword:]
-#                thisline = ' '.join(words)
-#                lastword = len(words)
-#            else:
-#                lastword -= 1
-#                thisline = ' '.join(words[:lastword])
         lines = []
         lines.append(line)
         startx = x

=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py	2009-07-23 20:20:49 +0000
+++ openlp/core/lib/rendermanager.py	2009-08-31 06:53:55 +0000
@@ -58,7 +58,7 @@
         else:
             self.current_display = screen_number
         self.renderer = Renderer()
-        self.calculate_default(self.screen_list[self.current_display][u'size'])
+        #self.calculate_default(self.screen_list[self.current_display][u'size'])
         self.theme = u''
         self.service_theme = u''
         self.global_style = u''
@@ -133,6 +133,7 @@
     def build_text_rectangle(self, theme):
         """
         Builds a text block using the settings in ``theme``.
+        One is needed per slide
 
         ``theme``
             The theme to build a text block for.
@@ -149,8 +150,8 @@
             footer_rect = QtCore.QRect(10,self.footer_start, self.width - 1, self.height-self.footer_start)
         else:
             footer_rect = QtCore.QRect(int(theme.font_footer_x),int(theme.font_footer_y),
-                int(theme.font_footer_width)-1, int(theme.font_footer_height)-1)
-        self.renderer.set_text_rectangle(main_rect,footer_rect)
+                int(theme.font_footer_width)-1, int(theme.font_footer_height) - 1)
+        self.renderer.set_text_rectangle(main_rect, footer_rect)
 
     def generate_preview(self, themedata):
         """
@@ -178,15 +179,15 @@
 
     def format_slide(self, words):
         """
-        Calculate how much text can fid on a slide.
+        Calculate how much text can fit on a slide.
 
         ``words``
             The words to go on the slides.
         """
         log.debug(u'format slide')
-        self.calculate_default(self.screen_list[self.current_display][u'size'])
+        #self.calculate_default(self.screen_list[self.current_display][u'size'])
         self.build_text_rectangle(self.themedata)
-        self.renderer.set_frame_dest(self.width, self.height)
+        #self.renderer.set_frame_dest(self.width, self.height)
         return self.renderer.format_slide(words, False)
 
     def generate_slide(self, main_text, footer_text):
@@ -200,7 +201,6 @@
             The text for the slide footer.
         """
         log.debug(u'generate slide')
-        self.calculate_default(self.screen_list[self.current_display][u'size'])
         self.build_text_rectangle(self.themedata)
         self.renderer.set_frame_dest(self.width, self.height)
         return self.renderer.generate_frame_from_lines(main_text, footer_text)
@@ -233,6 +233,7 @@
             The QWidget instance of the screen.
         """
         log.debug(u'calculate default %s', screen)
+        #size fixed so reflects the preview size.
         if self.current_display == 0:
             self.width = 1024
             self.height = 768

=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2009-07-10 13:16:15 +0000
+++ openlp/core/lib/serviceitem.py	2009-08-31 18:27:36 +0000
@@ -25,6 +25,11 @@
 
 from openlp.core.lib import buildIcon
 
+class ServiceType(object):
+    Text = 1
+    Image = 2
+    Command = 3
+
 class ServiceItem(object):
     """
     The service item is a base class for the plugins to use to interact with
@@ -83,22 +88,18 @@
             self.RenderManager.set_override_theme(self.theme)
         log.debug(u'Formatting slides')
         self.frames = []
-        if self.service_item_type == u'text':
+        if self.service_item_type == ServiceType.Text:
             for slide in self.service_frames:
                 formated = self.RenderManager.format_slide(slide[u'raw_slide'])
                 for format in formated:
                     frame = self.RenderManager.generate_slide(format, self.raw_footer)
                     self.frames.append({u'title': slide[u'title'], u'image': frame})
-        elif self.service_item_type == u'command':
+        elif self.service_item_type == ServiceType.Command:
             self.frames = self.service_frames
-            self.service_frames = []
-        elif self.service_item_type == u'image':
-            #print "image"
-            #print self.service_frames
+        elif self.service_item_type == ServiceType.Image:
             for slide in self.service_frames:
                 slide[u'image'] = self.RenderManager.resize_image(slide[u'image'])
             self.frames = self.service_frames
-            #self.service_frames = []
         else:
             log.error(u'Invalid value renderer :%s' % self.service_item_type)
 
@@ -115,7 +116,7 @@
         ``image``
             The actual image file name.
         """
-        self.service_item_type = u'image'
+        self.service_item_type = ServiceType.Image
         self.service_item_path = path
         self.service_frames.append({u'title': frame_title, u'image': image})
 
@@ -129,11 +130,11 @@
         ``raw_slide``
             The raw text of the slide.
         """
-        self.service_item_type = u'text'
+        self.service_item_type = ServiceType.Text
         frame_title = frame_title.split(u'\n')[0]
         self.service_frames.append({u'title': frame_title, u'raw_slide': raw_slide})
 
-    def add_from_command(self, frame_title, command):
+    def add_from_command(self, path , frame_title):
         """
         Add a slide from a command.
 
@@ -143,8 +144,9 @@
         ``command``
             The command of/for the slide.
         """
-        self.service_item_type = u'command'
-        self.service_frames.append({u'title': frame_title, u'command': command})
+        self.service_item_type = ServiceType.Command
+        self.service_item_path = path
+        self.service_frames.append({u'title': frame_title, u'command':  None})
 
     def get_oos_repr(self):
         """
@@ -160,15 +162,15 @@
             u'type':self.service_item_type
         }
         oos_data = []
-        if self.service_item_type == u'text':
+        if self.service_item_type == ServiceType.Text:
             for slide in self.service_frames:
                 oos_data.append(slide)
-        elif self.service_item_type == u'image':
-            #print "sf", self.service_frames
-            for slide in self.service_frames:
-                #print "s", slide
-                oos_data.append(slide[u'title'])
-        #print "od", oos_data
+        elif self.service_item_type == ServiceType.Image:
+            for slide in self.service_frames:
+                oos_data.append(slide[u'title'])
+        elif self.service_item_type == ServiceType.Command:
+            for slide in self.service_frames:
+                oos_data.append(slide[u'title'])
         return {u'header': oos_header, u'data': oos_data}
 
     def set_from_oos(self, serviceitem, path=None):
@@ -182,7 +184,6 @@
         ``path``
             Defaults to *None*. Any path data, usually for images.
         """
-        #print "sfs", serviceitem
         header = serviceitem[u'serviceitem'][u'header']
         self.title = header[u'title']
         self.service_item_type = header[u'type']
@@ -190,12 +191,15 @@
         self.theme = header[u'theme']
         self.addIcon(header[u'icon'])
         self.raw_footer = header[u'footer']
-        if self.service_item_type == u'text':
+        if self.service_item_type == ServiceType.Text:
             for slide in serviceitem[u'serviceitem'][u'data']:
                 self.service_frames.append(slide)
-        elif self.service_item_type == u'image':
+        elif self.service_item_type == ServiceType.Image:
             for text_image in serviceitem[u'serviceitem'][u'data']:
                 filename = os.path.join(path, text_image)
-                #print "fn",  filename
                 real_image = QtGui.QImage(unicode(filename))
                 self.add_from_image(path, text_image, real_image)
+        elif self.service_item_type == ServiceType.Command:
+            for text_image in serviceitem[u'serviceitem'][u'data']:
+                filename = os.path.join(path, text_image)
+                self.add_from_command(path, text_image)

=== modified file 'openlp/core/lib/settingstab.py'
--- openlp/core/lib/settingstab.py	2009-07-10 13:16:15 +0000
+++ openlp/core/lib/settingstab.py	2009-08-29 07:17:56 +0000
@@ -93,3 +93,9 @@
         Save settings to disk.
         """
         pass
+
+    def postSetUp(self):
+        """
+        Changes which need to be made after setup of application
+        """
+        pass

=== modified file 'openlp/core/lib/toolbar.py'
--- openlp/core/lib/toolbar.py	2009-07-08 06:55:08 +0000
+++ openlp/core/lib/toolbar.py	2009-08-28 17:40:07 +0000
@@ -34,8 +34,9 @@
         QtGui.QToolBar.__init__(self, None)
         # useful to be able to reuse button icons...
         self.icons = {}
+        self.actions = {}
         self.log = logging.getLogger(u'OpenLPToolbar')
-        self.log.info(u'Init done')
+        self.log.debug(u'Init done')
 
     def addToolbarButton(self, title, icon, tooltip=None, slot=None, objectname=None):
         """
@@ -70,12 +71,28 @@
                 ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
                     QtGui.QIcon.Normal, QtGui.QIcon.Off)
         if ButtonIcon is not None:
-            ToolbarButton = self.addAction(ButtonIcon, title)
+            if slot is not None:
+                ToolbarButton = self.addAction(ButtonIcon, title, slot)
+            else:
+                ToolbarButton = self.addAction(ButtonIcon, title)
             if tooltip is not None:
                 ToolbarButton.setToolTip(tooltip)
-            if slot is not None:
-                QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL(u'triggered()'), slot)
             self.icons[title] = ButtonIcon
+            self.actions[title] = ToolbarButton
+
+    def addToolbarSeparator(self, handle):
+        """
+        Add a Separator bar to the toolbar and store it's Handle
+        """
+        action = self.addSeparator()
+        self.actions[handle] = action
+
+    def addToolbarWidget(self, handle, widget):
+        """
+        Add a Widget to the toolbar and store it's Handle
+        """
+        action = self.addWidget(widget)
+        self.actions[handle] = action
 
     def getIconFromTitle(self, title):
         """
@@ -90,3 +107,11 @@
         else:
             self.log.error(u'getIconFromTitle - no icon for %s' % title)
             return QtGui.QIcon()
+
+    def makeWidgetsInvisible(self, widgets):
+        for widget in widgets:
+            self.actions[widget].setVisible(False)
+
+    def makeWidgetsVisible(self, widgets):
+        for widget in widgets:
+            self.actions[widget].setVisible(True)

=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py	2009-08-13 20:02:38 +0000
+++ openlp/core/ui/__init__.py	2009-08-27 05:17:20 +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 slidecontroller import MasterToolbar
+#from slidecontroller import MasterToolbar
 from maindisplay import MainDisplay
 from amendthemeform import AmendThemeForm
 from slidecontroller import SlideController

=== modified file 'openlp/core/ui/amendthemeform.py'
--- openlp/core/ui/amendthemeform.py	2009-08-26 05:00:19 +0000
+++ openlp/core/ui/amendthemeform.py	2009-08-31 07:05:59 +0000
@@ -135,8 +135,8 @@
                 unicode(self.theme.display_horizontalAlign), unicode(self.theme.display_verticalAlign),
                 unicode(self.theme.display_wrapStyle))
         theme = new_theme.extract_xml()
-        self.thememanager.saveTheme(theme_name, theme, save_from, save_to)
-        return QtGui.QDialog.accept(self)
+        if self.thememanager.saveTheme(theme_name, theme, save_from, save_to) is not False:
+            return QtGui.QDialog.accept(self)
 
     def loadTheme(self, theme):
         log.debug(u'LoadTheme %s', theme)
@@ -510,45 +510,60 @@
         self.VerticalComboBox.setCurrentIndex(int(self.theme.display_verticalAlign))
 
     def stateChanging(self, theme):
-        if theme.background_type == u'solid':
-            self.Color1PushButton.setStyleSheet(
-                u'background-color: %s' % unicode(theme.background_color))
-            self.Color1Label.setText(translate(u'ThemeManager', u'Background Color:'))
-            self.Color1Label.setVisible(True)
-            self.Color1PushButton.setVisible(True)
-            self.Color2Label.setVisible(False)
-            self.Color2PushButton.setVisible(False)
-            self.ImageLabel.setVisible(False)
-            self.ImageLineEdit.setVisible(False)
-            self.ImageFilenameWidget.setVisible(False)
-            self.GradientLabel.setVisible(False)
-            self.GradientComboBox.setVisible(False)
-        elif theme.background_type == u'gradient':
-            self.Color1PushButton.setStyleSheet(
-                u'background-color: %s' % unicode(theme.background_startColor))
-            self.Color2PushButton.setStyleSheet(
-                u'background-color: %s' % unicode(theme.background_endColor))
-            self.Color1Label.setText(translate(u'ThemeManager', u'First  Color:'))
-            self.Color2Label.setText(translate(u'ThemeManager', u'Second Color:'))
-            self.Color1Label.setVisible(True)
-            self.Color1PushButton.setVisible(True)
-            self.Color2Label.setVisible(True)
-            self.Color2PushButton.setVisible(True)
-            self.ImageLabel.setVisible(False)
-            self.ImageLineEdit.setVisible(False)
-            self.ImageFilenameWidget.setVisible(False)
-            self.GradientLabel.setVisible(True)
-            self.GradientComboBox.setVisible(True)
-        else: # must be image
-            self.Color1Label.setVisible(False)
-            self.Color1PushButton.setVisible(False)
-            self.Color2Label.setVisible(False)
-            self.Color2PushButton.setVisible(False)
-            self.ImageLabel.setVisible(True)
-            self.ImageLineEdit.setVisible(True)
-            self.ImageFilenameWidget.setVisible(True)
-            self.GradientLabel.setVisible(False)
-            self.GradientComboBox.setVisible(False)
+        if theme.background_mode == u'transparent':
+                self.Color1Label.setVisible(False)
+                self.Color1PushButton.setVisible(False)
+                self.Color2Label.setVisible(False)
+                self.Color2PushButton.setVisible(False)
+                self.ImageLabel.setVisible(False)
+                self.ImageLineEdit.setVisible(False)
+                self.ImageFilenameWidget.setVisible(False)
+                self.GradientLabel.setVisible(False)
+                self.GradientComboBox.setVisible(False)
+                self.BackgroundTypeComboBox.setVisible(False)
+                self.BackgroundTypeLabel.setVisible(False)
+        else:
+            self.BackgroundTypeComboBox.setVisible(True)
+            self.BackgroundTypeLabel.setVisible(True)
+            if theme.background_type == u'solid':
+                self.Color1PushButton.setStyleSheet(
+                    u'background-color: %s' % unicode(theme.background_color))
+                self.Color1Label.setText(translate(u'ThemeManager', u'Background Color:'))
+                self.Color1Label.setVisible(True)
+                self.Color1PushButton.setVisible(True)
+                self.Color2Label.setVisible(False)
+                self.Color2PushButton.setVisible(False)
+                self.ImageLabel.setVisible(False)
+                self.ImageLineEdit.setVisible(False)
+                self.ImageFilenameWidget.setVisible(False)
+                self.GradientLabel.setVisible(False)
+                self.GradientComboBox.setVisible(False)
+            elif theme.background_type == u'gradient':
+                self.Color1PushButton.setStyleSheet(
+                    u'background-color: %s' % unicode(theme.background_startColor))
+                self.Color2PushButton.setStyleSheet(
+                    u'background-color: %s' % unicode(theme.background_endColor))
+                self.Color1Label.setText(translate(u'ThemeManager', u'First  Color:'))
+                self.Color2Label.setText(translate(u'ThemeManager', u'Second Color:'))
+                self.Color1Label.setVisible(True)
+                self.Color1PushButton.setVisible(True)
+                self.Color2Label.setVisible(True)
+                self.Color2PushButton.setVisible(True)
+                self.ImageLabel.setVisible(False)
+                self.ImageLineEdit.setVisible(False)
+                self.ImageFilenameWidget.setVisible(False)
+                self.GradientLabel.setVisible(True)
+                self.GradientComboBox.setVisible(True)
+            else: # must be image
+                self.Color1Label.setVisible(False)
+                self.Color1PushButton.setVisible(False)
+                self.Color2Label.setVisible(False)
+                self.Color2PushButton.setVisible(False)
+                self.ImageLabel.setVisible(True)
+                self.ImageLineEdit.setVisible(True)
+                self.ImageFilenameWidget.setVisible(True)
+                self.GradientLabel.setVisible(False)
+                self.GradientComboBox.setVisible(False)
 
         if theme.font_main_override == False:
             self.FontMainXSpinBox.setEnabled(False)

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2009-08-26 05:00:19 +0000
+++ openlp/core/ui/mainwindow.py	2009-08-29 07:17:56 +0000
@@ -313,8 +313,6 @@
             translate(u'mainWindow', u'Service Manager'))
         self.ThemeManagerDock.setWindowTitle(
             translate(u'mainWindow', u'Theme Manager'))
-        self.DefaultThemeLabel.setText(MainWindow.defaultThemeText + \
-            self.ThemeManagerContents.getDefault())
         self.FileNewItem.setText(translate(u'mainWindow', u'&New'))
         self.FileNewItem.setToolTip(translate(u'mainWindow', u'New Service'))
         self.FileNewItem.setStatusTip(
@@ -492,6 +490,8 @@
         # Once all components are initialised load the Themes
         log.info(u'Load Themes')
         self.ThemeManagerContents.loadThemes()
+        log.info(u'Load data from Settings')
+        self.settingsForm.postSetUp()
 
     def getMonitorNumber(self):
         """

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2009-08-25 05:18:09 +0000
+++ openlp/core/ui/servicemanager.py	2009-08-31 18:27:36 +0000
@@ -25,7 +25,7 @@
 
 from PyQt4 import QtCore, QtGui
 from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
-    RenderManager, translate, buildIcon, \
+    RenderManager, translate, buildIcon, ServiceType, \
     contextMenuAction, contextMenuSeparator,  Receiver
 from openlp.core.utils import ConfigHelper
 
@@ -341,7 +341,8 @@
             zip = zipfile.ZipFile(unicode(filename) + u'.oos', 'w')
             for item in self.serviceItems:
                 service.append({u'serviceitem':item[u'data'].get_oos_repr()})
-                if item[u'data'].service_item_type == u'image':
+                if item[u'data'].service_item_type == ServiceType.Image or \
+                        item[u'data'].service_item_type == ServiceType.Command:
                     for frame in item[u'data'].frames:
                         path_from = unicode(item[u'data'].service_item_path + u'/' + frame[u'title'])
                         zip.write(path_from)
@@ -354,7 +355,7 @@
                 os.remove(servicefile)
             except:
                 pass #if not present do not worry
-        self.parent.OosChanged(True, self.serviceName)
+        self.parent.OosChanged(True, filename + u'.oos')
 
     def onLoadService(self):
         """
@@ -368,31 +369,34 @@
         name = filename.split(os.path.sep)
         if filename != u'':
             self.config.set_last_dir(filename)
-            zip = zipfile.ZipFile(unicode(filename))
-            filexml = None
-            themename = None
-            for file in zip.namelist():
-                names = file.split(os.path.sep)
-                file_to = os.path.join(self.servicePath, names[len(names) - 1])
-                file_data = zip.read(file)
-                f = open(file_to, u'w')
-                f.write(file_data)
+            try:
+                zip = zipfile.ZipFile(unicode(filename))
+                filexml = None
+                themename = None
+                for file in zip.namelist():
+                    names = file.split(os.path.sep)
+                    file_to = os.path.join(self.servicePath, names[len(names) - 1])
+                    file_data = zip.read(file)
+                    f = open(file_to, u'w')
+                    f.write(file_data)
+                    f.close()
+                    if file_to.endswith(u'ood'):
+                        p_file = file_to
+                f = open(p_file, u'r')
+                items = cPickle.load(f)
                 f.close()
-                if file_to.endswith(u'ood'):
-                    p_file = file_to
-            f = open(p_file, u'r')
-            items = cPickle.load(f)
-            f.close()
-            self.onNewService()
-            for item in items:
-                serviceitem = ServiceItem()
-                serviceitem.RenderManager = self.parent.RenderManager
-                serviceitem.set_from_oos(item, self.servicePath )
-                self.addServiceItem(serviceitem)
-            try:
-                os.remove(p_file)
+                self.onNewService()
+                for item in items:
+                    serviceitem = ServiceItem()
+                    serviceitem.RenderManager = self.parent.RenderManager
+                    serviceitem.set_from_oos(item, self.servicePath )
+                    self.addServiceItem(serviceitem)
+                try:
+                    os.remove(p_file)
+                except:
+                    #if not present do not worry
+                    pass
             except:
-                #if not present do not worry
                 pass
         self.serviceName = name[len(name) - 1]
         self.parent.OosChanged(True, self.serviceName)

=== modified file 'openlp/core/ui/settingsform.py'
--- openlp/core/ui/settingsform.py	2009-08-06 13:17:36 +0000
+++ openlp/core/ui/settingsform.py	2009-08-29 07:17:56 +0000
@@ -51,3 +51,7 @@
         for tab_index in range(0, self.SettingsTabWidget.count()):
             self.SettingsTabWidget.widget(tab_index).save()
         return QtGui.QDialog.accept(self)
+
+    def postSetUp(self):
+        for tab_index in range(0, self.SettingsTabWidget.count()):
+            self.SettingsTabWidget.widget(tab_index).postSetUp()

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2009-08-24 05:10:04 +0000
+++ openlp/core/ui/slidecontroller.py	2009-08-31 14:04:00 +0000
@@ -21,7 +21,7 @@
 import os
 
 from PyQt4 import QtCore, QtGui
-from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver
+from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver, ServiceType
 
 class SlideList(QtGui.QTableWidget):
     """
@@ -36,16 +36,16 @@
         if type(event) == QtGui.QKeyEvent:
             #here accept the event and do something
             if event.key() == QtCore.Qt.Key_Up:
-                self.parent.BaseToolbar.onSlideSelectedPrevious()
+                self.parent.onSlideSelectedPrevious()
                 event.accept()
             elif event.key() == QtCore.Qt.Key_Down:
-                self.parent.BaseToolbar.onSlideSelectedNext()
+                self.parent.onSlideSelectedNext()
                 event.accept()
             elif event.key() == QtCore.Qt.Key_PageUp:
-                self.parent.BaseToolbar.onSlideSelectedFirst()
+                self.parent.onSlideSelectedFirst()
                 event.accept()
             elif event.key() == QtCore.Qt.Key_PageDown:
-                self.parent.BaseToolbar.onSlideSelectedLast()
+                self.parent.onSlideSelectedLast()
                 event.accept()
             event.ignore()
         else:
@@ -63,13 +63,11 @@
         """
         Set up the Slide Controller.
         """
-        self.toolbarList = {}
         QtGui.QWidget.__init__(self, parent)
         self.isLive = isLive
-        self.prefix  = u'preview_'
-        if isLive:
-            self.prefix  = u'live_'
         self.parent = parent
+        self.image_list = [u'Start Loop', u'Stop Loop', u'Loop Spearator', u'Image SpinBox']
+        self.timer_id = 0
         self.Panel = QtGui.QWidget(parent.ControlSplitter)
         self.Splitter = QtGui.QSplitter(self.Panel)
         self.Splitter.setOrientation(QtCore.Qt.Vertical)
@@ -96,10 +94,53 @@
         self.PreviewListWidget.isLive = self.isLive
         self.PreviewListWidget.setObjectName(u'PreviewListWidget')
         self.ControllerLayout.addWidget(self.PreviewListWidget)
-        # Plugin the Base Toolbar class
-        self.BaseToolbar = MasterToolbar(self.isLive)
-        self.registerToolbar(u'master', self.BaseToolbar)
-        self.Toolbar = self.BaseToolbar.getToolbar()
+        # Build the full toolbar
+        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'Previous Slide',
+            u':/slides/slide_previous.png',
+            translate(u'SlideController', u'Move to previous'),
+            self.onSlideSelectedPrevious)
+        self.Toolbar.addToolbarButton(u'Next 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)
+        if self.isLive:
+            self.Toolbar.addToolbarSeparator(u'Close Separator')
+            self.Toolbar.addToolbarButton(u'Close Screen',
+                u':/slides/slide_close.png',
+                translate(u'SlideController', u'Close Screen'),
+                self.onBlankScreen)
+        if isLive:
+            self.Toolbar.addToolbarSeparator(u'Loop Spearator')
+            self.Toolbar.addToolbarButton(u'Start Loop',
+                u':/media/media_time.png',
+                translate(u'SlideController', u'Start continuous loop'),
+                self.onStartLoop)
+            self.Toolbar.addToolbarButton(u'Stop Loop',
+                u':/media/media_stop.png',
+                translate(u'SlideController', u'Stop continuous loop'),
+                self.onStopLoop)
+            self.DelaySpinBox = QtGui.QSpinBox()
+            self.Toolbar.addToolbarWidget(u'Image SpinBox', self.DelaySpinBox)
+            self.DelaySpinBox.setSuffix(translate(u'SlideController', u's'))
+
         self.ControllerLayout.addWidget(self.Toolbar)
         sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
             QtGui.QSizePolicy.Fixed)
@@ -110,7 +151,7 @@
         self.Toolbar.setSizePolicy(sizeToolbarPolicy)
         # Screen preview area
         self.PreviewFrame = QtGui.QFrame(self.Splitter)
-        self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 280, 190))
+        self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 225))
         self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy(
             QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum))
         self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
@@ -128,7 +169,7 @@
         sizePolicy.setHeightForWidth(
             self.SlidePreview.sizePolicy().hasHeightForWidth())
         self.SlidePreview.setSizePolicy(sizePolicy)
-        self.SlidePreview.setFixedSize(QtCore.QSize(250, 210))
+        self.SlidePreview.setFixedSize(QtCore.QSize(300, 225))
         self.SlidePreview.setFrameShape(QtGui.QFrame.Box)
         self.SlidePreview.setFrameShadow(QtGui.QFrame.Plain)
         self.SlidePreview.setLineWidth(1)
@@ -140,45 +181,46 @@
             QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
         QtCore.QObject.connect(self.PreviewListWidget,
             QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected)
-        # Window Event Handlers
-        QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'%sslide_first'% self.prefix), self.onSlideSelectedFirst)
-        QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'%sslide_previous'% self.prefix), self.onSlideSelectedPrevious)
-        QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'%sslide_next'% self.prefix), self.onSlideSelectedNext)
-        QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'%sslide_last'% self.prefix), self.onSlideSelectedLast)
-        QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'%sslide_start_loop'% self.prefix), self.onStartLoop)
-        QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'%sslide_stop_loop'% self.prefix), self.onStopLoop)
-
-
-    def registerToolbar(self, handle,controller):
-        """
-        Register a new toolbar with the controller
-        ``handle``
-            Identifier for the toolbar being stored this should equal the
-            plugins name.
-        ``controller``
-            The toolbar class which should extend MasterToolbar
-        """
-        #store the handle name in lower case so no probems later
-        self.toolbarList[handle.lower()] = controller
-
-    def retrieveToolbar(self, handle):
-        """
-        Find the toolbar and return master if none present
-        Add extra information back into toolbar class
-        ``handle``
-            Identifier for the toolbar being requested
-        """
-        try:
-            toolbar =  self.toolbarList[handle.lower()]
-        except:
-            toolbar = self.toolbarList[u'master']
-        return toolbar
+        if isLive:
+            QtCore.QObject.connect(Receiver.get_receiver(),
+                QtCore.SIGNAL(u'update_spin_delay'), self.receiveSpinDelay)
+            Receiver().send_message(u'request_spin_delay')
+        if isLive:
+            self.Toolbar.makeWidgetsInvisible(self.image_list)
+        else:
+            pass
+
+    def receiveSpinDelay(self, value):
+        self.DelaySpinBox.setValue(int(value))
+
+    def enableToolBar(self, item):
+        """
+        Allows the toolbars to be reconfigured based on Controller Type
+        and ServiceItem Type
+        """
+        if self.isLive:
+            self.enableLiveToolBar(item)
+        else:
+            self.enablePreviewToolBar(item)
+
+    def enableLiveToolBar(self, item):
+        """
+        Allows the live toolbar to be customised
+        """
+        if item.service_item_type == ServiceType.Text:
+            self.Toolbar.makeWidgetsInvisible(self.image_list)
+        elif item.service_item_type == ServiceType.Image:
+            #Not sensible to allow loops with 1 frame
+            if len(item.frames) > 1:
+                self.Toolbar.makeWidgetsVisible(self.image_list)
+            else:
+                self.Toolbar.makeWidgetsInvisible(self.image_list)
+
+    def enablePreviewToolBar(self, item):
+        """
+        Allows the Preview toolbar to be customised
+        """
+        pass
 
     def addServiceItem(self, item):
         """
@@ -186,13 +228,9 @@
         request the correct the toolbar of the plugin
         Called by plugins
         """
-        self.BaseToolbar = self.retrieveToolbar(item.shortname)
-        self.ControllerLayout.removeWidget(self.Toolbar)
-        #remove the old toolbar
-        self.Toolbar.clear()
-        self.Toolbar = self.BaseToolbar.getToolbar()
-        self.ControllerLayout.addWidget(self.Toolbar)
+        log.debug(u'addServiceItem')
         item.render()
+        self.enableToolBar(item)
         self.displayServiceManagerItems(item, 0)
 
     def addServiceManagerItem(self, item, slideno):
@@ -201,12 +239,8 @@
         request the correct the toolbar of the plugin
         Called by ServiceManager
         """
-        self.BaseToolbar = self.retrieveToolbar(item.shortname)
-        self.ControllerLayout.removeWidget(self.Toolbar)
-        #remove the old toolbar
-        self.Toolbar.clear()
-        self.Toolbar = self.BaseToolbar.getToolbar()
-        self.ControllerLayout.addWidget(self.Toolbar)
+        log.debug(u'addServiceItem')
+        self.enableToolBar(item)
         self.displayServiceManagerItems(item, slideno)
 
     def displayServiceManagerItems(self, serviceitem, slideno):
@@ -214,7 +248,7 @@
         Loads a ServiceItem into the system from ServiceManager
         Display the slide number passed
         """
-        log.debug(u'add Service Manager Item')
+        log.debug(u'displayServiceManagerItems Start')
         self.serviceitem = serviceitem
         slide_pixmap = QtGui.QPixmap.fromImage(self.serviceitem.frames[0][u'image'])
         slide_width = 300
@@ -241,27 +275,13 @@
             self.PreviewListWidget.selectRow(slideno)
         self.onSlideSelected()
         self.PreviewListWidget.setFocus()
+        log.debug(u'displayServiceManagerItems End')
 
     #Screen event methods
-    def onSlideSelected(self):
-        """
-        Generate the preview when you click on a slide.
-        if this is the Live Controller also display on the screen
-        """
-        row = self.PreviewListWidget.currentRow()
-        if row > -1 and row < self.PreviewListWidget.rowCount():
-            label = self.PreviewListWidget.cellWidget(row, 0)
-            smallframe = label.pixmap()
-            frame = self.serviceitem.frames[row][u'image']
-            self.SlidePreview.setPixmap(smallframe)
-            if self.isLive:
-                self.parent.mainDisplay.frameView(frame)
-
     def onSlideSelectedFirst(self):
         """
         Go to the first slide.
         """
-        print "oSSF"
         self.PreviewListWidget.selectRow(0)
         self.onSlideSelected()
 
@@ -312,12 +332,12 @@
         self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1)
         self.onSlideSelected()
 
-    def onStartLoop(self, value):
+    def onStartLoop(self):
         """
         Go to the last slide.
         """
         if self.PreviewListWidget.rowCount() > 1:
-            self.timer_id = self.startTimer(int(value) * 1000)
+            self.timer_id = self.startTimer(int(self.DelaySpinBox.value()) * 1000)
 
     def onStopLoop(self):
         """
@@ -329,88 +349,5 @@
         if event.timerId() == self.timer_id:
             self.onSlideSelectedNext()
 
-class MasterToolbar(QtCore.QObject):
-    """
-    Class from which all toolbars should extend
-    """
-    def __init__(self, isLive):
-        self.Toolbar = None
-        QtCore.QObject.__init__(self)
-        self.PreviewListWidget = QtGui.QListWidget()
-        self.isLive = isLive
-        self.prefix  = u'preview_'
-        if isLive:
-            self.prefix  = u'live_'
-
-    def getToolbar(self):
-        #define toolbar here as it needs to be redefined each time
-        #as the clear destroys it.
-        self.defineToolbar()
-        self.defineZone1()
-        self.defineZone2()
-        self.defineZone3()
-        self.defineZone4()
-        self.defineZone5()
-        return self.Toolbar
-
-    def defineToolbar(self):
-        # Controller toolbar
-        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)
-
-    def defineZone1(self):
-        #Dummy Zone
-        pass
-
-    def defineZone2(self):
-        if self.isLive:
-            self.Toolbar.addToolbarButton(u'First Slide',
-                u':/slides/slide_first.png',
-                translate(u'SlideController', u'Move to first'),
-                self.onSlideFirst)
-        self.Toolbar.addToolbarButton(u'Previous Slide',
-            u':/slides/slide_previous.png',
-            translate(u'SlideController', u'Move to previous'),
-            self.onSlidePrevious)
-        self.Toolbar.addToolbarButton(u'Next Slide',
-            u':/slides/slide_next.png',
-            translate(u'SlideController', u'Move to next'),
-            self.onSlideNext)
-        if self.isLive:
-            self.Toolbar.addToolbarButton(u'Last Slide',
-                u':/slides/slide_last.png',
-                translate(u'SlideController', u'Move to last'),
-                self.onSlideLast)
-
-    def defineZone3(self):
-        #Dummy Zone
-        pass
-
-    def defineZone4(self):
-        if self.isLive:
-            self.Toolbar.addSeparator()
-            self.Toolbar.addToolbarButton(u'Close Screen',
-                u':/slides/slide_close.png',
-                translate(u'SlideController', u'Close Screen'),
-                self.onSlideBlank)
-
-    def defineZone5(self):
-        #Dummy Zone
-        pass
-
-    def onSlideFirst(self):
-        Receiver().send_message(u'%sslide_first'% self.prefix)
-    def onSlidePrevious(self):
-        Receiver().send_message(u'%sslide_previous'% self.prefix)
-    def onSlideNext(self):
-        Receiver().send_message(u'%sslide_next'% self.prefix)
-    def onSlideLast(self):
-        Receiver().send_message(u'%sslide_last' % self.prefix)
-    def onSlideBlank(self):
-        Receiver().send_message(u'%sslide_blank' % self.prefix)
+
+

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2009-08-26 05:00:19 +0000
+++ openlp/core/ui/thememanager.py	2009-08-29 10:43:44 +0000
@@ -85,9 +85,6 @@
         self.servicePath = self.config.get_data_path()
         self.global_theme = unicode(self.config.get_config(u'theme global theme', u''))
 
-    def getDefault(self):
-        return self.global_theme
-
     def changeGlobalFromTab(self, themeName):
         log.debug(u'changeGlobalFromTab %s', themeName)
         for count in range (0,  self.ThemeListWidget.count()):
@@ -329,13 +326,29 @@
         if os.path.exists(theme_dir) == False:
             os.mkdir(os.path.join(self.path, name))
         theme_file = os.path.join(theme_dir, name + u'.xml')
-        outfile = open(theme_file, u'w')
-        outfile.write(theme_xml)
-        outfile.close()
-        if image_from is not None and image_from != image_to:
-            shutil.copyfile(image_from,  image_to)
-        self.generateAndSaveImage(self.path, name, theme_xml)
-        self.loadThemes()
+        log.debug(theme_file)
+ 
+        result = QtGui.QMessageBox.Yes
+        if os.path.exists(theme_file):
+            result = QtGui.QMessageBox.question(
+                self,
+                translate(u'ThemeManager',u'Theme Exists'),
+                translate(u'ThemeManager',u'A theme with this name already exists, would you like to overwrite it?'),
+                (QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
+                QtGui.QMessageBox.No)
+        if result == QtGui.QMessageBox.Yes:
+            # Save the theme, overwriting the existing theme if necessary.
+            outfile = open(theme_file, u'w')
+            outfile.write(theme_xml)
+            outfile.close()
+            if image_from is not None and image_from != image_to:
+                shutil.copyfile(image_from, image_to)
+            
+            self.generateAndSaveImage(self.path, name, theme_xml)
+            self.loadThemes()
+        else:
+            # Don't close the dialog - allow the user to change the name of the theme or to cancel the theme dialog completely.
+            return False
 
     def generateAndSaveImage(self, dir, name, theme_xml):
         log.debug(u'generateAndSaveImage %s %s %s', dir, name, theme_xml)

=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py	2009-08-25 20:04:58 +0000
+++ openlp/core/ui/themestab.py	2009-08-29 07:17:56 +0000
@@ -124,6 +124,9 @@
         self.config.set_config(u'theme global theme',self.global_theme)
         Receiver().send_message(u'update_global_theme',  self.global_theme )
 
+    def postSetUp(self):
+        Receiver().send_message(u'update_global_theme',  self.global_theme )
+
     def onSongLevelButtonPressed(self):
         self.global_style= u'Song'
         self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2009-08-24 04:30:04 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2009-09-01 05:17:32 +0000
@@ -341,8 +341,10 @@
     def generateSlideData(self, service_item):
         log.debug(u'generating slide data')
         items = self.ListView.selectedIndexes()
+        if len(items) ==0:
+            return False
         old_chapter = u''
-        raw_slides=[]
+        raw_slides = []
         raw_footer = []
         bible_text = u''
         for item in items:
@@ -389,6 +391,7 @@
         for slide in raw_slides:
             service_item.add_from_text(slide[:30], slide)
         service_item.raw_footer = raw_footer
+        return True
 
     def formatVerse(self, old_chapter, chapter, verse, opening, closing):
         loc = opening
@@ -432,27 +435,30 @@
             combo.addItem(unicode(i))
 
     def displayResults(self, bible):
-        for verse in self.search_results:
+        for count,  verse  in enumerate(self.search_results):
             bible_text = u' %s %d:%d (%s)' % (verse.book.name,
                 verse.chapter, verse.verse, bible)
             bible_verse = QtGui.QListWidgetItem(bible_text)
             bible_verse.setData(QtCore.Qt.UserRole,
                 QtCore.QVariant(bible_text))
             self.ListView.addItem(bible_verse)
+            cr = self.ListView.setCurrentRow(count)
+            if cr is not None:
+                cr.setSelected(True)
 
     def searchByReference(self, bible,  search):
         log.debug(u'searchByReference %s ,%s', bible, search)
-        book = ''
-        start_chapter = ''
-        end_chapter = ''
-        start_verse = ''
-        end_verse = ''
+        book = u''
+        start_chapter = u''
+        end_chapter = u''
+        start_verse = u''
+        end_verse = u''
         search = search.replace(u'  ', u' ').strip()
         original = search
         message = None
         # Remove book beware 0 index arrays
         for i in range (len(search)-1, 0, - 1):
-            if search[i] == ' ':
+            if search[i] == u' ':
                 book = search[:i]
                 # remove book from string
                 search = search[i:]
@@ -466,7 +472,7 @@
             # number : found
             i = search.rfind(u' ')
             if i == -1:
-                chapter = ''
+                chapter = u''
             else:
                 chapter = search[i:len(search)]
             hyphen = chapter.find(u'-')
@@ -493,29 +499,25 @@
                 end_verse = start_verse
             else:
                 sp1 = sp[1].split(u':')
-                #print "2nd details", sp1, len(sp1)
                 if len(sp1) == 1:
                     end_chapter = start_chapter
                     end_verse =  sp1[0]
                 else:
                     end_chapter = sp1[0]
                     end_verse = sp1[1]
-        #print 'search = ' + unicode(original)
-        #print 'results = ' + unicode(book) + ' @ '+ unicode(start_chapter)+' @ '+ unicode(end_chapter)+' @ '+ unicode(start_verse)+ ' @ '+ unicode(end_verse)
-        if end_chapter == '':
+        if end_chapter == u'':
             end_chapter = start_chapter.rstrip()
-        if start_verse == '':
-            if end_verse == '':
+        if start_verse == u'':
+            if end_verse == u'':
                 start_verse = 1
             else:
                 start_verse = end_verse
-        if end_verse == '':
+        if end_verse == u'':
             end_verse = 99
-        if start_chapter == '':
+        if start_chapter == u'':
             message = u'No chapter found for search criteria'
-        #print 'message = ' + unicode(message)
-        #print 'search = ' + unicode(original)
-        #print 'results = ' + unicode(book) + ' @ '+ unicode(start_chapter)+' @ '+ unicode(end_chapter)+' @ '+ unicode(start_verse)+ ' @ '+ unicode(end_verse)
+        log.debug(u'results = %s @ %s : %s @ %s : %s'% \
+                  (unicode(book), unicode(start_chapter), unicode(end_chapter),  unicode(start_verse),  unicode(end_verse)))
         if message == None:
             self.search_results = None
             self.search_results = self.parent.biblemanager.get_verse_text(bible, book,

=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py	2009-08-15 11:02:24 +0000
+++ openlp/plugins/custom/lib/mediaitem.py	2009-09-01 05:17:32 +0000
@@ -68,17 +68,17 @@
         self.addToolbarButton(
             translate(u'CustomMediaItem',u'Preview Custom Item'),
             translate(u'CustomMediaItem',u'Preview the selected Custom Item'),
-            u':/system/system_preview.png', self.onCustomPreviewClick, u'CustomPreviewItem')
+            u':/system/system_preview.png', self.onPreviewClick, u'CustomPreviewItem')
         ## Live Custom Button ##
         self.addToolbarButton(
             translate(u'CustomMediaItem',u'Go Live'),
             translate(u'CustomMediaItem', u'Send the selected Custom live'),
-            u':/system/system_live.png', self.onCustomLiveClick, u'CustomLiveItem')
+            u':/system/system_live.png', self.onLiveClick, u'CustomLiveItem')
         ## Add Custom Button ##
         self.addToolbarButton(
             translate(u'CustomMediaItem',u'Add Custom To Service'),
             translate(u'CustomMediaItem',u'Add the selected Custom(s) to the service'),
-            u':/system/system_add.png', self.onCustomAddClick, u'CustomAddItem')
+            u':/system/system_add.png', self.onAddClick, u'CustomAddItem')
         # Add the CustomListView widget
         self.CustomWidget = QtGui.QWidget(self)
         sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
@@ -95,7 +95,7 @@
         self.PageLayout.addWidget(self.ListView)
         # Signals
         QtCore.QObject.connect(self.ListView,
-            QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onCustomPreviewClick)
+            QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick)
         #define and add the context menu
         self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
         self.ListView.addAction(contextMenuAction(self.ListView,
@@ -104,13 +104,13 @@
         self.ListView.addAction(contextMenuSeparator(self.ListView))
         self.ListView.addAction(contextMenuAction(
             self.ListView, ':/system/system_preview.png',
-            translate(u'CustomMediaItem',u'&Preview Custom'), self.onCustomPreviewClick))
+            translate(u'CustomMediaItem',u'&Preview Custom'), self.onPreviewClick))
         self.ListView.addAction(contextMenuAction(
             self.ListView, ':/system/system_live.png',
-            translate(u'CustomMediaItem',u'&Show Live'), self.onCustomLiveClick))
+            translate(u'CustomMediaItem',u'&Show Live'), self.onLiveClick))
         self.ListView.addAction(contextMenuAction(
             self.ListView, ':/system/system_add.png',
-            translate(u'CustomMediaItem',u'&Add to Service'), self.onCustomAddClick))
+            translate(u'CustomMediaItem',u'&Add to Service'), self.onAddClick))
 
     def initialise(self):
         self.loadCustomListView(self.parent.custommanager.get_all_slides())
@@ -143,33 +143,14 @@
             row = self.ListView.row(item)
             self.ListView.takeItem(row)
 
-    def onCustomPreviewClick(self):
-        log.debug(u'Custom Preview Requested')
-        service_item = ServiceItem(self.parent)
-        service_item.addIcon(u':/media/media_song.png')
-        self.generateSlideData(service_item)
-        self.parent.preview_controller.addServiceItem(service_item)
-
-    def onCustomLiveClick(self):
-        log.debug(u'Custom Live Requested')
-        service_item = ServiceItem(self.parent)
-        service_item.addIcon(u':/media/media_song.png')
-        self.generateSlideData(service_item)
-        self.parent.live_controller.addServiceItem(service_item)
-
-    def onCustomAddClick(self):
-        log.debug(u'Custom Add Requested')
-        service_item = ServiceItem(self.parent)
-        service_item.addIcon(u':/media/media_song.png')
-        self.generateSlideData(service_item)
-        self.parent.service_manager.addServiceItem(service_item)
-
     def generateSlideData(self, service_item):
         raw_slides =[]
         raw_footer = []
         slide = None
         theme = None
         item = self.ListView.currentItem()
+        if item is None:
+            return False
         item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
         customSlide = self.parent.custommanager.get_custom(item_id)
         title = customSlide.title
@@ -187,3 +168,4 @@
             for slide in raw_slides:
                 service_item.add_from_text(slide[:30], slide)
             service_item.raw_footer = raw_footer
+        return True

=== modified file 'openlp/plugins/images/lib/__init__.py'
--- openlp/plugins/images/lib/__init__.py	2009-08-24 05:13:27 +0000
+++ openlp/plugins/images/lib/__init__.py	2009-08-27 05:17:20 +0000
@@ -18,5 +18,4 @@
 Place, Suite 330, Boston, MA 02111-1307 USA
 """
 from mediaitem import ImageMediaItem
-from imagetoolbar import ImageToolbar
 from imagetab import ImageTab

=== modified file 'openlp/plugins/images/lib/imagetab.py'
--- openlp/plugins/images/lib/imagetab.py	2009-07-06 16:34:13 +0000
+++ openlp/plugins/images/lib/imagetab.py	2009-08-29 07:17:56 +0000
@@ -20,7 +20,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import SettingsTab,  str_to_bool,  translate
+from openlp.core.lib import SettingsTab,  str_to_bool,  translate,  Receiver
 
 class ImageTab(SettingsTab):
     """
@@ -67,3 +67,7 @@
 
     def save(self):
         self.config.set_config(u'loop delay', self.loop_delay)
+        Receiver().send_message(u'update_spin_delay',  self.loop_delay )
+
+    def postSetUp(self):
+        Receiver().send_message(u'update_spin_delay',  self.loop_delay )

=== removed file 'openlp/plugins/images/lib/imagetoolbar.py'
--- openlp/plugins/images/lib/imagetoolbar.py	2009-08-24 05:13:27 +0000
+++ openlp/plugins/images/lib/imagetoolbar.py	1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-# -*- 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,  Receiver
-from openlp.core.ui.slidecontroller import MasterToolbar
-
-class ImageToolbar(MasterToolbar):
-
-    def __init__(self, parent,  isLive):
-        MasterToolbar.__init__(self, isLive)
-        self.parent = parent
-        self.Toolbar = None
-        self.isLive = isLive
-
-    def defineZone5(self):
-        self.Toolbar.addSeparator()
-        self.Toolbar.addToolbarButton(u'Start Loop',
-            u':/media/media_time.png',
-            translate(u'SlideController', u'Start continuous loop'),
-            self.onStartLoop)
-        self.Toolbar.addToolbarButton(u'Stop Loop',
-            u':/media/media_stop.png',
-            translate(u'SlideController', u'Stop continuous loop'),
-            self.onStopLoop)
-        self.Toolbar.addSeparator()
-        self.DelaySpinBox = QtGui.QSpinBox(self.Toolbar)
-        self.SpinWidget = QtGui.QWidgetAction(self.Toolbar)
-        self.SpinWidget.setDefaultWidget(self.DelaySpinBox)
-        self.Toolbar.addAction(self.SpinWidget)
-        self.DelaySpinBox.setValue(self.parent.parent.ImageTab.loop_delay)
-        self.DelaySpinBox.setSuffix(translate(u'ImageSlideController', u's'))
-
-    def onStartLoop(self):
-        """
-        Trigger the slide controller to start to loop passing the delay
-        """
-        Receiver().send_message(u'%sslide_start_loop' % self.prefix,  self.DelaySpinBox.value())
-
-    def onStopLoop(self):
-        """
-        Trigger the slide controller to stop the loop
-        """
-        Receiver().send_message(u'%sslide_stop_loop' % self.prefix)

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2009-08-25 05:18:09 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2009-09-01 05:17:32 +0000
@@ -22,7 +22,6 @@
 
 from PyQt4 import QtCore, QtGui
 from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD,  buildIcon
-from openlp.plugins.images.lib.imagetoolbar import ImageToolbar
 
 # We have to explicitly create separate classes for each plugin
 # in order for DnD to the Service manager to work correctly.
@@ -56,9 +55,6 @@
         self.ServiceItemIconName = u':/media/media_image.png'
         self.servicePath = None
         MediaManagerItem.__init__(self, parent, icon, title)
-        #create and install our own slide controller toolbar
-        imageToolbar = ImageToolbar(self, True)
-        parent.live_controller.registerToolbar(self.ConfigSection, imageToolbar)
 
     def initialise(self):
         self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
@@ -99,6 +95,8 @@
 
     def generateSlideData(self, service_item):
         items = self.ListView.selectedIndexes()
+        if len(items) == 0:
+            return False
         service_item.title = u'Image(s)'
         for item in items:
             bitem =  self.ListView.item(item.row())
@@ -106,3 +104,4 @@
             frame = QtGui.QImage(unicode(filename))
             (path, name) = os.path.split(filename)
             service_item.add_from_image(path,  name, frame)
+        return True

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2009-08-15 11:02:24 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2009-08-31 21:53:35 +0000
@@ -100,12 +100,15 @@
 
     def generateSlideData(self, service_item):
         indexes = self.ListView.selectedIndexes()
+        if len(items) > 1:
+            return False
         service_item.title = u'Media'
         for index in indexes:
             filename = self.ListData.getFilename(index)
             frame = QtGui.QImage(unicode(filename))
             (path, name) = os.path.split(filename)
             service_item.add_from_image(path,  name, frame)
+        return True
 
     def onPreviewClick(self):
         log.debug(u'Media Preview Button pressed')

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2009-08-11 19:21:52 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2009-08-31 21:53:35 +0000
@@ -43,7 +43,7 @@
         self.controllers = controllers
         self.TranslationContext = u'PresentationPlugin'
         self.PluginTextShort = u'Presentation'
-        self.ConfigSection = u'presentation'
+        self.ConfigSection = u'presentations'
         self.hasFileIcon = True
         self.hasNewIcon = False
         self.hasEditIcon = False
@@ -81,9 +81,6 @@
         for item in self.controllers:
             #load the drop down selection
             self.DisplayTypeComboBox.addItem(item)
-            #load the preview toolbars
-            #self.parent.preview_controller.registerToolbar(item,  self.controllers[item])
-            #self.parent.live_controller.registerToolbar(item,  self.controllers[item])
 
     def loadList(self, list):
         for file in list:
@@ -102,11 +99,13 @@
 
     def generateSlideData(self, service_item):
         items = self.ListView.selectedIndexes()
-        service_item.title = self.DisplayTypeComboBox.currentText()
+        if len(items) > 1:
+            return False
+        service_item.title = unicode(self.DisplayTypeComboBox.currentText())
         service_item.shortname = unicode(self.DisplayTypeComboBox.currentText())
         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_using_toolbar(path, name)
+            service_item.add_from_command(path,  name)
+        return True

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2009-08-26 05:00:19 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2009-08-31 21:53:35 +0000
@@ -68,15 +68,15 @@
         ## Preview Song Button ##
         self.addToolbarButton(translate(u'SongMediaItem', u'Preview Song'),
             translate(u'SongMediaItem', u'Preview the selected song'),
-            ':/system/system_preview.png', self.onSongPreviewClick, 'SongPreviewItem')
+            ':/system/system_preview.png', self.onPreviewClick, 'SongPreviewItem')
         ## Live Song Button ##
         self.addToolbarButton(translate(u'SongMediaItem', u'Go Live'),
             translate(u'SongMediaItem', u'Send the selected song live'),
-            ':/system/system_live.png', self.onSongLiveClick, 'SongLiveItem')
+            ':/system/system_live.png', self.onLiveClick, 'SongLiveItem')
         ## Add Song Button ##
         self.addToolbarButton(translate(u'SongMediaItem', u'Add Song To Service'),
             translate(u'SongMediaItem', u'Add the selected song(s) to the service'),
-            ':/system/system_add.png', self.onSongAddClick, 'SongAddItem')
+            ':/system/system_add.png', self.onAddClick, 'SongAddItem')
         self.addToolbarSeparator()
         ## Song Maintenance Button ##
         self.addToolbarButton(translate(u'SongMediaItem', u'Song Maintenance'),
@@ -127,7 +127,7 @@
         QtCore.QObject.connect(self.SearchTextEdit,
             QtCore.SIGNAL(u'textChanged(const QString&)'), self.onSearchTextEditChanged)
         QtCore.QObject.connect(self.ListView,
-           QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onSongPreviewClick)
+           QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick)
         QtCore.QObject.connect(Receiver.get_receiver(),
             QtCore.SIGNAL(u'load_song_list'), self.onSearchTextButtonClick)
 
@@ -139,13 +139,13 @@
         self.ListView.addAction(contextMenuSeparator(self.ListView))
         self.ListView.addAction(contextMenuAction(self.ListView,
             ':/system/system_preview.png', translate(u'SongMediaItem', u'&Preview Song'),
-            self.onSongPreviewClick))
+            self.onPreviewClick))
         self.ListView.addAction(contextMenuAction(self.ListView,
             ':/system/system_live.png', translate(u'SongMediaItem', u'&Show Live'),
-            self.onSongLiveClick))
+            self.onLiveClick))
         self.ListView.addAction(contextMenuAction(self.ListView,
             ':/system/system_add.png', translate(u'SongMediaItem', u'&Add to Service'),
-            self.onSongAddClick))
+            self.onAddClick))
 
     def retranslateUi(self):
         self.SearchTypeLabel.setText(translate(u'SongMediaItem', u'Search Type:'))
@@ -246,12 +246,12 @@
             self.parent.songmanager.delete_song(item_id)
             row = self.ListView.row(item)
             self.ListView.takeItem(row)
-
-    def onSongPreviewClick(self):
-        service_item = ServiceItem(self.parent)
-        service_item.addIcon(u':/media/media_song.png')
-        self.generateSlideData(service_item)
-        self.parent.preview_controller.addServiceItem(service_item)
+#
+#    def onSongPreviewClick(self):
+#        service_item = ServiceItem(self.parent)
+#        service_item.addIcon(u':/media/media_song.png')
+#        self.generateSlideData(service_item)
+#        self.parent.preview_controller.addServiceItem(service_item)
 
     def generateSlideData(self, service_item):
         raw_slides =[]
@@ -259,6 +259,8 @@
         author_list = u''
         ccl = u''
         item = self.ListView.currentItem()
+        if item is None:
+            return False
         item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
         song = self.parent.songmanager.get_song(item_id)
         service_item.theme = song.theme_name
@@ -286,15 +288,16 @@
         raw_footer.append(song.copyright )
         raw_footer.append(unicode(translate(u'SongMediaItem', u'CCL Licence: ') + ccl ))
         service_item.raw_footer = raw_footer
-
-    def onSongLiveClick(self):
-        service_item = ServiceItem(self.parent)
-        service_item.addIcon(u':/media/media_song.png')
-        self.generateSlideData(service_item)
-        self.parent.live_controller.addServiceItem(service_item)
-
-    def onSongAddClick(self):
-        service_item = ServiceItem(self.parent)
-        service_item.addIcon( u':/media/media_song.png')
-        self.generateSlideData(service_item)
-        self.parent.service_manager.addServiceItem(service_item)
+        return True
+
+#    def onSongLiveClick(self):
+#        service_item = ServiceItem(self.parent)
+#        service_item.addIcon(u':/media/media_song.png')
+#        self.generateSlideData(service_item)
+#        self.parent.live_controller.addServiceItem(service_item)
+#
+#    def onSongAddClick(self):
+#        service_item = ServiceItem(self.parent)
+#        service_item.addIcon( u':/media/media_song.png')
+#        self.generateSlideData(service_item)
+#        self.parent.service_manager.addServiceItem(service_item)


Follow ups