← Back to team overview

openlp-core team mailing list archive

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

 

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

Requested reviews:
  Jonathan Corwin (j-corwin)
  Andreas Preikschat (googol)
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~trb143/openlp/settings_migration/+merge/149913

Add tests for Settings 

Clean up Alerts and SongUsage plugins

More Event conversions (UI's).
-- 
https://code.launchpad.net/~trb143/openlp/settings_migration/+merge/149913
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/settings.py'
--- openlp/core/lib/settings.py	2013-02-16 18:24:31 +0000
+++ openlp/core/lib/settings.py	2013-02-21 19:17:32 +0000
@@ -36,9 +36,8 @@
 
 from PyQt4 import QtCore, QtGui
 
-from openlp.core.lib import SlideLimits
+from openlp.core.lib import SlideLimits, UiStrings
 from openlp.core.lib.theme import ThemeLevel
-from openlp.core.lib import UiStrings
 
 
 log = logging.getLogger(__name__)
@@ -70,7 +69,8 @@
     ``__obsolete_settings__``
         Each entry is structured in the following way::
 
-            (u'general/enable slide loop',  u'advanced/slide limits', [(SlideLimits.Wrap, True), (SlideLimits.End, False)])
+            (u'general/enable slide loop',  u'advanced/slide limits',
+                [(SlideLimits.Wrap, True), (SlideLimits.End, False)])
 
         The first entry is the *old key*; it will be removed.
 
@@ -260,7 +260,6 @@
         """
         Settings.__default_settings__ = dict(default_values.items() + Settings.__default_settings__.items())
 
-
     @staticmethod
     def set_filename(ini_file):
         """

=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py	2013-02-07 07:17:19 +0000
+++ openlp/core/lib/ui.py	2013-02-21 19:17:32 +0000
@@ -109,8 +109,8 @@
             button_box.addButton(button, QtGui.QDialogButtonBox.ActionRole)
         else:
             button_box.addButton(*button)
-    QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'), dialog.accept)
-    QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'), dialog.reject)
+    button_box.accepted.connect(dialog.accept)
+    button_box.rejected.connect(dialog.reject)
     return button_box
 
 
@@ -211,7 +211,7 @@
     if not kwargs.pop(u'enabled', True):
         button.setEnabled(False)
     if kwargs.get(u'click'):
-        QtCore.QObject.connect(button, QtCore.SIGNAL(u'clicked()'), kwargs.pop(u'click'))
+        button.clicked.connect(kwargs.pop(u'click'))
     for key in kwargs.keys():
         if key not in [u'text', u'icon', u'tooltip', u'click']:
             log.warn(u'Parameter %s was not consumed in create_button().', key)
@@ -297,8 +297,7 @@
         action_list = ActionList.get_instance()
         action_list.add_action(action, unicode(kwargs.pop(u'category')))
     if kwargs.get(u'triggers'):
-        QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'),
-            kwargs.pop(u'triggers'))
+        action.triggered.connect(kwargs.pop(u'triggers'))
     for key in kwargs.keys():
         if key not in [u'text', u'icon', u'tooltip', u'statustip', u'checked', u'shortcuts', u'category', u'triggers']:
             log.warn(u'Parameter %s was not consumed in create_action().', key)

=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py	2013-02-05 08:05:28 +0000
+++ openlp/core/ui/exceptionform.py	2013-02-21 19:17:32 +0000
@@ -106,7 +106,7 @@
         """
         QtGui.QDialog.__init__(self, parent)
         self.setupUi(self)
-        self.settingsSection = u'crashreport'
+        self.settings_section = u'crashreport'
 
     def exec_(self):
         """
@@ -159,12 +159,11 @@
             '--- Library Versions ---\n%s\n')
         filename = QtGui.QFileDialog.getSaveFileName(self,
             translate('OpenLP.ExceptionForm', 'Save Crash Report'),
-            Settings().value(self.settingsSection + u'/last directory'),
-            translate('OpenLP.ExceptionForm',
-            'Text files (*.txt *.log *.text)'))
+            Settings().value(self.settings_section + u'/last directory'),
+            translate('OpenLP.ExceptionForm', 'Text files (*.txt *.log *.text)'))
         if filename:
             filename = unicode(filename).replace(u'/', os.path.sep)
-            Settings().setValue(self.settingsSection + u'/last directory', os.path.dirname(filename))
+            Settings().setValue(self.settings_section + u'/last directory', os.path.dirname(filename))
             report_text = report_text % self._createReport()
             try:
                 report_file = open(filename, u'w')
@@ -230,7 +229,7 @@
         """
         files = QtGui.QFileDialog.getOpenFileName(
             self, translate('ImagePlugin.ExceptionDialog', 'Select Attachment'),
-                Settings().value(self.settingsSection + u'/last directory'), u'%s (*.*) (*)' % UiStrings().AllFiles)
+                Settings().value(self.settings_section + u'/last directory'), u'%s (*.*) (*)' % UiStrings().AllFiles)
         log.info(u'New files(s) %s', unicode(files))
         if files:
             self.fileAttachment = unicode(files)

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2013-02-07 11:33:47 +0000
+++ openlp/core/ui/maindisplay.py	2013-02-21 19:17:32 +0000
@@ -300,7 +300,7 @@
         self.image(path)
         # Update the preview frame.
         if self.isLive:
-            self.parent().updatePreview()
+            self.live_controller.updatePreview()
         return True
 
     def image(self, path):
@@ -513,6 +513,16 @@
 
     application = property(_get_application)
 
+    def _get_live_controller(self):
+        """
+        Adds the live controller to the class dynamically
+        """
+        if not hasattr(self, u'_live_controller'):
+            self._live_controller = Registry().get(u'live_controller')
+        return self._live_controller
+
+    live_controller = property(_get_live_controller)
+
 
 class AudioPlayer(QtCore.QObject):
     """

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2013-02-07 21:50:25 +0000
+++ openlp/core/ui/servicemanager.py	2013-02-21 19:17:32 +0000
@@ -142,8 +142,7 @@
         self.service_manager_list.setHeaderHidden(True)
         self.service_manager_list.setExpandsOnDoubleClick(False)
         self.service_manager_list.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
-        QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
-            self.context_menu)
+        self.service_manager_list.customContextMenuRequested.connect(self.context_menu)
         self.service_manager_list.setObjectName(u'service_manager_list')
         # enable drop
         self.service_manager_list.__class__.dragEnterEvent = self.drag_enter_event
@@ -202,18 +201,10 @@
             triggers=self.make_live)
         self.layout.addWidget(self.order_toolbar)
         # Connect up our signals and slots
-        QtCore.QObject.connect(self.theme_combo_box, QtCore.SIGNAL(u'activated(int)'),
-            self.on_theme_combo_box_selected)
-        QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
-            self.on_make_live)
-        QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'),
-            self.collapsed)
-        QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'),
-            self.expanded)
-        Registry().register_function(u'theme_update_list', self.update_theme_list)
-        Registry().register_function(u'config_updated', self.config_updated)
-        Registry().register_function(u'config_screen_changed', self.regenerate_service_Items)
-        Registry().register_function(u'theme_update_global', self.theme_change)
+        self.theme_combo_box.activated.connect(self.on_theme_combo_box_selected)
+        self.service_manager_list.doubleClicked.connect(self.on_make_live)
+        self.service_manager_list.itemCollapsed.connect(self.collapsed)
+        self.service_manager_list.itemExpanded.connect(self.expanded)
         # Last little bits of setting up
         self.service_theme = Settings().value(self.main_window.serviceManagerSettingsSection + u'/service theme')
         self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
@@ -273,6 +264,10 @@
              self.service_manager_list.expand,
              self.service_manager_list.collapse
             ])
+        Registry().register_function(u'theme_update_list', self.update_theme_list)
+        Registry().register_function(u'config_updated', self.config_updated)
+        Registry().register_function(u'config_screen_changed', self.regenerate_service_Items)
+        Registry().register_function(u'theme_update_global', self.theme_change)
 
     def drag_enter_event(self, event):
         """

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2013-02-16 12:44:47 +0000
+++ openlp/core/ui/slidecontroller.py	2013-02-21 19:17:32 +0000
@@ -229,7 +229,7 @@
             self.playSlidesOnce = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
                 icon=u':/media/media_time.png', checked=False, shortcuts=[],
                 category=self.category, triggers=self.onPlaySlidesOnce)
-            if Settings().value(self.parent().advancedSettingsSection + u'/slide limits') == SlideLimits.Wrap:
+            if Settings().value(self.main_window.advancedSettingsSection + u'/slide limits') == SlideLimits.Wrap:
                 self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
             else:
                 self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
@@ -582,7 +582,7 @@
                 self.previewListWidget.resizeRowsToContents()
             else:
                 # Sort out image heights.
-                width = self.parent().controlSplitter.sizes()[self.split]
+                width = self.main_window.controlSplitter.sizes()[self.split]
                 for framenumber in range(len(self.serviceItem.get_frames())):
                     self.previewListWidget.setRowHeight(framenumber, width / self.ratio)
         self.onControllerSizeChanged(self.controller.width(), self.controller.height())
@@ -622,7 +622,7 @@
         """
         Updates the Slide Limits variable from the settings.
         """
-        self.slide_limits = Settings().value(self.parent().advancedSettingsSection + u'/slide limits')
+        self.slide_limits = Settings().value(self.main_window.advancedSettingsSection + u'/slide limits')
 
     def enableToolBar(self, item):
         """
