← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/trivialfixes into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/48423

Start the UI component library with a couple of moves and a new item.
Dedupe song object checking.
Stop reloading songs when loading services without songs in them!
Change mouse cursor when loading services as reloading songs can take time.
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/48423
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py	2011-02-01 01:02:44 +0000
+++ openlp/core/lib/__init__.py	2011-02-03 03:57:55 +0000
@@ -319,20 +319,6 @@
     if not os.path.exists(dir):
         os.makedirs(dir)
 
-def save_cancel_button_box(parent):
-    """
-    Return a standard dialog button box with save and cancel buttons.
-    """
-    button_box = QtGui.QDialogButtonBox(parent)
-    button_box.setStandardButtons(QtGui.QDialogButtonBox.Save |
-        QtGui.QDialogButtonBox.Cancel)
-    button_box.setObjectName(u'%sButtonBox' % parent)
-    QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'),
-        parent.accept)
-    QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'),
-        parent.reject)
-    return button_box
-
 from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \
     BackgroundType, HorizontalType, VerticalType
 from displaytags import DisplayTags

=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2011-02-02 12:28:48 +0000
+++ openlp/core/lib/plugin.py	2011-02-03 03:57:55 +0000
@@ -118,7 +118,7 @@
 
             class MyPlugin(Plugin):
                 def __init__(self):
-                    Plugin.__init(self, u'MyPlugin', u'0.1')
+                    Plugin.__init__(self, u'MyPlugin', u'0.1')
 
         ``name``
             Defaults to *None*. The name of the plugin.