@@ -651,7 +651,7 @@
         self.playSlidesLoop.setChecked(False)
         self.playSlidesLoop.setIcon(build_icon(u':/media/media_time.png'))
         if item.is_text():
-            if Settings().value(self.parent().songsSettingsSection + u'/display songbar') and self.slideList:
+            if Settings().value(self.main_window.songsSettingsSection + u'/display songbar') and self.slideList:
                 self.toolbar.setWidgetVisible([u'songMenu'], True)
         if item.is_capable(ItemCapabilities.CanLoop) and len(item.get_frames()) > 1:
             self.toolbar.setWidgetVisible(self.loopList)
@@ -753,7 +753,7 @@
             self._resetBlank()
         Registry().execute(u'%s_start' % serviceItem.name.lower(), [serviceItem, self.isLive, self.hideMode(), slideno])
         self.slideList = {}
-        width = self.parent().controlSplitter.sizes()[self.split]
+        width = self.main_window.controlSplitter.sizes()[self.split]
         self.previewListWidget.clear()
         self.previewListWidget.setRowCount(0)
         self.previewListWidget.setColumnWidth(0, width)
@@ -772,8 +772,8 @@
                     action.setData(counter)
                     QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), self.onTrackTriggered)
                 self.display.audioPlayer.repeat = Settings().value(
-                    self.parent().generalSettingsSection + u'/audio repeat list')
-                if Settings().value(self.parent().generalSettingsSection + u'/audio start paused'):
+                    self.main_window.generalSettingsSection + u'/audio repeat list')
+                if Settings().value(self.main_window.generalSettingsSection + u'/audio start paused'):
                     self.audioPauseItem.setChecked(True)
                     self.display.audioPlayer.pause()
                 else:
@@ -882,7 +882,7 @@
         Allow the main display to blank the main display at startup time
         """
         log.debug(u'mainDisplaySetBackground live = %s' % self.isLive)
-        display_type = Settings().value(self.parent().generalSettingsSection + u'/screen blank')
+        display_type = Settings().value(self.main_window.generalSettingsSection + u'/screen blank')
         if self.screens.which_screen(self.window()) != self.screens.which_screen(self.display):
             # Order done to handle initial conversion
             if display_type == u'themed':
@@ -920,9 +920,9 @@
         self.themeScreen.setChecked(False)
         self.desktopScreen.setChecked(False)
         if checked:
-            Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', u'blanked')
+            Settings().setValue(self.main_window.generalSettingsSection + u'/screen blank', u'blanked')
         else:
-            Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
+            Settings().remove(self.main_window.generalSettingsSection + u'/screen blank')
         self.blankPlugin()
         self.updatePreview()
         self.onToggleLoop()
@@ -939,9 +939,9 @@
         self.themeScreen.setChecked(checked)
         self.desktopScreen.setChecked(False)
         if checked:
-            Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', u'themed')
+            Settings().setValue(self.main_window.generalSettingsSection + u'/screen blank', u'themed')
         else:
-            Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
+            Settings().remove(self.main_window.generalSettingsSection + u'/screen blank')
         self.blankPlugin()
         self.updatePreview()
         self.onToggleLoop()
@@ -958,9 +958,9 @@
         self.themeScreen.setChecked(False)
         self.desktopScreen.setChecked(checked)
         if checked:
-            Settings().setValue(self.parent().generalSettingsSection + u'/screen blank', u'hidden')
+            Settings().setValue(self.main_window.generalSettingsSection + u'/screen blank', u'hidden')
         else:
-            Settings().remove(self.parent().generalSettingsSection + u'/screen blank')
+            Settings().remove(self.main_window.generalSettingsSection + u'/screen blank')
         self.hidePlugin(checked)
         self.updatePreview()
         self.onToggleLoop()
@@ -1260,7 +1260,7 @@
 
     def onGoLive(self):
         """
-        If preview copy slide item to live
+        If preview copy slide item to live controller from Preview Controller
         """
         row = self.previewListWidget.currentRow()
         if -1 < row < self.previewListWidget.rowCount():
@@ -1389,3 +1389,14 @@
         return self._live_controller
 
     live_controller = property(_get_live_controller)
+
+    def _get_main_window(self):
+        """
+        Adds the main window to the class dynamically
+        """
+        if not hasattr(self, u'_main_window'):
+            self._main_window = Registry().get(u'main_window')
+        return self._main_window
+
+    main_window = property(_get_main_window)
+

=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py	2013-02-15 19:24:01 +0000
+++ openlp/core/ui/thememanager.py	2013-02-21 19:17:32 +0000
@@ -105,8 +105,7 @@
         self.theme_list_widget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
         self.theme_list_widget.setObjectName(u'theme_list_widget')
         self.layout.addWidget(self.theme_list_widget)
-        QtCore.QObject.connect(self.theme_list_widget, QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
-            self.context_menu)
+        self.theme_list_widget.customContextMenuRequested.connect(self.context_menu)
         # build the context menu
         self.menu = QtGui.QMenu()
         self.edit_action = create_widget_action(self.menu,
@@ -130,10 +129,8 @@
             text=translate('OpenLP.ThemeManager', '&Export Theme'),
             icon=u':/general/general_export.png', triggers=self.on_export_theme)
         # Signals
-        QtCore.QObject.connect(self.theme_list_widget,
-            QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.change_global_from_screen)
-        QtCore.QObject.connect(self.theme_list_widget,
-            QtCore.SIGNAL(u'currentItemChanged(QListWidgetItem *, QListWidgetItem *)'), self.check_list_state)
+        self.theme_list_widget.doubleClicked.connect(self.change_global_from_screen)
+        self.theme_list_widget.currentItemChanged.connect(self.check_list_state)
         Registry().register_function(u'theme_update_global', self.change_global_from_tab)
         Registry().register_function(u'config_updated', self.config_updated)
         # Variables
@@ -160,7 +157,6 @@
             delete_file(theme_file)
         self.application.set_normal_cursor()
 
-
     def config_updated(self):
         """
         Triggered when Config dialog is updated.

=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py	2013-02-05 08:05:28 +0000
+++ openlp/plugins/alerts/alertsplugin.py	2013-02-21 19:17:32 +0000
@@ -122,7 +122,7 @@
         u'alerts/background color': u'#660000',
         u'alerts/font color': u'#ffffff',
         u'alerts/timeout': 5
-    }
+}
 
 
 class AlertsPlugin(Plugin):
@@ -133,7 +133,7 @@
         self.weight = -3
         self.iconPath = u':/plugins/plugin_alerts.png'
         self.icon = build_icon(self.iconPath)
-        self.alertsmanager = AlertsManager(self)
+        self.alerts_manager = AlertsManager(self)
         self.manager = Manager(u'alerts', init_schema)
         self.alertForm = AlertForm(self)
 
@@ -176,7 +176,7 @@
         Settings().setValue(self.settingsSection + u'/active', self.alertsActive)
 
     def onAlertsTrigger(self):
-        self.alertForm.loadList()
+        self.alertForm.load_list()
         self.alertForm.exec_()
 
     def about(self):
@@ -194,7 +194,8 @@
             u'plural': translate('AlertsPlugin', 'Alerts', 'name plural')
         }
         ## Name for MediaDockManager, SettingsManager ##