=== added file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py	1970-01-01 00:00:00 +0000
+++ openlp/core/lib/ui.py	2011-02-03 03:57:55 +0000
@@ -0,0 +1,110 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2011 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael      #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian      #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble,    #
+# Carsten Tinggaard, Frode Woldsund                                           #
+# --------------------------------------------------------------------------- #
+# 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                          #
+###############################################################################
+"""
+The :mod:`ui` module provides standard UI components for OpenLP.
+"""
+import logging
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import translate
+
+log = logging.getLogger(__name__)
+
+def add_welcome_page(parent, image):
+    """
+    Generate an opening welcome page for a wizard using a provided image.
+
+    ``image``
+        A splash image for the wizard.
+    """
+    parent.welcomePage = QtGui.QWizardPage()
+    parent.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
+        QtGui.QPixmap(image))
+    parent.welcomePage.setObjectName(u'WelcomePage')
+    parent.welcomeLayout = QtGui.QVBoxLayout(parent.welcomePage)
+    parent.welcomeLayout.setObjectName(u'WelcomeLayout')
+    parent.titleLabel = QtGui.QLabel(parent.welcomePage)
+    parent.titleLabel.setObjectName(u'TitleLabel')
+    parent.welcomeLayout.addWidget(parent.titleLabel)
+    parent.welcomeLayout.addSpacing(40)
+    parent.informationLabel = QtGui.QLabel(parent.welcomePage)
+    parent.informationLabel.setWordWrap(True)
+    parent.informationLabel.setObjectName(u'InformationLabel')
+    parent.welcomeLayout.addWidget(parent.informationLabel)
+    parent.welcomeLayout.addStretch()
+    parent.addPage(parent.welcomePage)
+
+def save_cancel_button_box(parent):
+    """
+    Return a standard dialog button box with save and cancel buttons.
+    """
+    button_box = QtGui.QDialogButtonBox(parent)
+    button_box.setStandardButtons(
+        QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
+    button_box.setObjectName(u'%sButtonBox' % parent)
+    QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'),
+        parent.accept)
+    QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'),
+        parent.reject)
+    return button_box
+
+def critical_error_message_box(title=None, message=None, parent=None,
+    question=False):
+    """
+    Provides a standard critical message box for errors that OpenLP displays
+    to users.
+
+    ``title``
+        The title for the message box.
+
+    ``message``
+        The message to display to the user.
+
+    ``parent``
+        The parent UI element to attach the dialog to.
+
+    ``question``
+        Should this message box question the user.
+    """
+    error = translate('OpenLP.Ui', 'Error')
+    if question:
+        return QtGui.QMessageBox.critical(parent, error, message,
+            QtGui.QMessageBox.StandardButtons(
+            QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
+    data = {u'message': message}
+    data[u'title'] = title if title else error
+    return Receiver.send_message(u'openlp_error_message', data)
+
+def media_item_combo_box(parent, name):
+    """
+    Provide a standard combo box for media items.
+    """
+    combo = QtGui.QComboBox(parent)
+    combo.setObjectName(name)
+    combo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
+    combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
+    return combo

=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py	2011-01-15 19:24:50 +0000
+++ openlp/core/ui/__init__.py	2011-02-03 03:57:55 +0000
@@ -51,34 +51,6 @@
     Theme = 2
     Screen = 3
 
-
-def criticalErrorMessageBox(title=None, message=None, parent=None,
-    question=False):
-    """
-    Provides a standard critical message box for errors that OpenLP displays
-    to users.
-
-    ``title``
-        The title for the message box.
-
-    ``message``
-        The message to display to the user.
-
-    ``parent``
-        The parent UI element to attach the dialog to.
-
-    ``question``
-        Should this message box question the user.
-    """
-    error = translate('OpenLP.Ui', 'Error')
-    if question:
-        return QtGui.QMessageBox.critical(parent, error, message,
-            QtGui.QMessageBox.StandardButtons(
-            QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
-    data = {u'message': message}
-    data[u'title'] = title if title else error
-    return Receiver.send_message(u'openlp_error_message', data)
-
 from themeform import ThemeForm
 from filerenameform import FileRenameForm
 from maindisplay import MainDisplay
@@ -99,6 +71,6 @@
 from servicemanager import ServiceManager
 from thememanager import ThemeManager
 
-__all__ = ['criticalErrorMessageBox', 'SplashScreen', 'AboutForm',
-    'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager',
-    'ThemeManager', 'MediaDockManager', 'ServiceItemEditForm']
+__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay',
+    'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager',
+    'ServiceItemEditForm']

=== modified file 'openlp/core/ui/displaytagtab.py'
--- openlp/core/ui/displaytagtab.py	2011-01-15 19:24:50 +0000
+++ openlp/core/ui/displaytagtab.py	2011-02-03 03:57:55 +0000
@@ -34,7 +34,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import SettingsTab, translate, DisplayTags
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 
 class DisplayTagTab(SettingsTab):
     '''
@@ -276,7 +276,7 @@
         """
         for html in DisplayTags.get_html_tags():
             if self._strip(html[u'start tag']) == u'n':
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     translate('OpenLP.DisplayTagTab', 'Update Error'),
                     translate('OpenLP.DisplayTagTab',
                     'Tag "n" already defined.'))
@@ -317,7 +317,7 @@
             for linenumber, html1 in enumerate(html_expands):
                 if self._strip(html1[u'start tag']) == tag and \
                     linenumber != self.selected:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('OpenLP.DisplayTagTab', 'Update Error'),
                         unicode(translate('OpenLP.DisplayTagTab',
                         'Tag %s already defined.')) % tag)

=== modified file 'openlp/core/ui/serviceitemeditdialog.py'
--- openlp/core/ui/serviceitemeditdialog.py	2011-02-01 01:02:44 +0000
+++ openlp/core/ui/serviceitemeditdialog.py	2011-02-03 03:57:55 +0000
@@ -26,7 +26,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import translate, build_icon, save_cancel_button_box
+from openlp.core.lib import translate, build_icon
+from openlp.core.lib.ui import save_cancel_button_box
 
 class Ui_ServiceItemEditDialog(object):
     def setupUi(self, serviceItemEditDialog):

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2011-02-02 15:52:17 +0000
+++ openlp/core/ui/servicemanager.py	2011-02-03 03:57:55 +0000
@@ -36,8 +36,8 @@
 from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
     Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \
     ThemeLevel
-from openlp.core.ui import criticalErrorMessageBox, ServiceNoteForm, \
-    ServiceItemEditForm
+from openlp.core.lib.ui import critical_error_message_box
+from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
 from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
     split_filename
 
@@ -491,7 +491,7 @@
             for file in zip.namelist():
                 ucsfile = file_is_unicode(file)
                 if not ucsfile:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         message=translate('OpenLP.ServiceManager',
                         'File is not a valid service.\n'
                         'The content encoding is not UTF-8.'))
@@ -506,6 +506,8 @@
                 if filePath.endswith(u'osd'):
                     p_file = filePath
             if 'p_file' in locals():
+                Receiver.send_message(u'cursor_busy')
+                Receiver.send_message(u'openlp_process_events')
                 fileTo = open(p_file, u'r')
                 items = cPickle.load(fileTo)
                 fileTo.close()
@@ -520,8 +522,9 @@
                         Receiver.send_message(u'%s_service_load' %
                             serviceItem.name.lower(), serviceItem)
                 delete_file(p_file)
+                Receiver.send_message(u'cursor_normal')
             else:
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     message=translate('OpenLP.ServiceManager',
                     'File is not a valid service.'))
                 log.exception(u'File contains no service data')
@@ -536,9 +539,7 @@
         self.mainwindow.addRecentFile(fileName)
         self.setModified(False)
         QtCore.QSettings(). \
-            setValue(u'service/last file',QtCore.QVariant(fileName))
-        # Refresh Plugin lists
-        Receiver.send_message(u'plugin_list_refresh')
+            setValue(u'service/last file', QtCore.QVariant(fileName))
 
     def loadLastFile(self):
         """
@@ -993,7 +994,7 @@
             self.mainwindow.previewController.addServiceManagerItem(
                 self.serviceItems[item][u'service_item'], child)
         else:
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 translate('OpenLP.ServiceManager', 'Missing Display Handler'),
                 translate('OpenLP.ServiceManager', 'Your item cannot be '
                 'displayed as there is no handler to display it'))
@@ -1027,7 +1028,7 @@
                         self.serviceItems[item][u'service_item'], 0)
                     self.mainwindow.liveController.previewListWidget.setFocus()
         else:
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 translate('OpenLP.ServiceManager', 'Missing Display Handler'),
                 translate('OpenLP.ServiceManager', 'Your item cannot be '
                 'displayed as the plugin required to display it is missing '
@@ -1188,7 +1189,7 @@
         Print a Service Order Sheet.
         """
         if not self.serviceItems:
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 message=translate('OpenLP.ServiceManager',
                 'There is no service item in this service.'))
             return

=== modified file 'openlp/core/ui/servicenoteform.py'
--- openlp/core/ui/servicenoteform.py	2011-02-01 18:05:59 +0000
+++ openlp/core/ui/servicenoteform.py	2011-02-03 03:57:55 +0000
@@ -26,7 +26,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import save_cancel_button_box, translate
+from openlp.core.lib import translate
+from openlp.core.lib.ui import save_cancel_button_box
 
 class ServiceNoteForm(QtGui.QDialog):
     """

=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py	2011-01-30 10:27:12 +0000
+++ openlp/core/ui/themeform.py	2011-02-03 03:57:55 +0000
@@ -31,7 +31,7 @@
 
 from openlp.core.lib import translate, BackgroundType, BackgroundGradientType, \
     Receiver
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.utils import get_images_filter
 from themewizard import Ui_ThemeWizard
 
@@ -567,13 +567,13 @@
         # Save the theme name
         self.theme.theme_name = unicode(self.field(u'name').toString())
         if not self.theme.theme_name:
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 translate('OpenLP.ThemeForm', 'Theme Name Missing'),
                 translate('OpenLP.ThemeForm',
                 'There is no name for this theme. Please enter one.'))
             return
         if self.theme.theme_name == u'-1' or self.theme.theme_name == u'None':
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 translate('OpenLP.ThemeForm', 'Theme Name Invalid'),
                 translate('OpenLP.ThemeForm',
                 'Invalid theme name. Please enter one.'))

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2011-01-15 20:06:25 +0000
+++ openlp/core/ui/thememanager.py	2011-02-03 03:57:55 +0000
@@ -32,11 +32,12 @@
 from xml.etree.ElementTree import ElementTree, XML
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.ui import criticalErrorMessageBox, FileRenameForm, ThemeForm
-from openlp.core.theme import Theme
 from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
     build_icon, Receiver, SettingsManager, translate, check_item_selected, \
     BackgroundType, BackgroundGradientType, check_directory_exists
+from openlp.core.lib.ui import critical_error_message_box
+from openlp.core.theme import Theme
+from openlp.core.ui import FileRenameForm, ThemeForm
 from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
     get_filesystem_encoding
 
@@ -359,7 +360,7 @@
         """
         item = self.themeListWidget.currentItem()
         if item is None:
-            criticalErrorMessageBox(message=translate('OpenLP.ThemeManager',
+            critical_error_message_box(message=translate('OpenLP.ThemeManager',
                 'You have not selected a theme.'))
             return
         theme = unicode(item.data(QtCore.Qt.UserRole).toString())
@@ -386,7 +387,7 @@
                         'Your theme has been successfully exported.'))
             except (IOError, OSError):
                 log.exception(u'Export Theme Failed')
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     translate('OpenLP.ThemeManager', 'Theme Export Failed'),
                     translate('OpenLP.ThemeManager',
                     'Your theme could not be exported due to an error.'))
@@ -496,7 +497,7 @@
             for file in zip.namelist():
                 ucsfile = file_is_unicode(file)
                 if not ucsfile:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         message=translate('OpenLP.ThemeManager',
                         'File is not a valid theme.\n'
                         'The content encoding is not UTF-8.'))
@@ -531,14 +532,14 @@
                 theme = self._createThemeFromXml(filexml, self.path)
                 self.generateAndSaveImage(dir, themename, theme)
             else:
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     translate('OpenLP.ThemeManager', 'Validation Error'),
                     translate('OpenLP.ThemeManager',
                     'File is not a valid theme.'))
                 log.exception(u'Theme file does not contain XML data %s' %
                     filename)
         except (IOError, NameError):
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 translate('OpenLP.ThemeManager', 'Validation Error'),
                 translate('OpenLP.ThemeManager',
                 'File is not a valid theme.'))
@@ -558,7 +559,7 @@
         """
         theme_dir = os.path.join(self.path, themeName)
         if os.path.exists(theme_dir):
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 translate('OpenLP.ThemeManager', 'Validation Error'),
                 translate('OpenLP.ThemeManager',
                 'A theme with this name already exists.'))
@@ -688,7 +689,7 @@
                 return False
             # should be the same unless default
             if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     message=translate('OpenLP.ThemeManager',
                     'You are unable to delete the default theme.'))
                 return False
@@ -696,7 +697,8 @@
             if testPlugin:
                 for plugin in self.mainwindow.pluginManager.plugins:
                     if plugin.usesTheme(theme):
-                        criticalErrorMessageBox(translate('OpenLP.ThemeManager',
+                        critical_error_message_box(
+                            translate('OpenLP.ThemeManager',
                             'Validation Error'),
                             unicode(translate('OpenLP.ThemeManager',
                             'Theme %s is used in the %s plugin.')) % \

=== modified file 'openlp/core/ui/themewizard.py'
--- openlp/core/ui/themewizard.py	2011-02-02 01:40:36 +0000
+++ openlp/core/ui/themewizard.py	2011-02-03 03:57:55 +0000
@@ -27,7 +27,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import translate, build_icon
-from openlp.core.ui.wizard import addWelcomePage
+from openlp.core.lib.ui import add_welcome_page
 
 class Ui_ThemeWizard(object):
     def setupUi(self, themeWizard):
@@ -37,7 +37,7 @@
         themeWizard.setOptions(QtGui.QWizard.IndependentPages |
             QtGui.QWizard.NoBackButtonOnStartPage)
         # Welcome Page
-        addWelcomePage(themeWizard, u':/wizards/wizard_createtheme.bmp')
+        add_welcome_page(themeWizard, u':/wizards/wizard_createtheme.bmp')
         # Background Page
         self.backgroundPage = QtGui.QWizardPage()
         self.backgroundPage.setObjectName(u'BackgroundPage')

=== modified file 'openlp/core/ui/wizard.py'
--- openlp/core/ui/wizard.py	2011-02-02 01:40:36 +0000
+++ openlp/core/ui/wizard.py	2011-02-03 03:57:55 +0000
@@ -31,6 +31,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import build_icon, Receiver
+from openlp.core.lib.ui import add_welcome_page
 
 log = logging.getLogger(__name__)
 
@@ -63,7 +64,7 @@
         self.setOptions(QtGui.QWizard.IndependentPages |
             QtGui.QWizard.NoBackButtonOnStartPage |
             QtGui.QWizard.NoBackButtonOnLastPage)
-        addWelcomePage(self, image)
+        add_welcome_page(self, image)
         self.addCustomPages()
         self.addProgressPage()
         self.retranslateUi()
@@ -145,27 +146,3 @@
         self.finishButton.setVisible(True)
         self.cancelButton.setVisible(False)
         Receiver.send_message(u'openlp_process_events')
-
-def addWelcomePage(parent, image):
-    """
-    Generate an opening welcome page for a wizard using a provided image.
-
-    ``image``
-        A splash image for the wizard.
-    """
-    parent.welcomePage = QtGui.QWizardPage()
-    parent.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
-        QtGui.QPixmap(image))
-    parent.welcomePage.setObjectName(u'WelcomePage')
-    parent.welcomeLayout = QtGui.QVBoxLayout(parent.welcomePage)
-    parent.welcomeLayout.setObjectName(u'WelcomeLayout')
-    parent.titleLabel = QtGui.QLabel(parent.welcomePage)
-    parent.titleLabel.setObjectName(u'TitleLabel')
-    parent.welcomeLayout.addWidget(parent.titleLabel)
-    parent.welcomeLayout.addSpacing(40)
-    parent.informationLabel = QtGui.QLabel(parent.welcomePage)
-    parent.informationLabel.setWordWrap(True)
-    parent.informationLabel.setObjectName(u'InformationLabel')
-    parent.welcomeLayout.addWidget(parent.informationLabel)
-    parent.welcomeLayout.addStretch()
-    parent.addPage(parent.welcomePage)

=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py	2011-01-27 16:45:23 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py	2011-02-03 03:57:55 +0000
@@ -35,7 +35,7 @@
 
 from openlp.core.lib import Receiver, SettingsManager, translate
 from openlp.core.lib.db import delete_database
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.ui.wizard import OpenLPWizard
 from openlp.core.utils import AppLocation, string_is_unicode
 from openlp.plugins.bibles.lib.manager import BibleFormat
@@ -486,7 +486,7 @@
         elif self.currentPage() == self.selectPage:
             if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
                 if not self.field(u'osis_location').toString():
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('BiblesPlugin.ImportWizardForm',
                         'Invalid Bible Location'),
                         translate('BiblesPlugin.ImportWizardForm',
@@ -496,7 +496,7 @@
                     return False
             elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
                 if not self.field(u'csv_testamentsfile').toString():
-                    answer = criticalErrorMessageBox(translate(
+                    answer = critical_error_message_box(translate(
                         'BiblesPlugin.ImportWizardForm', 'No Testaments File'),
                         translate('BiblesPlugin.ImportWizardForm',
                         'You have not specified a testaments file. Do you '
@@ -505,7 +505,7 @@
                         self.csvTestamentsEdit.setFocus()
                         return False
                 elif not self.field(u'csv_booksfile').toString():
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('BiblesPlugin.ImportWizardForm',
                         'Invalid Books File'),
                         translate('BiblesPlugin.ImportWizardForm',
@@ -514,7 +514,7 @@
                     self.csvBooksEdit.setFocus()
                     return False
                 elif not self.field(u'csv_versefile').toString():
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('BiblesPlugin.ImportWizardForm',
                         'Invalid Verse File'),
                         translate('BiblesPlugin.ImportWizardForm',
@@ -525,7 +525,7 @@
             elif self.field(u'source_format').toInt()[0] == \
                 BibleFormat.OpenSong:
                 if not self.field(u'opensong_file').toString():
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('BiblesPlugin.ImportWizardForm',
                         'Invalid OpenSong Bible'),
                         translate('BiblesPlugin.ImportWizardForm',
@@ -535,7 +535,7 @@
                     return False
             elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
                 if not self.field(u'openlp1_location').toString():
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('BiblesPlugin.ImportWizardForm',
                         'Invalid Bible Location'),
                         translate('BiblesPlugin.ImportWizardForm',
@@ -549,7 +549,7 @@
             license_copyright = \
                 unicode(self.field(u'license_copyright').toString())
             if not license_version:
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     translate('BiblesPlugin.ImportWizardForm',
                     'Empty Version Name'),
                     translate('BiblesPlugin.ImportWizardForm',
@@ -557,7 +557,7 @@
                 self.versionNameEdit.setFocus()
                 return False
             elif not license_copyright:
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     translate('BiblesPlugin.ImportWizardForm',
                     'Empty Copyright'),
                     translate('BiblesPlugin.ImportWizardForm',
@@ -566,7 +566,7 @@
                 self.copyrightEdit.setFocus()
                 return False
             elif self.manager.exists(license_version):
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
                     translate('BiblesPlugin.ImportWizardForm',
                     'This Bible already exists. Please import '

=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py	2011-01-27 03:13:43 +0000
+++ openlp/plugins/bibles/lib/db.py	2011-02-03 03:57:55 +0000
@@ -35,7 +35,7 @@
 
 from openlp.core.lib import translate
 from openlp.core.lib.db import BaseModel, init_db, Manager
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 
 log = logging.getLogger(__name__)
 
@@ -361,7 +361,7 @@
                 verse_list.extend(verses)
             else:
                 log.debug(u'OpenLP failed to find book %s', book)
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     translate('BiblesPlugin', 'No Book Found'),
                     translate('BiblesPlugin', 'No matching book '
                     'could be found in this Bible. Check that you have '

=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2011-01-31 01:55:25 +0000
+++ openlp/plugins/bibles/lib/http.py	2011-02-03 03:57:55 +0000
@@ -38,7 +38,7 @@
 from BeautifulSoup import BeautifulSoup, NavigableString
 
 from openlp.core.lib import Receiver, translate
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.utils import AppLocation, get_web_page
 from openlp.plugins.bibles.lib import SearchResults
 from openlp.plugins.bibles.lib.db import BibleDB, Book
@@ -431,7 +431,7 @@
             if not db_book:
                 book_details = HTTPBooks.get_book(book)
                 if not book_details:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('BiblesPlugin', 'No Book Found'),
                         translate('BiblesPlugin', 'No matching '
                         'book could be found in this Bible. Check that you '
@@ -552,14 +552,14 @@
         The type of error that occured for the issue.
     """
     if error_type == u'download':
-        criticalErrorMessageBox(
+        critical_error_message_box(
             translate('BiblePlugin.HTTPBible', 'Download Error'),
             translate('BiblePlugin.HTTPBible', 'There was a '
             'problem downloading your verse selection. Please check your '
             'Internet connection, and if this error continues to occur '
             'please consider reporting a bug.'))
     elif error_type == u'parse':
-        criticalErrorMessageBox(
+        critical_error_message_box(
             translate('BiblePlugin.HTTPBible', 'Parse Error'),
             translate('BiblePlugin.HTTPBible', 'There was a '
             'problem extracting your verse selection. If this error continues '

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2011-02-01 13:39:17 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2011-02-03 03:57:55 +0000
@@ -30,7 +30,7 @@
 
 from openlp.core.lib import MediaManagerItem, Receiver, BaseListWithDnD, \
     ItemCapabilities, translate
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box, media_item_combo_box
 from openlp.plugins.bibles.forms import BibleImportForm
 from openlp.plugins.bibles.lib import get_reference_match
 
@@ -81,33 +81,21 @@
         self.quickLayout.setObjectName(u'quickLayout')
         self.quickVersionLabel = QtGui.QLabel(self.quickTab)
         self.quickVersionLabel.setObjectName(u'quickVersionLabel')
-        self.quickVersionComboBox = QtGui.QComboBox(self.quickTab)
-        self.quickVersionComboBox.setSizeAdjustPolicy(
-            QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.quickVersionComboBox.setSizePolicy(
-            QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
-        self.quickVersionComboBox.setObjectName(u'quickVersionComboBox')
+        self.quickVersionComboBox = media_item_combo_box(self.quickTab,
+            u'quickVersionComboBox')
         self.quickVersionLabel.setBuddy(self.quickVersionComboBox)
         self.quickLayout.addRow(self.quickVersionLabel,
             self.quickVersionComboBox)
         self.quickSecondLabel = QtGui.QLabel(self.quickTab)
         self.quickSecondLabel.setObjectName(u'quickSecondLabel')
-        self.quickSecondComboBox = QtGui.QComboBox(self.quickTab)
-        self.quickSecondComboBox.setSizeAdjustPolicy(
-            QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.quickSecondComboBox.setSizePolicy(
-            QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
-        self.quickSecondComboBox.setObjectName(u'quickSecondComboBox')
+        self.quickSecondComboBox = media_item_combo_box(self.quickTab,
+            u'quickSecondComboBox')
         self.quickSecondLabel.setBuddy(self.quickSecondComboBox)
         self.quickLayout.addRow(self.quickSecondLabel, self.quickSecondComboBox)
         self.quickSearchTypeLabel = QtGui.QLabel(self.quickTab)
         self.quickSearchTypeLabel.setObjectName(u'quickSearchTypeLabel')
-        self.quickSearchComboBox = QtGui.QComboBox(self.quickTab)
-        self.quickSearchComboBox.setSizeAdjustPolicy(
-            QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.quickSearchComboBox.setSizePolicy(
-            QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
-        self.quickSearchComboBox.setObjectName(u'quickSearchComboBox')
+        self.quickSearchComboBox = media_item_combo_box(self.quickTab,
+            u'quickSearchComboBox')
         self.quickSearchTypeLabel.setBuddy(self.quickSearchComboBox)
         self.quickLayout.addRow(self.quickSearchTypeLabel,
             self.quickSearchComboBox)
@@ -119,12 +107,8 @@
         self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit)
         self.quickClearLabel = QtGui.QLabel(self.quickTab)
         self.quickClearLabel.setObjectName(u'quickClearLabel')
-        self.quickClearComboBox = QtGui.QComboBox(self.quickTab)
-        self.quickClearComboBox.setSizeAdjustPolicy(
-            QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.quickClearComboBox.setSizePolicy(
-            QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
-        self.quickClearComboBox.setObjectName(u'quickClearComboBox')
+        self.quickClearComboBox = media_item_combo_box(self.quickTab,
+            u'quickClearComboBox')
         self.quickLayout.addRow(self.quickClearLabel, self.quickClearComboBox)
         self.quickSearchButtonLayout = QtGui.QHBoxLayout()
         self.quickSearchButtonLayout.setObjectName(u'quickSearchButtonLayout')
@@ -144,36 +128,24 @@
         self.advancedVersionLabel.setObjectName(u'advancedVersionLabel')
         self.advancedLayout.addWidget(self.advancedVersionLabel, 0, 0,
             QtCore.Qt.AlignRight)
-        self.advancedVersionComboBox = QtGui.QComboBox(self.advancedTab)
-        self.advancedVersionComboBox.setSizeAdjustPolicy(
-            QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.advancedVersionComboBox.setSizePolicy(
-            QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
-        self.advancedVersionComboBox.setObjectName(u'advancedVersionComboBox')
+        self.advancedVersionComboBox = media_item_combo_box(self.advancedTab,
+            u'advancedVersionComboBox')
         self.advancedVersionLabel.setBuddy(self.advancedVersionComboBox)
         self.advancedLayout.addWidget(self.advancedVersionComboBox, 0, 1, 1, 2)
         self.advancedSecondLabel = QtGui.QLabel(self.advancedTab)
         self.advancedSecondLabel.setObjectName(u'advancedSecondLabel')
         self.advancedLayout.addWidget(self.advancedSecondLabel, 1, 0,
             QtCore.Qt.AlignRight)
-        self.advancedSecondComboBox = QtGui.QComboBox(self.advancedTab)
-        self.advancedSecondComboBox.setSizeAdjustPolicy(
-            QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.advancedSecondComboBox.setSizePolicy(
-            QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
-        self.advancedSecondComboBox.setObjectName(u'advancedSecondComboBox')
+        self.advancedSecondComboBox = media_item_combo_box(self.advancedTab,
+            u'advancedSecondComboBox')
         self.advancedSecondLabel.setBuddy(self.advancedSecondComboBox)
         self.advancedLayout.addWidget(self.advancedSecondComboBox, 1, 1, 1, 2)
         self.advancedBookLabel = QtGui.QLabel(self.advancedTab)
         self.advancedBookLabel.setObjectName(u'advancedBookLabel')
         self.advancedLayout.addWidget(self.advancedBookLabel, 2, 0,
             QtCore.Qt.AlignRight)
-        self.advancedBookComboBox = QtGui.QComboBox(self.advancedTab)
-        self.advancedBookComboBox.setSizeAdjustPolicy(
-            QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.advancedBookComboBox.setSizePolicy(
-            QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
-        self.advancedBookComboBox.setObjectName(u'advancedBookComboBox')
+        self.advancedBookComboBox = media_item_combo_box(self.advancedTab,
+            u'advancedBookComboBox')
         self.advancedBookLabel.setBuddy(self.advancedBookComboBox)
         self.advancedLayout.addWidget(self.advancedBookComboBox, 2, 1, 1, 2)
         self.advancedChapterLabel = QtGui.QLabel(self.advancedTab)
@@ -202,17 +174,12 @@
         self.advancedToVerse = QtGui.QComboBox(self.advancedTab)
         self.advancedToVerse.setObjectName(u'advancedToVerse')
         self.advancedLayout.addWidget(self.advancedToVerse, 5, 2)
-
         self.advancedClearLabel = QtGui.QLabel(self.quickTab)
         self.advancedClearLabel.setObjectName(u'advancedClearLabel')
         self.advancedLayout.addWidget(self.advancedClearLabel, 6, 0,
             QtCore.Qt.AlignRight)
-        self.advancedClearComboBox = QtGui.QComboBox(self.quickTab)
-        self.advancedClearComboBox.setSizeAdjustPolicy(
-            QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.advancedClearComboBox.setSizePolicy(
-            QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
-        self.advancedClearComboBox.setObjectName(u'advancedClearComboBox')
+        self.advancedClearComboBox = media_item_combo_box(self.quickTab,
+            u'advancedClearComboBox')
         self.advancedClearLabel.setBuddy(self.advancedClearComboBox)
         self.advancedLayout.addWidget(self.advancedClearComboBox, 6, 1, 1, 2)
         self.advancedSearchButtonLayout = QtGui.QHBoxLayout()
@@ -387,7 +354,8 @@
         verse_count = self.parent.manager.get_verse_count(bible, book, 1)
         if verse_count == 0:
             self.advancedSearchButton.setEnabled(False)
-            criticalErrorMessageBox(message=translate('BiblePlugin.MediaItem',
+            critical_error_message_box(
+                message=translate('BiblePlugin.MediaItem',
                 'Bible not fully loaded'))
         else:
             self.advancedSearchButton.setEnabled(True)
@@ -581,7 +549,8 @@
         if item_second_bible and second_bible or not item_second_bible and \
             not second_bible:
             self.displayResults(bible, second_bible)
-        elif criticalErrorMessageBox(message=translate('BiblePlugin.MediaItem',
+        elif critical_error_message_box(
+            message=translate('BiblePlugin.MediaItem',
             'You cannot combine single and second bible verses. Do you '
             'want to delete your search results and start a new search?'),
             parent=self, question=True) == QtGui.QMessageBox.Yes:

=== modified file 'openlp/plugins/custom/forms/editcustomdialog.py'
--- openlp/plugins/custom/forms/editcustomdialog.py	2011-02-01 01:02:44 +0000
+++ openlp/plugins/custom/forms/editcustomdialog.py	2011-02-03 03:57:55 +0000
@@ -26,7 +26,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import build_icon, translate, save_cancel_button_box
+from openlp.core.lib import build_icon, translate
+from openlp.core.lib.ui import save_cancel_button_box
 
 class Ui_CustomEditDialog(object):
     def setupUi(self, customEditDialog):

=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py	2011-02-02 16:13:43 +0000
+++ openlp/plugins/custom/forms/editcustomform.py	2011-02-03 03:57:55 +0000
@@ -29,7 +29,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import Receiver, translate
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser
 from openlp.plugins.custom.lib.db import CustomSlide
 from editcustomdialog import Ui_CustomEditDialog
@@ -152,7 +152,7 @@
         """
         valid, message = self._validate()
         if not valid:
-            criticalErrorMessageBox(message=message)
+            critical_error_message_box(message=message)
             return False
         sxml = CustomXMLBuilder()
         sxml.new_document()

=== modified file 'openlp/plugins/custom/forms/editcustomslidedialog.py'
--- openlp/plugins/custom/forms/editcustomslidedialog.py	2011-02-01 01:02:44 +0000
+++ openlp/plugins/custom/forms/editcustomslidedialog.py	2011-02-03 03:57:55 +0000
@@ -26,7 +26,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import translate, SpellTextEdit, save_cancel_button_box
+from openlp.core.lib import translate, SpellTextEdit
+from openlp.core.lib.ui import save_cancel_button_box
 
 class Ui_CustomSlideEditDialog(object):
     def setupUi(self, customSlideEditDialog):

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2011-02-02 12:28:48 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2011-02-03 03:57:55 +0000
@@ -32,7 +32,7 @@
 from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
     ItemCapabilities, SettingsManager, translate, check_item_selected, \
     check_directory_exists, Receiver
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.utils import AppLocation, delete_file, get_images_filter
 
 log = logging.getLogger(__name__)
@@ -161,7 +161,7 @@
                 items.remove(item)
             # We cannot continue, as all images do not exist.
             if not items:
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
                     unicode(translate('ImagePlugin.MediaItem',
                     'The following image(s) no longer exist: %s')) %
@@ -214,7 +214,7 @@
                 self.parent.liveController.display.directImage(name, filename)
                 self.resetAction.setVisible(True)
             else:
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     translate('ImagePlugin.MediaItem', 'Live Background Error'),
                     unicode(translate('ImagePlugin.MediaItem',
                     'There was a problem replacing your background, '

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2011-01-31 17:00:56 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2011-02-03 03:57:55 +0000
@@ -31,7 +31,7 @@
 
 from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
     ItemCapabilities, SettingsManager, translate, check_item_selected, Receiver
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 
 log = logging.getLogger(__name__)
 
@@ -120,7 +120,7 @@
                 self.parent.liveController.display.video(filename, 0, True)
                 self.resetAction.setVisible(True)
             else:
-                criticalErrorMessageBox(translate('MediaPlugin.MediaItem',
+                critical_error_message_box(translate('MediaPlugin.MediaItem',
                     'Live Background Error'),
                     unicode(translate('MediaPlugin.MediaItem',
                     'There was a problem replacing your background, '
@@ -144,7 +144,7 @@
             return True
         else:
             # File is no longer present
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 translate('MediaPlugin.MediaItem', 'Missing Media File'),
                 unicode(translate('MediaPlugin.MediaItem',
                 'The file %s no longer exists.')) % filename)

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2011-01-29 07:53:21 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2011-02-03 03:57:55 +0000
@@ -31,7 +31,7 @@
 
 from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
     SettingsManager, translate, check_item_selected, Receiver, ItemCapabilities
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box, media_item_combo_box
 from openlp.plugins.presentations.lib import MessageListener
 
 log = logging.getLogger(__name__)
@@ -116,12 +116,8 @@
         self.displayLayout.setObjectName(u'displayLayout')
         self.displayTypeLabel = QtGui.QLabel(self.presentationWidget)
         self.displayTypeLabel.setObjectName(u'displayTypeLabel')
-        self.displayTypeComboBox = QtGui.QComboBox(self.presentationWidget)
-        self.displayTypeComboBox.setSizeAdjustPolicy(
-            QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.displayTypeComboBox.setSizePolicy(
-            QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
-        self.displayTypeComboBox.setObjectName(u'displayTypeComboBox')
+        self.displayTypeComboBox = media_item_combo_box(
+            self.presentationWidget, u'displayTypeComboBox')
         self.displayTypeLabel.setBuddy(self.displayTypeComboBox)
         self.displayLayout.addRow(self.displayTypeLabel,
             self.displayTypeComboBox)
@@ -181,7 +177,7 @@
             filename = os.path.split(unicode(file))[1]
             if titles.count(filename) > 0:
                 if not initialLoad:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('PresentationPlugin.MediaItem',
                         'File Exists'),
                         translate('PresentationPlugin.MediaItem',
@@ -205,7 +201,7 @@
                 if initialLoad:
                     icon = build_icon(u':/general/general_delete.png')
                 else:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         self, translate('PresentationPlugin.MediaItem',
                         'Unsupported File'),
                         translate('PresentationPlugin.MediaItem',
@@ -278,7 +274,7 @@
                         return True
                     else:
                         # File is no longer present
-                        criticalErrorMessageBox(
+                        critical_error_message_box(
                             translate('PresentationPlugin.MediaItem',
                             'Missing Presentation'),
                             unicode(translate('PresentationPlugin.MediaItem',
@@ -287,7 +283,7 @@
                         return False
                 else:
                     # File is no longer present
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('PresentationPlugin.MediaItem',
                         'Missing Presentation'),
                         unicode(translate('PresentationPlugin.MediaItem',

=== modified file 'openlp/plugins/songs/forms/authorsdialog.py'
--- openlp/plugins/songs/forms/authorsdialog.py	2011-02-01 01:02:44 +0000
+++ openlp/plugins/songs/forms/authorsdialog.py	2011-02-03 03:57:55 +0000
@@ -26,7 +26,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import translate, save_cancel_button_box
+from openlp.core.lib import translate
+from openlp.core.lib.ui import save_cancel_button_box
 
 class Ui_AuthorsDialog(object):
     def setupUi(self, authorsDialog):

=== modified file 'openlp/plugins/songs/forms/authorsform.py'
--- openlp/plugins/songs/forms/authorsform.py	2011-01-15 20:06:25 +0000
+++ openlp/plugins/songs/forms/authorsform.py	2011-02-03 03:57:55 +0000
@@ -27,7 +27,7 @@
 from PyQt4 import QtGui, QtCore
 
 from openlp.core.lib import translate
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.plugins.songs.forms.authorsdialog import Ui_AuthorsDialog
 
 class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
@@ -80,17 +80,19 @@
 
     def accept(self):
         if not self.firstNameEdit.text():
-            criticalErrorMessageBox(message=translate('SongsPlugin.AuthorsForm',
+            critical_error_message_box(
+                message=translate('SongsPlugin.AuthorsForm',
                 'You need to type in the first name of the author.'))
             self.firstNameEdit.setFocus()
             return False
         elif not self.lastNameEdit.text():
-            criticalErrorMessageBox(message=translate('SongsPlugin.AuthorsForm',
+            critical_error_message_box(
+                message=translate('SongsPlugin.AuthorsForm',
                 'You need to type in the last name of the author.'))
             self.lastNameEdit.setFocus()
             return False
         elif not self.displayEdit.text():
-            if criticalErrorMessageBox(
+            if critical_error_message_box(
                 message=translate('SongsPlugin.AuthorsForm',
                 'You have not set a display name for the '
                 'author, combine the first and last names?'),

=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py	2011-02-02 04:35:26 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py	2011-02-03 03:57:55 +0000
@@ -26,7 +26,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import build_icon, translate, save_cancel_button_box
+from openlp.core.lib import build_icon, translate
+from openlp.core.lib.ui import save_cancel_button_box
 
 class Ui_EditSongDialog(object):
     def setupUi(self, editSongDialog):

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2011-02-01 18:05:59 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2011-02-03 03:57:55 +0000
@@ -30,7 +30,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import Receiver, translate
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.plugins.songs.forms import EditVerseForm
 from openlp.plugins.songs.lib import SongXML, VerseType
 from openlp.plugins.songs.lib.db import Book, Song, Author, Topic
@@ -255,7 +255,6 @@
             self.songBookNumberEdit.setText(self.song.song_number)
         else:
             self.songBookNumberEdit.setText(u'')
-
         # lazy xml migration for now
         self.verseListWidget.clear()
         self.verseListWidget.setRowCount(0)
@@ -343,7 +342,7 @@
             author = self.manager.get_object(Author, item_id)
             if self.authorsListView.findItems(unicode(author.display_name),
                 QtCore.Qt.MatchExactly):
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     message=translate('SongsPlugin.EditSongForm',
                     'This author is already in the list.'))
             else:
@@ -400,7 +399,7 @@
             topic = self.manager.get_object(Topic, item_id)
             if self.topicsListView.findItems(unicode(topic.name),
                 QtCore.Qt.MatchExactly):
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     message=translate('SongsPlugin.EditSongForm',
                     'This topic is already in the list.'))
             else:
@@ -533,21 +532,21 @@
         if not self.titleEdit.text():
             self.songTabWidget.setCurrentIndex(0)
             self.titleEdit.setFocus()
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 message=translate('SongsPlugin.EditSongForm',
                 'You need to type in a song title.'))
             return False
         if self.verseListWidget.rowCount() == 0:
             self.songTabWidget.setCurrentIndex(0)
             self.verseListWidget.setFocus()
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 message=translate('SongsPlugin.EditSongForm',
                 'You need to type in at least one verse.'))
             return False
         if self.authorsListView.count() == 0:
             self.songTabWidget.setCurrentIndex(1)
             self.authorsListView.setFocus()
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 message=translate('SongsPlugin.EditSongForm',
                 'You need to have an author for this song.'))
             return False
@@ -575,7 +574,7 @@
                     valid = verses.pop(0)
                     for verse in verses:
                         valid = valid + u', ' + verse
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         message=unicode(translate('SongsPlugin.EditSongForm',
                         'The verse order is invalid. There is no verse '
                         'corresponding to %s. Valid entries are %s.')) % \

=== modified file 'openlp/plugins/songs/forms/editversedialog.py'
--- openlp/plugins/songs/forms/editversedialog.py	2011-02-01 01:02:44 +0000
+++ openlp/plugins/songs/forms/editversedialog.py	2011-02-03 03:57:55 +0000
@@ -26,8 +26,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import build_icon, save_cancel_button_box, translate, \
-    SpellTextEdit
+from openlp.core.lib import build_icon, translate, SpellTextEdit
+from openlp.core.lib.ui import save_cancel_button_box
 from openlp.plugins.songs.lib import VerseType
 
 class Ui_EditVerseDialog(object):

=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py	2011-01-15 19:24:50 +0000
+++ openlp/plugins/songs/forms/editverseform.py	2011-02-03 03:57:55 +0000
@@ -29,7 +29,7 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.plugins.songs.lib import VerseType, translate
 
 from editversedialog import Ui_EditVerseDialog
@@ -168,7 +168,7 @@
         else:
             value = self.getVerse()[0].split(u'\n')[1]
         if len(value) == 0:
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 message=translate('SongsPlugin.EditSongForm',
                 'You need to type some text in to the verse.'))
             return False

=== modified file 'openlp/plugins/songs/forms/songbookdialog.py'
--- openlp/plugins/songs/forms/songbookdialog.py	2011-02-01 01:02:44 +0000
+++ openlp/plugins/songs/forms/songbookdialog.py	2011-02-03 03:57:55 +0000
@@ -26,7 +26,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import translate, save_cancel_button_box
+from openlp.core.lib import translate
+from openlp.core.lib.ui import save_cancel_button_box
 
 class Ui_SongBookDialog(object):
     def setupUi(self, songBookDialog):

=== modified file 'openlp/plugins/songs/forms/songbookform.py'
--- openlp/plugins/songs/forms/songbookform.py	2011-01-15 19:24:50 +0000
+++ openlp/plugins/songs/forms/songbookform.py	2011-02-03 03:57:55 +0000
@@ -27,7 +27,7 @@
 from PyQt4 import QtGui
 
 from openlp.core.lib import translate
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.plugins.songs.forms.songbookdialog import Ui_SongBookDialog
 
 class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
@@ -50,7 +50,7 @@
 
     def accept(self):
         if not self.nameEdit.text():
-            criticalErrorMessageBox(
+            critical_error_message_box(
                 message=translate('SongsPlugin.SongBookForm',
                 'You need to type in a name for the book.'))
             self.nameEdit.setFocus()

=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2011-02-02 03:32:25 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2011-02-03 03:57:55 +0000
@@ -32,7 +32,7 @@
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import Receiver, SettingsManager, translate
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.core.ui.wizard import OpenLPWizard
 from openlp.plugins.songs.lib.importer import SongFormat
 
@@ -329,7 +329,7 @@
             source_format = self.formatComboBox.currentIndex()
             if source_format == SongFormat.OpenLP2:
                 if self.openLP2FilenameEdit.text().isEmpty():
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No OpenLP 2.0 Song Database Selected'),
                         translate('SongsPlugin.ImportWizardForm',
@@ -339,7 +339,7 @@
                     return False
             elif source_format == SongFormat.OpenLP1:
                 if self.openLP1FilenameEdit.text().isEmpty():
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No openlp.org 1.x Song Database Selected'),
                         translate('SongsPlugin.ImportWizardForm',
@@ -349,7 +349,7 @@
                     return False
             elif source_format == SongFormat.OpenLyrics:
                 if self.openLyricsFileListWidget.count() == 0:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No OpenLyrics Files Selected'),
                         translate('SongsPlugin.ImportWizardForm',
@@ -359,7 +359,7 @@
                     return False
             elif source_format == SongFormat.OpenSong:
                 if self.openSongFileListWidget.count() == 0:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No OpenSong Files Selected'),
                         translate('SongsPlugin.ImportWizardForm',
@@ -369,7 +369,7 @@
                     return False
             elif source_format == SongFormat.WordsOfWorship:
                 if self.wordsOfWorshipFileListWidget.count() == 0:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No Words of Worship Files Selected'),
                         translate('SongsPlugin.ImportWizardForm',
@@ -379,7 +379,7 @@
                     return False
             elif source_format == SongFormat.CCLI:
                 if self.ccliFileListWidget.count() == 0:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No CCLI Files Selected'),
                         translate('SongsPlugin.ImportWizardForm',
@@ -389,7 +389,7 @@
                     return False
             elif source_format == SongFormat.SongsOfFellowship:
                 if self.songsOfFellowshipFileListWidget.count() == 0:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No Songs of Fellowship File Selected'),
                         translate('SongsPlugin.ImportWizardForm',
@@ -399,7 +399,7 @@
                     return False
             elif source_format == SongFormat.Generic:
                 if self.genericFileListWidget.count() == 0:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No Document/Presentation Selected'),
                         translate('SongsPlugin.ImportWizardForm',
@@ -409,7 +409,7 @@
                     return False
             elif source_format == SongFormat.EasiSlides:
                 if self.easiSlidesFilenameEdit.text().isEmpty():
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No Easislides Songs file selected'),
                         translate('SongsPlugin.ImportWizardForm',
@@ -419,7 +419,7 @@
                     return False
             elif source_format == SongFormat.EasyWorship:
                 if self.ewFilenameEdit.text().isEmpty():
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No EasyWorship Song Database Selected'),
                         translate('SongsPlugin.ImportWizardForm',
@@ -429,7 +429,7 @@
                     return False
             elif source_format == SongFormat.SongBeamer:
                 if self.songBeamerFileListWidget.count() == 0:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         translate('SongsPlugin.ImportWizardForm',
                         'No SongBeamer File Selected'),
                         translate('SongsPlugin.ImportWizardForm',

=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py	2011-02-01 18:05:59 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py	2011-02-03 03:57:55 +0000
@@ -29,7 +29,7 @@
 from sqlalchemy.sql import and_
 
 from openlp.core.lib import Receiver, translate
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
 from openlp.plugins.songs.lib.db import Author, Book, Topic, Song
 from songmaintenancedialog import Ui_SongMaintenanceDialog
@@ -108,14 +108,14 @@
         if item_id != -1:
             item = self.manager.get_object(item_class, item_id)
             if item and len(item.songs) == 0:
-                if criticalErrorMessageBox(title=dlg_title, message=del_text,
+                if critical_error_message_box(title=dlg_title, message=del_text,
                     parent=self, question=True) == QtGui.QMessageBox.Yes:
                     self.manager.delete_object(item_class, item.id)
                     reset_func()
             else:
-                criticalErrorMessageBox(dlg_title, err_text)
+                critical_error_message_box(dlg_title, err_text)
         else:
-            criticalErrorMessageBox(dlg_title, sel_text)
+            critical_error_message_box(dlg_title, sel_text)
 
     def resetAuthors(self):
         """
@@ -159,66 +159,43 @@
     def checkAuthor(self, new_author, edit=False):
         """
         Returns *False* if the given Author already exists, otherwise *True*.
-
-        ``edit``
-            If we edit an item, this should be *True*.
         """
         authors = self.manager.get_all_objects(Author,
             and_(Author.first_name == new_author.first_name,
                 Author.last_name == new_author.last_name,
                 Author.display_name == new_author.display_name))
-        # Check if this author already exists.
-        if len(authors) > 0:
-            # If we edit an existing Author, we need to make sure that we do
-            # not return False when nothing has changed.
-            if edit:
-                for author in authors:
-                    if author.id != new_author.id:
-                        return False
-                return True
-            else:
-                return False
-        else:
-            return True
+        return self.__checkObject(authors, new_author, edit)
 
     def checkTopic(self, new_topic, edit=False):
         """
         Returns *False* if the given Topic already exists, otherwise *True*.
-
-        ``edit``
-            If we edit an item, this should be *True*.
         """
         topics = self.manager.get_all_objects(Topic,
             Topic.name == new_topic.name)
-        if len(topics) > 0:
-            # If we edit an existing Topic, we need to make sure that we do
-            # not return False when nothing has changed.
-            if edit:
-                for topic in topics:
-                    if topic.id != new_topic.id:
-                        return False
-                return True
-            else:
-                return False
-        else:
-            return True
+        return self.__checkObject(topics, new_topic, edit)
 
     def checkBook(self, new_book, edit=False):
         """
         Returns *False* if the given Topic already exists, otherwise *True*.
-
-        ``edit``
-            If we edit an item, this should be *True*.
         """
         books = self.manager.get_all_objects(Book,
             and_(Book.name == new_book.name,
                 Book.publisher == new_book.publisher))
-        if len(books) > 0:
-            # If we edit an existing Book, we need to make sure that we do
+        return self.__checkObject(books, new_book, edit)
+
+    def __checkObject(self, objects, new_object, edit):
+        """
+        Utility method to check for an existing object.
+
+        ``edit``
+            If we edit an item, this should be *True*.
+        """
+        if len(objects) > 0:
+            # If we edit an existing object, we need to make sure that we do
             # not return False when nothing has changed.
             if edit:
-                for book in books:
-                    if book.id != new_book.id:
+                for object in objects:
+                    if object.id != new_object.id:
                         return False
                 return True
             else:
@@ -237,11 +214,11 @@
                 if self.manager.save_object(author):
                     self.resetAuthors()
                 else:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm',
                         'Could not add your author.'))
             else:
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     message=translate('SongsPlugin.SongMaintenanceForm',
                     'This author already exists.'))
 
@@ -252,11 +229,11 @@
                 if self.manager.save_object(topic):
                     self.resetTopics()
                 else:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm',
                         'Could not add your topic.'))
             else:
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     message=translate('SongsPlugin.SongMaintenanceForm',
                     'This topic already exists.'))
 
@@ -268,11 +245,11 @@
                 if self.manager.save_object(book):
                     self.resetBooks()
                 else:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm',
                         'Could not add your book.'))
             else:
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     message=translate('SongsPlugin.SongMaintenanceForm',
                     'This book already exists.'))
 
@@ -301,10 +278,10 @@
                     self.resetAuthors()
                     Receiver.send_message(u'songs_load_list')
                 else:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm',
                         'Could not save your changes.'))
-            elif criticalErrorMessageBox(message=unicode(translate(
+            elif critical_error_message_box(message=unicode(translate(
                 'SongsPlugin.SongMaintenanceForm', 'The author %s already '
                 'exists. Would you like to make songs with author %s use '
                 'the existing author %s?')) % (author.display_name,
@@ -318,7 +295,7 @@
                 author.first_name = temp_first_name
                 author.last_name = temp_last_name
                 author.display_name = temp_display_name
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     message=translate('SongsPlugin.SongMaintenanceForm',
                     'Could not save your modified author, because the '
                     'author already exists.'))
@@ -337,10 +314,10 @@
                 if self.manager.save_object(topic):
                     self.resetTopics()
                 else:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm',
                         'Could not save your changes.'))
-            elif criticalErrorMessageBox(
+            elif critical_error_message_box(
                 message=unicode(translate('SongsPlugin.SongMaintenanceForm',
                 'The topic %s already exists. Would you like to make songs '
                 'with topic %s use the existing topic %s?')) % (topic.name,
@@ -350,7 +327,7 @@
             else:
                 # We restore the topics's old name.
                 topic.name = temp_name
-                criticalErrorMessageBox(
+                critical_error_message_box(
                     message=translate('SongsPlugin.SongMaintenanceForm',
                     'Could not save your modified topic, because it '
                     'already exists.'))
@@ -375,10 +352,10 @@
                 if self.manager.save_object(book):
                     self.resetBooks()
                 else:
-                    criticalErrorMessageBox(
+                    critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm',
                         'Could not save your changes.'))
-            elif criticalErrorMessageBox(
+            elif critical_error_message_box(
                 message=unicode(translate('SongsPlugin.SongMaintenanceForm',
                 'The book %s already exists. Would you like to make songs '
                 'with book %s use the existing book %s?')) % (book.name,

=== modified file 'openlp/plugins/songs/forms/topicsdialog.py'
--- openlp/plugins/songs/forms/topicsdialog.py	2011-02-01 01:02:44 +0000
+++ openlp/plugins/songs/forms/topicsdialog.py	2011-02-03 03:57:55 +0000
@@ -26,7 +26,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import translate, save_cancel_button_box
+from openlp.core.lib import translate
+from openlp.core.lib.ui import save_cancel_button_box
 
 class Ui_TopicsDialog(object):
     def setupUi(self, topicsDialog):

=== modified file 'openlp/plugins/songs/forms/topicsform.py'
--- openlp/plugins/songs/forms/topicsform.py	2011-01-15 19:24:50 +0000
+++ openlp/plugins/songs/forms/topicsform.py	2011-02-03 03:57:55 +0000
@@ -27,7 +27,7 @@
 from PyQt4 import QtGui
 
 from openlp.core.lib import translate
-from openlp.core.ui import criticalErrorMessageBox
+from openlp.core.lib.ui import critical_error_message_box
 from openlp.plugins.songs.forms.topicsdialog import Ui_TopicsDialog
 
 class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
@@ -49,7 +49,8 @@
 
     def accept(self):
         if not self.nameEdit.text():
-            criticalErrorMessageBox(message=translate('SongsPlugin.TopicsForm',
+            critical_error_message_box(
+                message=translate('SongsPlugin.TopicsForm',
                 'You need to type in a topic name.'))
             self.nameEdit.setFocus()
             return False

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2011-02-01 00:33:50 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2011-02-03 03:57:55 +0000
@@ -95,8 +95,6 @@
         self.searchLayout.addLayout(self.searchButtonLayout)
         self.pageLayout.addWidget(self.searchWidget)
         # Signals and slots
-        QtCore.QObject.connect(Receiver.get_receiver(),
-            QtCore.SIGNAL(u'plugin_list_refresh'), self.onSearchTextButtonClick)
         QtCore.QObject.connect(self.searchTextEdit,
             QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
         QtCore.QObject.connect(self.searchTextButton,
@@ -433,6 +431,7 @@
             if add_song:
                 if self.addSongFromService:
                     editId = self.openLyrics.xml_to_song(item.xml_version)
+                    self.onSearchTextButtonClick()
             # Update service with correct song id.
             if editId:
                 Receiver.send_message(u'service_item_update',


Follow ups