-        self.textStrings[StringContent.VisibleName] = {u'title': translate('AlertsPlugin', 'Alerts', 'container title')
+        self.textStrings[StringContent.VisibleName] = {
+            u'title': translate('AlertsPlugin', 'Alerts', 'container title')
         }
 
     def getDisplayJavaScript(self):

=== modified file 'openlp/plugins/alerts/forms/alertdialog.py'
--- openlp/plugins/alerts/forms/alertdialog.py	2013-01-27 20:36:18 +0000
+++ openlp/plugins/alerts/forms/alertdialog.py	2013-02-21 19:17:32 +0000
@@ -32,61 +32,63 @@
 from openlp.core.lib import build_icon, translate
 from openlp.core.lib.ui import create_button, create_button_box
 
+
 class Ui_AlertDialog(object):
-    def setupUi(self, alertDialog):
-        alertDialog.setObjectName(u'alertDialog')
-        alertDialog.resize(400, 300)
-        alertDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
-        self.alertDialogLayout = QtGui.QGridLayout(alertDialog)
-        self.alertDialogLayout.setObjectName(u'alertDialogLayout')
-        self.alertTextLayout = QtGui.QFormLayout()
-        self.alertTextLayout.setObjectName(u'alertTextLayout')
-        self.alertEntryLabel = QtGui.QLabel(alertDialog)
-        self.alertEntryLabel.setObjectName(u'alertEntryLabel')
-        self.alertTextEdit = QtGui.QLineEdit(alertDialog)
-        self.alertTextEdit.setObjectName(u'alertTextEdit')
-        self.alertEntryLabel.setBuddy(self.alertTextEdit)
-        self.alertTextLayout.addRow(self.alertEntryLabel, self.alertTextEdit)
-        self.alertParameter = QtGui.QLabel(alertDialog)
-        self.alertParameter.setObjectName(u'alertParameter')
-        self.parameterEdit = QtGui.QLineEdit(alertDialog)
-        self.parameterEdit.setObjectName(u'parameterEdit')
-        self.alertParameter.setBuddy(self.parameterEdit)
-        self.alertTextLayout.addRow(self.alertParameter, self.parameterEdit)
-        self.alertDialogLayout.addLayout(self.alertTextLayout, 0, 0, 1, 2)
-        self.alertListWidget = QtGui.QListWidget(alertDialog)
-        self.alertListWidget.setAlternatingRowColors(True)
-        self.alertListWidget.setObjectName(u'alertListWidget')
-        self.alertDialogLayout.addWidget(self.alertListWidget, 1, 0)
-        self.manageButtonLayout = QtGui.QVBoxLayout()
-        self.manageButtonLayout.setObjectName(u'manageButtonLayout')
-        self.newButton = QtGui.QPushButton(alertDialog)
-        self.newButton.setIcon(build_icon(u':/general/general_new.png'))
-        self.newButton.setObjectName(u'newButton')
-        self.manageButtonLayout.addWidget(self.newButton)
-        self.saveButton = QtGui.QPushButton(alertDialog)
-        self.saveButton.setEnabled(False)
-        self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
-        self.saveButton.setObjectName(u'saveButton')
-        self.manageButtonLayout.addWidget(self.saveButton)
-        self.deleteButton = create_button(alertDialog, u'deleteButton', role=u'delete', enabled=False,
-            click=alertDialog.onDeleteButtonClicked)
-        self.manageButtonLayout.addWidget(self.deleteButton)
-        self.manageButtonLayout.addStretch()
-        self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1)
+    def setupUi(self, alert_dialog):
+        alert_dialog.setObjectName(u'alert_dialog')
+        alert_dialog.resize(400, 300)
+        alert_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
+        self.alert_dialog_layout = QtGui.QGridLayout(alert_dialog)
+        self.alert_dialog_layout.setObjectName(u'alert_dialog_layout')
+        self.alert_text_layout = QtGui.QFormLayout()
+        self.alert_text_layout.setObjectName(u'alert_text_layout')
+        self.alert_entry_label = QtGui.QLabel(alert_dialog)
+        self.alert_entry_label.setObjectName(u'alert_entry_label')
+        self.alert_text_edit = QtGui.QLineEdit(alert_dialog)
+        self.alert_text_edit.setObjectName(u'alert_text_edit')
+        self.alert_entry_label.setBuddy(self.alert_text_edit)
+        self.alert_text_layout.addRow(self.alert_entry_label, self.alert_text_edit)
+        self.alert_parameter = QtGui.QLabel(alert_dialog)
+        self.alert_parameter.setObjectName(u'alert_parameter')
+        self.parameter_edit = QtGui.QLineEdit(alert_dialog)
+        self.parameter_edit.setObjectName(u'parameter_edit')
+        self.alert_parameter.setBuddy(self.parameter_edit)
+        self.alert_text_layout.addRow(self.alert_parameter, self.parameter_edit)
+        self.alert_dialog_layout.addLayout(self.alert_text_layout, 0, 0, 1, 2)
+        self.alert_list_widget = QtGui.QListWidget(alert_dialog)
+        self.alert_list_widget.setAlternatingRowColors(True)
+        self.alert_list_widget.setObjectName(u'alert_list_widget')
+        self.alert_dialog_layout.addWidget(self.alert_list_widget, 1, 0)
+        self.manage_button_layout = QtGui.QVBoxLayout()
+        self.manage_button_layout.setObjectName(u'manage_button_layout')
+        self.new_button = QtGui.QPushButton(alert_dialog)
+        self.new_button.setIcon(build_icon(u':/general/general_new.png'))
+        self.new_button.setObjectName(u'new_button')
+        self.manage_button_layout.addWidget(self.new_button)
+        self.save_button = QtGui.QPushButton(alert_dialog)
+        self.save_button.setEnabled(False)
+        self.save_button.setIcon(build_icon(u':/general/general_save.png'))
+        self.save_button.setObjectName(u'save_button')
+        self.manage_button_layout.addWidget(self.save_button)
+        self.delete_button = create_button(alert_dialog, u'delete_button', role=u'delete', enabled=False,
+            click=alert_dialog.onDeleteButtonClicked)
+        self.manage_button_layout.addWidget(self.delete_button)
+        self.manage_button_layout.addStretch()
+        self.alert_dialog_layout.addLayout(self.manage_button_layout, 1, 1)
         displayIcon = build_icon(u':/general/general_live.png')
-        self.displayButton = create_button(alertDialog, u'displayButton', icon=displayIcon, enabled=False)
-        self.displayCloseButton = create_button(alertDialog, u'displayCloseButton', icon=displayIcon, enabled=False)
-        self.button_box = create_button_box(alertDialog, u'button_box', [u'close'],
-            [self.displayButton, self.displayCloseButton])
-        self.alertDialogLayout.addWidget(self.button_box, 2, 0, 1, 2)
-        self.retranslateUi(alertDialog)
+        self.display_button = create_button(alert_dialog, u'display_button', icon=displayIcon, enabled=False)
+        self.display_close_button = create_button(alert_dialog, u'display_close_button', icon=displayIcon,
+            enabled=False)
+        self.button_box = create_button_box(alert_dialog, u'button_box', [u'close'],
+            [self.display_button, self.display_close_button])
+        self.alert_dialog_layout.addWidget(self.button_box, 2, 0, 1, 2)
+        self.retranslateUi(alert_dialog)
 
-    def retranslateUi(self, alertDialog):
-        alertDialog.setWindowTitle(translate('AlertsPlugin.AlertForm', 'Alert Message'))
-        self.alertEntryLabel.setText(translate('AlertsPlugin.AlertForm', 'Alert &text:'))
-        self.alertParameter.setText(translate('AlertsPlugin.AlertForm', '&Parameter:'))
-        self.newButton.setText(translate('AlertsPlugin.AlertForm', '&New'))
-        self.saveButton.setText(translate('AlertsPlugin.AlertForm', '&Save'))
-        self.displayButton.setText(translate('AlertsPlugin.AlertForm', 'Displ&ay'))
-        self.displayCloseButton.setText(translate('AlertsPlugin.AlertForm', 'Display && Cl&ose'))
+    def retranslateUi(self, alert_dialog):
+        alert_dialog.setWindowTitle(translate('AlertsPlugin.AlertForm', 'Alert Message'))
+        self.alert_entry_label.setText(translate('AlertsPlugin.AlertForm', 'Alert &text:'))
+        self.alert_parameter.setText(translate('AlertsPlugin.AlertForm', '&Parameter:'))
+        self.new_button.setText(translate('AlertsPlugin.AlertForm', '&New'))
+        self.save_button.setText(translate('AlertsPlugin.AlertForm', '&Save'))
+        self.display_button.setText(translate('AlertsPlugin.AlertForm', 'Displ&ay'))
+        self.display_close_button.setText(translate('AlertsPlugin.AlertForm', 'Display && Cl&ose'))

=== modified file 'openlp/plugins/alerts/forms/alertform.py'
--- openlp/plugins/alerts/forms/alertform.py	2013-02-16 09:24:06 +0000
+++ openlp/plugins/alerts/forms/alertform.py	2013-02-21 19:17:32 +0000
@@ -48,131 +48,131 @@
         self.item_id = None
         super(AlertForm, self).__init__(self.plugin.main_window)
         self.setupUi(self)
-        QtCore.QObject.connect(self.displayButton, QtCore.SIGNAL(u'clicked()'), self.onDisplayClicked)
-        QtCore.QObject.connect(self.displayCloseButton, QtCore.SIGNAL(u'clicked()'), self.onDisplayCloseClicked)
-        QtCore.QObject.connect(self.alertTextEdit, QtCore.SIGNAL(u'textChanged(const QString&)'), self.onTextChanged)
-        QtCore.QObject.connect(self.newButton, QtCore.SIGNAL(u'clicked()'), self.onNewClick)
-        QtCore.QObject.connect(self.saveButton, QtCore.SIGNAL(u'clicked()'), self.onSaveClick)
-        QtCore.QObject.connect(self.alertListWidget, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onDoubleClick)
-        QtCore.QObject.connect(self.alertListWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSingleClick)
-        QtCore.QObject.connect(self.alertListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
+        self.display_button.clicked.connect(self.on_display_clicked)
+        self.display_close_button.clicked.connect(self.on_display_close_clicked)
+        self.alert_text_edit.textChanged.connect(self.on_text_changed)
+        self.new_button.clicked.connect(self.on_new_click)
+        self.save_button.clicked.connect(self.on_save_all)
+        self.alert_list_widget.doubleClicked.connect(self.on_double_click)
+        self.alert_list_widget.clicked.connect(self.on_single_click)
+        self.alert_list_widget.currentRowChanged.connect(self.on_current_row_changed)
 
     def exec_(self):
         """
         Execute the dialog and return the exit code.
         """
-        self.displayButton.setEnabled(False)
-        self.displayCloseButton.setEnabled(False)
-        self.alertTextEdit.setText(u'')
+        self.display_button.setEnabled(False)
+        self.display_close_button.setEnabled(False)
+        self.alert_text_edit.setText(u'')
         return QtGui.QDialog.exec_(self)
 
-    def loadList(self):
+    def load_list(self):
         """
         Loads the list with alerts.
         """
-        self.alertListWidget.clear()
+        self.alert_list_widget.clear()
         alerts = self.manager.get_all_objects(AlertItem, order_by_ref=AlertItem.text)
         for alert in alerts:
             item_name = QtGui.QListWidgetItem(alert.text)
             item_name.setData(QtCore.Qt.UserRole, alert.id)
-            self.alertListWidget.addItem(item_name)
-            if alert.text == unicode(self.alertTextEdit.text()):
+            self.alert_list_widget.addItem(item_name)
+            if alert.text == unicode(self.alert_text_edit.text()):
                 self.item_id = alert.id
-                self.alertListWidget.setCurrentRow(self.alertListWidget.row(item_name))
+                self.alert_list_widget.setCurrentRow(self.alert_list_widget.row(item_name))
 
-    def onDisplayClicked(self):
+    def on_display_clicked(self):
         """
         Display the current alert text.
         """
-        self.triggerAlert(self.alertTextEdit.text())
+        self.trigger_alert(self.alert_text_edit.text())
 
-    def onDisplayCloseClicked(self):
+    def on_display_close_clicked(self):
         """
         Close the alert preview.
         """
-        if self.triggerAlert(self.alertTextEdit.text()):
+        if self.trigger_alert(self.alert_text_edit.text()):
             self.close()
 
     def onDeleteButtonClicked(self):
         """
         Deletes the selected item.
         """
-        item = self.alertListWidget.currentItem()
+        item = self.alert_list_widget.currentItem()
         if item:
             item_id = item.data(QtCore.Qt.UserRole)
             self.manager.delete_object(AlertItem, item_id)
-            row = self.alertListWidget.row(item)
-            self.alertListWidget.takeItem(row)
+            row = self.alert_list_widget.row(item)
+            self.alert_list_widget.takeItem(row)
         self.item_id = None
-        self.alertTextEdit.setText(u'')
+        self.alert_text_edit.setText(u'')
 
-    def onNewClick(self):
+    def on_new_click(self):
         """
         Create a new alert.
         """
-        if not self.alertTextEdit.text():
+        if not self.alert_text_edit.text():
             QtGui.QMessageBox.information(self,
                 translate('AlertsPlugin.AlertForm', 'New Alert'),
                 translate('AlertsPlugin.AlertForm', 'You haven\'t specified any text for your alert. \n'
                     'Please type in some text before clicking New.'))
         else:
             alert = AlertItem()
-            alert.text = self.alertTextEdit.text()
+            alert.text = self.alert_text_edit.text()
             self.manager.save_object(alert)
-        self.loadList()
+        self.load_list()
 
-    def onSaveClick(self):
+    def on_save_all(self):
         """
         Save the alert, we are editing.
         """
         if self.item_id:
             alert = self.manager.get_object(AlertItem, self.item_id)
-            alert.text = self.alertTextEdit.text()
+            alert.text = self.alert_text_edit.text()
             self.manager.save_object(alert)
             self.item_id = None
-            self.loadList()
-        self.saveButton.setEnabled(False)
+            self.load_list()
+        self.save_button.setEnabled(False)
 
-    def onTextChanged(self):
+    def on_text_changed(self):
         """
         Enable save button when data has been changed by editing the form.
         """
         # Only enable the button, if we are editing an item.
         if self.item_id:
-            self.saveButton.setEnabled(True)
-        if self.alertTextEdit.text():
-            self.displayButton.setEnabled(True)
-            self.displayCloseButton.setEnabled(True)
+            self.save_button.setEnabled(True)
+        if self.alert_text_edit.text():
+            self.display_button.setEnabled(True)
+            self.display_close_button.setEnabled(True)
         else:
-            self.displayButton.setEnabled(False)
-            self.displayCloseButton.setEnabled(False)
+            self.display_button.setEnabled(False)
+            self.display_close_button.setEnabled(False)
 
-    def onDoubleClick(self):
+    def on_double_click(self):
         """
         List item has been double clicked to display it.
         """
-        item = self.alertListWidget.selectedIndexes()[0]
-        bitem = self.alertListWidget.item(item.row())
-        self.triggerAlert(bitem.text())
-        self.alertTextEdit.setText(bitem.text())
+        item = self.alert_list_widget.selectedIndexes()[0]
+        bitem = self.alert_list_widget.item(item.row())
+        self.trigger_alert(bitem.text())
+        self.alert_text_edit.setText(bitem.text())
         self.item_id = bitem.data(QtCore.Qt.UserRole)
-        self.saveButton.setEnabled(False)
+        self.save_button.setEnabled(False)
 
-    def onSingleClick(self):
+    def on_single_click(self):
         """
         List item has been single clicked to add it to the edit field so it can
         be changed.
         """
-        item = self.alertListWidget.selectedIndexes()[0]
-        bitem = self.alertListWidget.item(item.row())
-        self.alertTextEdit.setText(bitem.text())
+        item = self.alert_list_widget.selectedIndexes()[0]
+        bitem = self.alert_list_widget.item(item.row())
+        self.alert_text_edit.setText(bitem.text())
         self.item_id = bitem.data(QtCore.Qt.UserRole)
         # If the alert does not contain '<>' we clear the ParameterEdit field.
-        if self.alertTextEdit.text().find(u'<>') == -1:
-            self.parameterEdit.setText(u'')
-        self.saveButton.setEnabled(False)
+        if self.alert_text_edit.text().find(u'<>') == -1:
+            self.parameter_edit.setText(u'')
+        self.save_button.setEnabled(False)
 
-    def triggerAlert(self, text):
+    def trigger_alert(self, text):
         """
         Prepares the alert text for displaying.
 
@@ -182,42 +182,44 @@
         if not text:
             return False
         # We found '<>' in the alert text, but the ParameterEdit field is empty.
-        if text.find(u'<>') != -1 and not self.parameterEdit.text() and QtGui.QMessageBox.question(self,
+        if text.find(u'<>') != -1 and not self.parameter_edit.text() and QtGui.QMessageBox.question(self,
                 translate('AlertsPlugin.AlertForm', 'No Parameter Found'),
                 translate('AlertsPlugin.AlertForm', 'You have not entered a parameter to be replaced.\n'
                     'Do you want to continue anyway?'),
             QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
-            self.parameterEdit.setFocus()
+            self.parameter_edit.setFocus()
             return False
         # The ParameterEdit field is not empty, but we have not found '<>'
         # in the alert text.
-        elif text.find(u'<>') == -1 and self.parameterEdit.text() and QtGui.QMessageBox.question(self,
+        elif text.find(u'<>') == -1 and self.parameter_edit.text() and QtGui.QMessageBox.question(self,
                 translate('AlertsPlugin.AlertForm', 'No Placeholder Found'),
                 translate('AlertsPlugin.AlertForm', 'The alert text does not contain \'<>\'.\n'
                     'Do you want to continue anyway?'),
             QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
-            self.parameterEdit.setFocus()
+            self.parameter_edit.setFocus()
             return False
-        text = text.replace(u'<>', self.parameterEdit.text())
+
+        text = text.replace(u'<>', self.parameter_edit.text())
+        self.plugin.alerts_manager.display_alert(text)
         self.plugin.alertsmanager.display_alert(text)
         return True
 
-    def onCurrentRowChanged(self, row):
+    def on_current_row_changed(self, row):
         """
-        Called when the *alertListWidget*'s current row has been changed. This
+        Called when the *alert_list_widget*'s current row has been changed. This
         enables or disables buttons which require an item to act on.
 
         ``row``
             The row (int). If there is no current row, the value is -1.
         """
         if row == -1:
-            self.displayButton.setEnabled(False)
-            self.displayCloseButton.setEnabled(False)
-            self.saveButton.setEnabled(False)
-            self.deleteButton.setEnabled(False)
+            self.display_button.setEnabled(False)
+            self.display_close_button.setEnabled(False)
+            self.save_button.setEnabled(False)
+            self.delete_button.setEnabled(False)
         else:
-            self.displayButton.setEnabled(True)
-            self.displayCloseButton.setEnabled(True)
-            self.deleteButton.setEnabled(True)
+            self.display_button.setEnabled(True)
+            self.display_close_button.setEnabled(True)
+            self.delete_button.setEnabled(True)
             # We do not need to enable the save button, as it is only enabled
-            # when typing text in the "alertTextEdit".
+            # when typing text in the "alert_text_edit".

=== modified file 'openlp/plugins/alerts/lib/alertsmanager.py'
--- openlp/plugins/alerts/lib/alertsmanager.py	2013-02-16 09:24:06 +0000
+++ openlp/plugins/alerts/lib/alertsmanager.py	2013-02-21 19:17:32 +0000
@@ -49,7 +49,6 @@
 
     def __init__(self, parent):
         QtCore.QObject.__init__(self, parent)
-        self.screen = None
         self.timer_id = 0
         self.alert_list = []
         Registry().register_function(u'live_display_active', self.generate_alert)

=== modified file 'openlp/plugins/songusage/forms/songusagedeletedialog.py'
--- openlp/plugins/songusage/forms/songusagedeletedialog.py	2013-01-27 20:36:18 +0000
+++ openlp/plugins/songusage/forms/songusagedeletedialog.py	2013-02-21 19:17:32 +0000
@@ -32,29 +32,30 @@
 from openlp.core.lib import translate
 from openlp.core.lib.ui import create_button_box
 
+
 class Ui_SongUsageDeleteDialog(object):
-    def setupUi(self, songUsageDeleteDialog):
-        songUsageDeleteDialog.setObjectName(u'songUsageDeleteDialog')
-        songUsageDeleteDialog.resize(291, 243)
-        self.verticalLayout = QtGui.QVBoxLayout(songUsageDeleteDialog)
-        self.verticalLayout.setSpacing(8)
-        self.verticalLayout.setContentsMargins(8, 8, 8, 8)
-        self.verticalLayout.setObjectName(u'verticalLayout')
-        self.deleteLabel = QtGui.QLabel(songUsageDeleteDialog)
-        self.deleteLabel.setObjectName(u'deleteLabel')
-        self.verticalLayout.addWidget(self.deleteLabel)
-        self.deleteCalendar = QtGui.QCalendarWidget(songUsageDeleteDialog)
-        self.deleteCalendar.setFirstDayOfWeek(QtCore.Qt.Sunday)
-        self.deleteCalendar.setGridVisible(True)
-        self.deleteCalendar.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader)
-        self.deleteCalendar.setObjectName(u'deleteCalendar')
-        self.verticalLayout.addWidget(self.deleteCalendar)
-        self.button_box = create_button_box(songUsageDeleteDialog, u'button_box', [u'cancel', u'ok'])
-        self.verticalLayout.addWidget(self.button_box)
-        self.retranslateUi(songUsageDeleteDialog)
+    def setupUi(self, song_usage_delete_dialog):
+        song_usage_delete_dialog.setObjectName(u'song_usage_delete_dialog')
+        song_usage_delete_dialog.resize(291, 243)
+        self.vertical_layout = QtGui.QVBoxLayout(song_usage_delete_dialog)
+        self.vertical_layout.setSpacing(8)
+        self.vertical_layout.setContentsMargins(8, 8, 8, 8)
+        self.vertical_layout.setObjectName(u'vertical_layout')
+        self.delete_label = QtGui.QLabel(song_usage_delete_dialog)
+        self.delete_label.setObjectName(u'delete_label')
+        self.vertical_layout.addWidget(self.delete_label)
+        self.delete_calendar = QtGui.QCalendarWidget(song_usage_delete_dialog)
+        self.delete_calendar.setFirstDayOfWeek(QtCore.Qt.Sunday)
+        self.delete_calendar.setGridVisible(True)
+        self.delete_calendar.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader)
+        self.delete_calendar.setObjectName(u'delete_calendar')
+        self.vertical_layout.addWidget(self.delete_calendar)
+        self.button_box = create_button_box(song_usage_delete_dialog, u'button_box', [u'cancel', u'ok'])
+        self.vertical_layout.addWidget(self.button_box)
+        self.retranslateUi(song_usage_delete_dialog)
 
-    def retranslateUi(self, songUsageDeleteDialog):
-        songUsageDeleteDialog.setWindowTitle(translate('SongUsagePlugin.SongUsageDeleteForm', 'Delete Song Usage Data'))
-        self.deleteLabel.setText(
+    def retranslateUi(self, song_usage_delete_dialog):
+        song_usage_delete_dialog.setWindowTitle(translate('SongUsagePlugin.SongUsageDeleteForm', 'Delete Song Usage Data'))
+        self.delete_label.setText(
             translate('SongUsagePlugin.SongUsageDeleteForm', 'Select the date up to which the song usage data '
                 'should be deleted. All data recorded before this date will be permanently deleted.'))

=== modified file 'openlp/plugins/songusage/forms/songusagedeleteform.py'
--- openlp/plugins/songusage/forms/songusagedeleteform.py	2013-02-12 16:50:42 +0000
+++ openlp/plugins/songusage/forms/songusagedeleteform.py	2013-02-21 19:17:32 +0000
@@ -45,10 +45,9 @@
         self.manager = manager
         QtGui.QDialog.__init__(self, parent)
         self.setupUi(self)
-        QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
-            self.onButtonBoxClicked)
+        self.button_box.clicked.connect(self.on_button_box_clicked)
 
-    def onButtonBoxClicked(self, button):
+    def on_button_box_clicked(self, button):
         if self.button_box.standardButton(button) == QtGui.QDialogButtonBox.Ok:
             ret = QtGui.QMessageBox.question(self,
                 translate('SongUsagePlugin.SongUsageDeleteForm', 'Delete Selected Song Usage Events?'),
@@ -56,12 +55,12 @@
                     'Are you sure you want to delete selected Song Usage data?'),
                 QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
             if ret == QtGui.QMessageBox.Yes:
-                deleteDate = self.deleteCalendar.selectedDate().toPyDate()
-                self.manager.delete_all_objects(SongUsageItem, SongUsageItem.usagedate <= deleteDate)
+                delete_date = self.delete_calendar.selectedDate().toPyDate()
+                self.manager.delete_all_objects(SongUsageItem, SongUsageItem.usagedate <= delete_date)
                 self.main_window.information_message(
                     translate('SongUsagePlugin.SongUsageDeleteForm', 'Deletion Successful'),
                     translate(
-                        'SongUsagePlugin.SongUsageDeleteForm', 'All requested data has been deleted successfully. ')
+                        'SongUsagePlugin.SongUsageDeleteForm', 'All requested data has been deleted successfully.')
                 )
                 self.accept()
         else:
@@ -75,4 +74,4 @@
             self._main_window = Registry().get(u'main_window')
         return self._main_window
 
-    main_window = property(_get_main_window)
\ No newline at end of file
+    main_window = property(_get_main_window)

=== modified file 'openlp/plugins/songusage/forms/songusagedetaildialog.py'
--- openlp/plugins/songusage/forms/songusagedetaildialog.py	2013-01-27 20:36:18 +0000
+++ openlp/plugins/songusage/forms/songusagedetaildialog.py	2013-02-21 19:17:32 +0000
@@ -32,56 +32,56 @@
 from openlp.core.lib import build_icon, translate
 from openlp.core.lib.ui import create_button_box
 
+
 class Ui_SongUsageDetailDialog(object):
-    def setupUi(self, songUsageDetailDialog):
-        songUsageDetailDialog.setObjectName(u'songUsageDetailDialog')
-        songUsageDetailDialog.resize(609, 413)
-        self.verticalLayout = QtGui.QVBoxLayout(songUsageDetailDialog)
-        self.verticalLayout.setSpacing(8)
-        self.verticalLayout.setContentsMargins(8, 8, 8, 8)
-        self.verticalLayout.setObjectName(u'verticalLayout')
-        self.dateRangeGroupBox = QtGui.QGroupBox(songUsageDetailDialog)
-        self.dateRangeGroupBox.setObjectName(u'dateRangeGroupBox')
-        self.dateHorizontalLayout = QtGui.QHBoxLayout(self.dateRangeGroupBox)
-        self.dateHorizontalLayout.setSpacing(8)
-        self.dateHorizontalLayout.setContentsMargins(8, 8, 8, 8)
-        self.dateHorizontalLayout.setObjectName(u'dateHorizontalLayout')
-        self.fromDate = QtGui.QCalendarWidget(self.dateRangeGroupBox)
-        self.fromDate.setObjectName(u'fromDate')
-        self.dateHorizontalLayout.addWidget(self.fromDate)
-        self.toLabel = QtGui.QLabel(self.dateRangeGroupBox)
-        self.toLabel.setScaledContents(False)
-        self.toLabel.setAlignment(QtCore.Qt.AlignCenter)
-        self.toLabel.setObjectName(u'toLabel')
-        self.dateHorizontalLayout.addWidget(self.toLabel)
-        self.toDate = QtGui.QCalendarWidget(self.dateRangeGroupBox)
-        self.toDate.setObjectName(u'toDate')
-        self.dateHorizontalLayout.addWidget(self.toDate)
-        self.verticalLayout.addWidget(self.dateRangeGroupBox)
-        self.fileGroupBox = QtGui.QGroupBox(self.dateRangeGroupBox)
-        self.fileGroupBox.setObjectName(u'fileGroupBox')
-        self.fileHorizontalLayout = QtGui.QHBoxLayout(self.fileGroupBox)
-        self.fileHorizontalLayout.setSpacing(8)
-        self.fileHorizontalLayout.setContentsMargins(8, 8, 8, 8)
-        self.fileHorizontalLayout.setObjectName(u'fileHorizontalLayout')
-        self.fileLineEdit = QtGui.QLineEdit(self.fileGroupBox)
-        self.fileLineEdit.setObjectName(u'fileLineEdit')
-        self.fileLineEdit.setReadOnly(True)
-        self.fileHorizontalLayout.addWidget(self.fileLineEdit)
-        self.saveFilePushButton = QtGui.QPushButton(self.fileGroupBox)
-        self.saveFilePushButton.setMaximumWidth(self.saveFilePushButton.size().height())
-        self.saveFilePushButton.setIcon(build_icon(u':/general/general_open.png'))
-        self.saveFilePushButton.setObjectName(u'saveFilePushButton')
-        self.fileHorizontalLayout.addWidget(self.saveFilePushButton)
-        self.verticalLayout.addWidget(self.fileGroupBox)
-        self.button_box = create_button_box(songUsageDetailDialog, u'button_box', [u'cancel', u'ok'])
-        self.verticalLayout.addWidget(self.button_box)
-        self.retranslateUi(songUsageDetailDialog)
-        QtCore.QObject.connect(self.saveFilePushButton, QtCore.SIGNAL(u'clicked()'),
-            songUsageDetailDialog.defineOutputLocation)
+    def setupUi(self, song_usage_detail_dialog):
+        song_usage_detail_dialog.setObjectName(u'song_usage_detail_dialog')
+        song_usage_detail_dialog.resize(609, 413)
+        self.vertical_layout = QtGui.QVBoxLayout(song_usage_detail_dialog)
+        self.vertical_layout.setSpacing(8)
+        self.vertical_layout.setContentsMargins(8, 8, 8, 8)
+        self.vertical_layout.setObjectName(u'vertical_layout')
+        self.date_range_group_box = QtGui.QGroupBox(song_usage_detail_dialog)
+        self.date_range_group_box.setObjectName(u'date_range_group_box')
+        self.date_horizontal_layout = QtGui.QHBoxLayout(self.date_range_group_box)
+        self.date_horizontal_layout.setSpacing(8)
+        self.date_horizontal_layout.setContentsMargins(8, 8, 8, 8)
+        self.date_horizontal_layout.setObjectName(u'date_horizontal_layout')
+        self.from_date_calendar = QtGui.QCalendarWidget(self.date_range_group_box)
+        self.from_date_calendar.setObjectName(u'from_date_calendar')
+        self.date_horizontal_layout.addWidget(self.from_date_calendar)
+        self.to_label = QtGui.QLabel(self.date_range_group_box)
+        self.to_label.setScaledContents(False)
+        self.to_label.setAlignment(QtCore.Qt.AlignCenter)
+        self.to_label.setObjectName(u'to_label')
+        self.date_horizontal_layout.addWidget(self.to_label)
+        self.to_date_calendar = QtGui.QCalendarWidget(self.date_range_group_box)
+        self.to_date_calendar.setObjectName(u'to_date_calendar')
+        self.date_horizontal_layout.addWidget(self.to_date_calendar)
+        self.vertical_layout.addWidget(self.date_range_group_box)
+        self.file_group_box = QtGui.QGroupBox(self.date_range_group_box)
+        self.file_group_box.setObjectName(u'file_group_box')
+        self.file_horizontal_layout = QtGui.QHBoxLayout(self.file_group_box)
+        self.file_horizontal_layout.setSpacing(8)
+        self.file_horizontal_layout.setContentsMargins(8, 8, 8, 8)
+        self.file_horizontal_layout.setObjectName(u'file_horizontal_layout')
+        self.file_line_edit = QtGui.QLineEdit(self.file_group_box)
+        self.file_line_edit.setObjectName(u'file_line_edit')
+        self.file_line_edit.setReadOnly(True)
+        self.file_horizontal_layout.addWidget(self.file_line_edit)
+        self.save_file_push_button = QtGui.QPushButton(self.file_group_box)
+        self.save_file_push_button.setMaximumWidth(self.save_file_push_button.size().height())
+        self.save_file_push_button.setIcon(build_icon(u':/general/general_open.png'))
+        self.save_file_push_button.setObjectName(u'save_file_push_button')
+        self.file_horizontal_layout.addWidget(self.save_file_push_button)
+        self.vertical_layout.addWidget(self.file_group_box)
+        self.button_box = create_button_box(song_usage_detail_dialog, u'button_box', [u'cancel', u'ok'])
+        self.vertical_layout.addWidget(self.button_box)
+        self.retranslateUi(song_usage_detail_dialog)
+        self.save_file_push_button.clicked.connect(song_usage_detail_dialog.define_output_location)
 
-    def retranslateUi(self, songUsageDetailDialog):
-        songUsageDetailDialog.setWindowTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Song Usage Extraction'))
-        self.dateRangeGroupBox.setTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Select Date Range'))
-        self.toLabel.setText(translate('SongUsagePlugin.SongUsageDetailForm', 'to'))
-        self.fileGroupBox.setTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Report Location'))
+    def retranslateUi(self, song_usage_detail_dialog):
+        song_usage_detail_dialog.setWindowTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Song Usage Extraction'))
+        self.date_range_group_box.setTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Select Date Range'))
+        self.to_label.setText(translate('SongUsagePlugin.SongUsageDetailForm', 'to'))
+        self.file_group_box.setTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Report Location'))

=== modified file 'openlp/plugins/songusage/forms/songusagedetailform.py'
--- openlp/plugins/songusage/forms/songusagedetailform.py	2013-02-05 21:42:15 +0000
+++ openlp/plugins/songusage/forms/songusagedetailform.py	2013-02-21 19:17:32 +0000
@@ -39,6 +39,7 @@
 
 log = logging.getLogger(__name__)
 
+
 class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
     """
     Class documentation goes here.
@@ -57,13 +58,11 @@
         """
         We need to set up the screen
         """
-        toDate = Settings().value(self.plugin.settingsSection + u'/to date')
-        fromDate = Settings().value(self.plugin.settingsSection + u'/from date')
-        self.fromDate.setSelectedDate(fromDate)
-        self.toDate.setSelectedDate(toDate)
-        self.fileLineEdit.setText(Settings().value(self.plugin.settingsSection + u'/last directory export'))
+        self.from_date_calendar.setSelectedDate(Settings().value(self.plugin.settingsSection + u'/from date'))
+        self.to_date_calendar.setSelectedDate(Settings().value(self.plugin.settingsSection + u'/to date'))
+        self.file_line_edit.setText(Settings().value(self.plugin.settingsSection + u'/last directory export'))
 
-    def defineOutputLocation(self):
+    def define_output_location(self):
         """
         Triggered when the Directory selection button is clicked
         """
@@ -72,14 +71,14 @@
             Settings().value(self.plugin.settingsSection + u'/last directory export'))
         if path:
             Settings().setValue(self.plugin.settingsSection + u'/last directory export', path)
-            self.fileLineEdit.setText(path)
+            self.file_line_edit.setText(path)
 
     def accept(self):
         """
         Ok was triggered so lets save the data and run the report
         """
         log.debug(u'accept')
-        path = self.fileLineEdit.text()
+        path = self.file_line_edit.text()
         if not path:
             self.main_window.error_message(
                 translate('SongUsagePlugin.SongUsageDetailForm', 'Output Path Not Selected'),
@@ -88,36 +87,36 @@
             )
             return
         check_directory_exists(path)
-        filename = translate('SongUsagePlugin.SongUsageDetailForm', 'usage_detail_%s_%s.txt') % (
-            self.fromDate.selectedDate().toString(u'ddMMyyyy'),
-            self.toDate.selectedDate().toString(u'ddMMyyyy'))
-        Settings().setValue(u'songusage/from date', self.fromDate.selectedDate())
-        Settings().setValue(u'songusage/to date', self.toDate.selectedDate())
+        file_name = translate('SongUsagePlugin.SongUsageDetailForm', 'usage_detail_%s_%s.txt') % (
+            self.from_date_calendar.selectedDate().toString(u'ddMMyyyy'),
+            self.to_date_calendar.selectedDate().toString(u'ddMMyyyy'))
+        Settings().setValue(self.plugin.settingsSection + u'/from date', self.from_date_calendar.selectedDate())
+        Settings().setValue(self.plugin.settingsSection + u'/to date', self.to_date_calendar.selectedDate())
         usage = self.plugin.manager.get_all_objects(
             SongUsageItem, and_(
-            SongUsageItem.usagedate >= self.fromDate.selectedDate().toPyDate(),
-            SongUsageItem.usagedate < self.toDate.selectedDate().toPyDate()),
+            SongUsageItem.usagedate >= self.from_date_calendar.selectedDate().toPyDate(),
+            SongUsageItem.usagedate < self.to_date_calendar.selectedDate().toPyDate()),
             [SongUsageItem.usagedate, SongUsageItem.usagetime])
-        outname = os.path.join(path, filename)
-        fileHandle = None
+        report_file_name = os.path.join(path, file_name)
+        file_handle = None
         try:
-            fileHandle = open(outname, u'w')
+            file_handle = open(report_file_name, u'w')
             for instance in usage:
                 record = u'\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",' \
                     u'\"%s\",\"%s\"\n' % (instance.usagedate,
                     instance.usagetime, instance.title, instance.copyright,
                     instance.ccl_number, instance.authors, instance.plugin_name, instance.source)
-                fileHandle.write(record.encode(u'utf-8'))
+                file_handle.write(record.encode(u'utf-8'))
             self.main_window.information_message(
                 translate('SongUsagePlugin.SongUsageDetailForm', 'Report Creation'),
                 translate('SongUsagePlugin.SongUsageDetailForm', 'Report \n%s \n'
-                    'has been successfully created. ') % outname
+                    'has been successfully created. ') % report_file_name
             )
         except IOError:
             log.exception(u'Failed to write out song usage records')
         finally:
-            if fileHandle:
-                fileHandle.close()
+            if file_handle:
+                file_handle.close()
         self.close()
 
     def _get_main_window(self):
@@ -128,4 +127,4 @@
             self._main_window = Registry().get(u'main_window')
         return self._main_window
 
-    main_window = property(_get_main_window)
\ No newline at end of file
+    main_window = property(_get_main_window)

=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py	2013-02-07 11:33:47 +0000
+++ openlp/plugins/songusage/songusageplugin.py	2013-02-21 19:17:32 +0000
@@ -42,7 +42,6 @@
 
 log = logging.getLogger(__name__)
 
-
 YEAR = QtCore.QDate().currentDate().year()
 if QtCore.QDate().currentDate().month() < 9:
     YEAR -= 1
@@ -54,7 +53,7 @@
         u'songusage/to date': QtCore.QDate(YEAR, 8, 31),
         u'songusage/from date': QtCore.QDate(YEAR - 1, 9, 1),
         u'songusage/last directory export': u''
-    }
+}
 
 
 class SongUsagePlugin(Plugin):
@@ -67,7 +66,7 @@
         self.icon = build_icon(u':/plugins/plugin_songusage.png')
         self.activeIcon = build_icon(u':/songusage/song_usage_active.png')
         self.inactiveIcon = build_icon(u':/songusage/song_usage_inactive.png')
-        self.songUsageActive = False
+        self.song_usage_active = False
 
     def checkPreConditions(self):
         return self.manager.session is not None
@@ -83,59 +82,59 @@
         """
         log.info(u'add tools menu')
         self.toolsMenu = tools_menu
-        self.songUsageMenu = QtGui.QMenu(tools_menu)
-        self.songUsageMenu.setObjectName(u'songUsageMenu')
-        self.songUsageMenu.setTitle(translate('SongUsagePlugin', '&Song Usage Tracking'))
+        self.song_usage_menu = QtGui.QMenu(tools_menu)
+        self.song_usage_menu.setObjectName(u'song_usage_menu')
+        self.song_usage_menu.setTitle(translate('SongUsagePlugin', '&Song Usage Tracking'))
         # SongUsage Delete
-        self.songUsageDelete = create_action(tools_menu, u'songUsageDelete',
+        self.song_usage_delete = create_action(tools_menu, u'songUsageDelete',
             text=translate('SongUsagePlugin', '&Delete Tracking Data'),
             statustip=translate('SongUsagePlugin', 'Delete song usage data up to a specified date.'),
-            triggers=self.onSongUsageDelete)
+            triggers=self.on_song_usage_delete)
         # SongUsage Report
-        self.songUsageReport = create_action(tools_menu, u'songUsageReport',
+        self.song_usage_report = create_action(tools_menu, u'songUsageReport',
             text=translate('SongUsagePlugin', '&Extract Tracking Data'),
             statustip=translate('SongUsagePlugin', 'Generate a report on song usage.'),
-            triggers=self.onSongUsageReport)
+            triggers=self.on_song_usage_report)
         # SongUsage activation
-        self.songUsageStatus = create_action(tools_menu, u'songUsageStatus',
+        self.song_usage_status = create_action(tools_menu, u'songUsageStatus',
             text=translate('SongUsagePlugin', 'Toggle Tracking'),
             statustip=translate('SongUsagePlugin', 'Toggle the tracking of song usage.'), checked=False,
-            shortcuts=[QtCore.Qt.Key_F4], triggers=self.toggleSongUsageState)
+            shortcuts=[QtCore.Qt.Key_F4], triggers=self.toggle_song_usage_state)
         # Add Menus together
-        self.toolsMenu.addAction(self.songUsageMenu.menuAction())
-        self.songUsageMenu.addAction(self.songUsageStatus)
-        self.songUsageMenu.addSeparator()
-        self.songUsageMenu.addAction(self.songUsageReport)
-        self.songUsageMenu.addAction(self.songUsageDelete)
-        self.songUsageActiveButton = QtGui.QToolButton(self.main_window.statusBar)
-        self.songUsageActiveButton.setCheckable(True)
-        self.songUsageActiveButton.setAutoRaise(True)
-        self.songUsageActiveButton.setStatusTip(translate('SongUsagePlugin', 'Toggle the tracking of song usage.'))
-        self.songUsageActiveButton.setObjectName(u'songUsageActiveButton')
-        self.main_window.statusBar.insertPermanentWidget(1, self.songUsageActiveButton)
-        self.songUsageActiveButton.hide()
+        self.toolsMenu.addAction(self.song_usage_menu.menuAction())
+        self.song_usage_menu.addAction(self.song_usage_status)
+        self.song_usage_menu.addSeparator()
+        self.song_usage_menu.addAction(self.song_usage_report)
+        self.song_usage_menu.addAction(self.song_usage_delete)
+        self.song_usage_active_button = QtGui.QToolButton(self.main_window.statusBar)
+        self.song_usage_active_button.setCheckable(True)
+        self.song_usage_active_button.setAutoRaise(True)
+        self.song_usage_active_button.setStatusTip(translate('SongUsagePlugin', 'Toggle the tracking of song usage.'))
+        self.song_usage_active_button.setObjectName(u'song_usage_active_button')
+        self.main_window.statusBar.insertPermanentWidget(1, self.song_usage_active_button)
+        self.song_usage_active_button.hide()
         # Signals and slots
-        QtCore.QObject.connect(self.songUsageStatus, QtCore.SIGNAL(u'visibilityChanged(bool)'),
-            self.songUsageStatus.setChecked)
-        QtCore.QObject.connect(self.songUsageActiveButton, QtCore.SIGNAL(u'toggled(bool)'), self.toggleSongUsageState)
-        self.songUsageMenu.menuAction().setVisible(False)
+        QtCore.QObject.connect(self.song_usage_status, QtCore.SIGNAL(u'visibilityChanged(bool)'),
+            self.song_usage_status.setChecked)
+        self.song_usage_active_button.toggled.connect(self.toggle_song_usage_state)
+        self.song_usage_menu.menuAction().setVisible(False)
 
     def initialise(self):
         log.info(u'SongUsage Initialising')
         Plugin.initialise(self)
         Registry().register_function(u'slidecontroller_live_started', self.display_song_usage)
         Registry().register_function(u'print_service_started', self.print_song_usage)
-        self.songUsageActive = Settings().value(self.settingsSection + u'/active')
+        self.song_usage_active = Settings().value(self.settingsSection + u'/active')
         # Set the button and checkbox state
-        self.setButtonState()
+        self.set_button_state()
         action_list = ActionList.get_instance()
-        action_list.add_action(self.songUsageStatus, translate('SongUsagePlugin', 'Song Usage'))
-        action_list.add_action(self.songUsageDelete, translate('SongUsagePlugin', 'Song Usage'))
-        action_list.add_action(self.songUsageReport, translate('SongUsagePlugin', 'Song Usage'))
-        self.songUsageDeleteForm = SongUsageDeleteForm(self.manager, self.main_window)
-        self.songUsageDetailForm = SongUsageDetailForm(self, self.main_window)
-        self.songUsageMenu.menuAction().setVisible(True)
-        self.songUsageActiveButton.show()
+        action_list.add_action(self.song_usage_status, translate('SongUsagePlugin', 'Song Usage'))
+        action_list.add_action(self.song_usage_delete, translate('SongUsagePlugin', 'Song Usage'))
+        action_list.add_action(self.song_usage_report, translate('SongUsagePlugin', 'Song Usage'))
+        self.song_usage_delete_form = SongUsageDeleteForm(self.manager, self.main_window)
+        self.song_usage_detail_form = SongUsageDetailForm(self, self.main_window)
+        self.song_usage_menu.menuAction().setVisible(True)
+        self.song_usage_active_button.show()
 
     def finalise(self):
         """
@@ -144,44 +143,43 @@
         log.info(u'Plugin Finalise')
         self.manager.finalise()
         Plugin.finalise(self)
-        self.songUsageMenu.menuAction().setVisible(False)
+        self.song_usage_menu.menuAction().setVisible(False)
         action_list = ActionList.get_instance()
-        action_list.remove_action(self.songUsageStatus, translate('SongUsagePlugin', 'Song Usage'))
-        action_list.remove_action(self.songUsageDelete, translate('SongUsagePlugin', 'Song Usage'))
-        action_list.remove_action(self.songUsageReport, translate('SongUsagePlugin', 'Song Usage'))
-        self.songUsageActiveButton.hide()
+        action_list.remove_action(self.song_usage_status, translate('SongUsagePlugin', 'Song Usage'))
+        action_list.remove_action(self.song_usage_delete, translate('SongUsagePlugin', 'Song Usage'))
+        action_list.remove_action(self.song_usage_report, translate('SongUsagePlugin', 'Song Usage'))
+        self.song_usage_active_button.hide()
         # stop any events being processed
-        self.songUsageActive = False
+        self.song_usage_active = False
 
-    def toggleSongUsageState(self):
+    def toggle_song_usage_state(self):
         """
         Manage the state of the audit collection and amend
         the UI when necessary,
         """
-        self.songUsageActive = not self.songUsageActive
-        Settings().setValue(self.settingsSection + u'/active', self.songUsageActive)
-        self.setButtonState()
+        self.song_usage_active = not self.song_usage_active
+        Settings().setValue(self.settingsSection + u'/active', self.song_usage_active)
+        self.set_button_state()
 
-    def setButtonState(self):
+    def set_button_state(self):
         """
         Keep buttons inline.  Turn of signals to stop dead loop but we need the
         button and check box set correctly.
         """
-        self.songUsageActiveButton.blockSignals(True)
-        self.songUsageStatus.blockSignals(True)
-        if self.songUsageActive:
-            self.songUsageActiveButton.setIcon(self.activeIcon)
-            self.songUsageStatus.setChecked(True)
-            self.songUsageActiveButton.setChecked(True)
-            self.songUsageActiveButton.setToolTip(translate('SongUsagePlugin', 'Song usage tracking is active.'))
+        self.song_usage_active_button.blockSignals(True)
+        self.song_usage_status.blockSignals(True)
+        if self.song_usage_active:
+            self.song_usage_active_button.setIcon(self.activeIcon)
+            self.song_usage_status.setChecked(True)
+            self.song_usage_active_button.setChecked(True)
+            self.song_usage_active_button.setToolTip(translate('SongUsagePlugin', 'Song usage tracking is active.'))
         else:
-            self.songUsageActiveButton.setIcon(self.inactiveIcon)
-            self.songUsageStatus.setChecked(False)
-            self.songUsageActiveButton.setChecked(False)
-            self.songUsageActiveButton.setToolTip(translate('SongUsagePlugin', 'Song usage tracking is inactive.'))
-        self.songUsageActiveButton.blockSignals(False)
-        self.songUsageStatus.blockSignals(False)
-
+            self.song_usage_active_button.setIcon(self.inactiveIcon)
+            self.song_usage_status.setChecked(False)
+            self.song_usage_active_button.setChecked(False)
+            self.song_usage_active_button.setToolTip(translate('SongUsagePlugin', 'Song usage tracking is inactive.'))
+        self.song_usage_active_button.blockSignals(False)
+        self.song_usage_status.blockSignals(False)
 
     def display_song_usage(self, item):
         """
@@ -197,7 +195,7 @@
 
     def _add_song_usage(self, source, item):
         audit = item[0].audit
-        if self.songUsageActive and audit:
+        if self.song_usage_active and audit:
             song_usage_item = SongUsageItem()
             song_usage_item.usagedate = datetime.today()
             song_usage_item.usagetime = datetime.now().time()
@@ -209,12 +207,12 @@
             song_usage_item.source = source
             self.manager.save_object(song_usage_item)
 
-    def onSongUsageDelete(self):
-        self.songUsageDeleteForm.exec_()
+    def on_song_usage_delete(self):
+        self.song_usage_delete_form.exec_()
 
-    def onSongUsageReport(self):
-        self.songUsageDetailForm.initialise()
-        self.songUsageDetailForm.exec_()
+    def on_song_usage_report(self):
+        self.song_usage_detail_form.initialise()
+        self.song_usage_detail_form.exec_()
 
     def about(self):
         about_text = translate('SongUsagePlugin', '<strong>SongUsage Plugin'

=== added file 'tests/functional/openlp_core_lib/test_settings.py'
--- tests/functional/openlp_core_lib/test_settings.py	1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_core_lib/test_settings.py	2013-02-21 19:17:32 +0000
@@ -0,0 +1,93 @@
+"""
+    Package to test the openlp.core.lib.settings package.
+"""
+import os
+from unittest import TestCase
+from tempfile import mkstemp
+
+from openlp.core.lib import Settings
+
+from PyQt4 import QtGui
+
+
+class TestSettings(TestCase):
+
+    def setUp(self):
+        """
+        Create the UI
+        """
+        fd, self.ini_file = mkstemp(u'.ini')
+        Settings().set_filename(self.ini_file)
+        self.application = QtGui.QApplication.instance()
+
+    def tearDown(self):
+        """
+        Delete all the C++ objects at the end so that we don't have a segfault
+        """
+        del self.application
+        os.unlink(self.ini_file)
+        os.unlink(Settings().fileName())
+
+    def settings_basic_test(self):
+        """
+        Test the Settings creation and its default usage
+        """
+        # GIVEN: A new Settings setup
+
+        # WHEN reading a setting for the first time
+        default_value = Settings().value(u'general/has run wizard')
+
+        # THEN the default value is returned
+        assert default_value is False, u'The default value should be False'
+
+        # WHEN a new value is saved into config
+        Settings().setValue(u'general/has run wizard', True)
+
+        # THEN the new value is returned when re-read
+        assert Settings().value(u'general/has run wizard') is True, u'The saved value should have been returned'
+
+    def settings_override_test(self):
+        """
+        Test the Settings creation and its override usage
+        """
+        # GIVEN: an override for the settings
+        screen_settings = {
+            u'test/extend': u'very wide',
+        }
+        Settings().extend_default_settings(screen_settings)
+
+        # WHEN reading a setting for the first time
+        extend = Settings().value(u'test/extend')
+
+        # THEN the default value is returned
+        assert extend == u'very wide', u'The default value of "very wide" should be returned'
+
+        # WHEN a new value is saved into config
+        Settings().setValue(u'test/extend', u'very short')
+
+        # THEN the new value is returned when re-read
+        assert Settings().value(u'test/extend') == u'very short', u'The saved value should be returned'
+
+    def settings_override_with_group_test(self):
+        """
+        Test the Settings creation and its override usage - with groups
+        """
+        # GIVEN: an override for the settings
+        screen_settings = {
+            u'test/extend': u'very wide',
+        }
+        Settings.extend_default_settings(screen_settings)
+
+        # WHEN reading a setting for the first time
+        settings = Settings()
+        settings.beginGroup(u'test')
+        extend = settings.value(u'extend')
+
+        # THEN the default value is returned
+        assert extend == u'very wide', u'The default value defined should be returned'
+
+        # WHEN a new value is saved into config
+        Settings().setValue(u'test/extend', u'very short')
+
+        # THEN the new value is returned when re-read
+        assert Settings().value(u'test/extend') == u'very short', u'The saved value should be returned'


Follow ups