← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/cleanups into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/cleanups into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
  Andreas Preikschat (googol)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/cleanups/+merge/153772

Fix an import issue after the last cleanup and did some more refactoring

- Fix an issue with an import that changed in the last cleanup effort (as a side note, the plugins manager test is a good one to use to check for import regressions)
- Clean up some test comments
- Added another test
- Migrated the TopicsForm to use a property instead of accessing the edit box directly
- Various bits of coding standards refactoring
-- 
https://code.launchpad.net/~raoul-snyman/openlp/cleanups/+merge/153772
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py	2013-03-05 13:55:50 +0000
+++ openlp/core/ui/firsttimeform.py	2013-03-18 12:12:23 +0000
@@ -221,7 +221,7 @@
             time.sleep(0.2)
             self._preWizard()
             self._performWizard()
-            self._postWizard()
+            self._post_wizard()
             self.application.set_normal_cursor()
 
     def update_screen_list_combo(self):
@@ -380,7 +380,7 @@
         # Try to give the wizard a chance to repaint itself
         time.sleep(0.1)
 
-    def _postWizard(self):
+    def _post_wizard(self):
         """
         Clean up the UI after the process has finished.
         """

=== modified file 'openlp/core/ui/wizard.py'
--- openlp/core/ui/wizard.py	2013-03-07 17:58:15 +0000
+++ openlp/core/ui/wizard.py	2013-03-18 12:12:23 +0000
@@ -91,8 +91,8 @@
         self.cancel_button = self.button(QtGui.QWizard.CancelButton)
         self.setupUi(image)
         self.register_fields()
-        self.customInit()
-        self.customSignals()
+        self.custom_init()
+        self.custom_signals()
         self.currentIdChanged.connect(self.on_current_id_changed)
         self.error_copy_to_button.clicked.connect(self.on_error_copy_to_button_clicked)
         self.error_save_to_button.clicked.connect(self.on_error_save_to_button_clicked)
@@ -106,8 +106,8 @@
         self.setOptions(QtGui.QWizard.IndependentPages |
             QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage)
         add_welcome_page(self, image)
-        self.addCustomPages()
-        self.addProgressPage()
+        self.add_custom_pages()
+        self.add_progress_page()
         self.retranslateUi()
 
     def register_fields(self):
@@ -116,7 +116,25 @@
         """
         pass
 
-    def addProgressPage(self):
+    def custom_init(self):
+        """
+        Hook method for custom initialisation
+        """
+        pass
+
+    def custom_signals(self):
+        """
+        Hook method for adding custom signals
+        """
+        pass
+
+    def add_custom_pages(self):
+        """
+        Hook method for wizards to add extra pages
+        """
+        pass
+
+    def add_progress_page(self):
         """
         Add the progress page for the wizard. This page informs the user how
         the wizard is progressing with its task.
@@ -180,7 +198,7 @@
         if self.page(pageId) == self.progress_page:
             self.pre_wizard()
             self.performWizard()
-            self.postWizard()
+            self.post_wizard()
         else:
             self.custom_cage_changed(pageId)
 
@@ -227,7 +245,7 @@
         self.progress_bar.setMaximum(1188)
         self.progress_bar.setValue(0)
 
-    def postWizard(self):
+    def post_wizard(self):
         """
         Clean up the UI after the import has finished.
         """

=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py	2013-03-07 11:42:56 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py	2013-03-18 12:12:23 +0000
@@ -97,7 +97,7 @@
         next_button = self.button(QtGui.QWizard.NextButton)
         next_button.setEnabled(BibleFormat.get_availability(index))
 
-    def customInit(self):
+    def custom_init(self):
         """
         Perform any custom initialisation for bible importing.
         """
@@ -112,7 +112,7 @@
         self.restart()
         self.selectStack.setCurrentIndex(0)
 
-    def customSignals(self):
+    def custom_signals(self):
         """
         Set up the signals used in the bible importer.
         """
@@ -123,7 +123,7 @@
         self.openSongBrowseButton.clicked.connect(self.onOpenSongBrowseButtonClicked)
         self.openlp1BrowseButton.clicked.connect(self.onOpenlp1BrowseButtonClicked)
 
-    def addCustomPages(self):
+    def add_custom_pages(self):
         """
         Add the bible import specific wizard pages.
         """

=== modified file 'openlp/plugins/bibles/forms/bibleupgradeform.py'
--- openlp/plugins/bibles/forms/bibleupgradeform.py	2013-03-07 11:01:06 +0000
+++ openlp/plugins/bibles/forms/bibleupgradeform.py	2013-03-18 12:12:23 +0000
@@ -107,7 +107,7 @@
         if self.page(pageId) == self.progress_page:
             self.preWizard()
             self.performWizard()
-            self.postWizard()
+            self.post_wizard()
         elif self.page(pageId) == self.selectPage and not self.files:
             self.next()
 
@@ -140,21 +140,21 @@
                 success = False
         return success
 
-    def customInit(self):
+    def custom_init(self):
         """
         Perform any custom initialisation for bible upgrading.
         """
         self.manager.set_process_dialog(self)
         self.restart()
 
-    def customSignals(self):
+    def custom_signals(self):
         """
         Set up the signals used in the bible importer.
         """
         self.backupBrowseButton.clicked.connect(self.onBackupBrowseButtonClicked)
         self.noBackupCheckBox.toggled.connect(self.onNoBackupCheckBoxToggled)
 
-    def addCustomPages(self):
+    def add_custom_pages(self):
         """
         Add the bible import specific wizard pages.
         """
@@ -170,7 +170,7 @@
         self.backupInfoLabel.setObjectName(u'backupInfoLabel')
         self.backupLayout.addWidget(self.backupInfoLabel)
         self.selectLabel = QtGui.QLabel(self.backupPage)
-        self.selectLabel.setObjectName(u'selectLabel')
+        self.selectLabel.setObjectName(u'select_label')
         self.backupLayout.addWidget(self.selectLabel)
         self.formLayout = QtGui.QFormLayout()
         self.formLayout.setMargin(0)
@@ -528,7 +528,7 @@
         if old_bible is not None:
             old_bible.close_connection()
 
-    def postWizard(self):
+    def post_wizard(self):
         """
         Clean up the UI after the import has finished.
         """
@@ -559,4 +559,4 @@
             self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade failed.'))
         # Remove temp directory.
         shutil.rmtree(self.temp_dir, True)
-        OpenLPWizard.postWizard(self)
+        OpenLPWizard.post_wizard(self)

=== modified file 'openlp/plugins/bibles/forms/booknameform.py'
--- openlp/plugins/bibles/forms/booknameform.py	2013-03-07 11:01:06 +0000
+++ openlp/plugins/bibles/forms/booknameform.py	2013-03-18 12:12:23 +0000
@@ -44,6 +44,7 @@
 
 log = logging.getLogger(__name__)
 
+
 class BookNameForm(QDialog, Ui_BookNameDialog):
     """
     Class to manage a dialog which help the user to refer a book name a
@@ -57,11 +58,11 @@
         """
         QDialog.__init__(self, parent)
         self.setupUi(self)
-        self.customSignals()
+        self.custom_signals()
         self.book_names = BibleStrings().BookNames
         self.book_id = False
 
-    def customSignals(self):
+    def custom_signals(self):
         """
         Set up the signals used in the booknameform.
         """

=== modified file 'openlp/plugins/songs/forms/authorsdialog.py'
--- openlp/plugins/songs/forms/authorsdialog.py	2013-02-10 10:39:28 +0000
+++ openlp/plugins/songs/forms/authorsdialog.py	2013-03-18 12:12:23 +0000
@@ -49,7 +49,7 @@
         self.dialog_layout = QtGui.QVBoxLayout(authors_dialog)
         self.dialog_layout.setObjectName(u'dialog_layout')
         self.author_layout = QtGui.QFormLayout()
-        self.author_layout.setObjectName(u'authorLayout')
+        self.author_layout.setObjectName(u'author_layout')
         self.first_name_label = QtGui.QLabel(authors_dialog)
         self.first_name_label.setObjectName(u'first_name_label')
         self.first_name_edit = QtGui.QLineEdit(authors_dialog)

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2013-03-16 11:05:52 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2013-03-18 12:12:23 +0000
@@ -578,9 +578,9 @@
         self.verse_delete_button.setEnabled(True)
 
     def on_verse_add_button_clicked(self):
-        self.verse_form.setVerse(u'', True)
+        self.verse_form.set_verse(u'', True)
         if self.verse_form.exec_():
-            after_text, verse_tag, verse_num = self.verse_form.getVerse()
+            after_text, verse_tag, verse_num = self.verse_form.get_verse()
             verse_def = u'%s%s' % (verse_tag, verse_num)
             item = QtGui.QTableWidgetItem(after_text)
             item.setData(QtCore.Qt.UserRole, verse_def)
@@ -596,9 +596,9 @@
         if item:
             temp_text = item.text()
             verse_id = item.data(QtCore.Qt.UserRole)
-            self.verse_form.setVerse(temp_text, True, verse_id)
+            self.verse_form.set_verse(temp_text, True, verse_id)
             if self.verse_form.exec_():
-                after_text, verse_tag, verse_num = self.verse_form.getVerse()
+                after_text, verse_tag, verse_num = self.verse_form.get_verse()
                 verse_def = u'%s%s' % (verse_tag, verse_num)
                 item.setData(QtCore.Qt.UserRole, verse_def)
                 item.setText(after_text)
@@ -630,12 +630,12 @@
                 verse_list += u'---[%s:%s]---\n' % (verse_tag, verse_num)
                 verse_list += item.text()
                 verse_list += u'\n'
-            self.verse_form.setVerse(verse_list)
+            self.verse_form.set_verse(verse_list)
         else:
-            self.verse_form.setVerse(u'')
+            self.verse_form.set_verse(u'')
         if not self.verse_form.exec_():
             return
-        verse_list = self.verse_form.getVerseAll()
+        verse_list = self.verse_form.get_all_verses()
         verse_list = unicode(verse_list.replace(u'\r\n', u'\n'))
         self.verse_list_widget.clear()
         self.verse_list_widget.setRowCount(0)
@@ -797,7 +797,7 @@
         """
         Free up autocompletion memory on dialog exit
         """
-        log.debug (u'SongEditForm.clearCaches')
+        log.debug(u'SongEditForm.clearCaches')
         self.authors = []
         self.themes = []
         self.books = []

=== modified file 'openlp/plugins/songs/forms/editversedialog.py'
--- openlp/plugins/songs/forms/editversedialog.py	2013-02-24 18:13:50 +0000
+++ openlp/plugins/songs/forms/editversedialog.py	2013-03-18 12:12:23 +0000
@@ -33,56 +33,57 @@
 from openlp.core.lib.ui import UiStrings, create_button_box
 from openlp.plugins.songs.lib import VerseType
 
+
 class Ui_EditVerseDialog(object):
-    def setupUi(self, editVerseDialog):
-        editVerseDialog.setObjectName(u'editVerseDialog')
-        editVerseDialog.resize(400, 400)
-        editVerseDialog.setModal(True)
-        self.dialogLayout = QtGui.QVBoxLayout(editVerseDialog)
-        self.dialogLayout.setObjectName(u'dialog_layout')
-        self.verseTextEdit = SpellTextEdit(editVerseDialog)
-        self.verseTextEdit.setObjectName(u'verseTextEdit')
-        self.dialogLayout.addWidget(self.verseTextEdit)
-        self.verseTypeLayout = QtGui.QHBoxLayout()
-        self.verseTypeLayout.setObjectName(u'verseTypeLayout')
-        self.splitButton = QtGui.QPushButton(editVerseDialog)
-        self.splitButton.setIcon(build_icon(u':/general/general_add.png'))
-        self.splitButton.setObjectName(u'splitButton')
-        self.verseTypeLayout.addWidget(self.splitButton)
-        self.verseTypeLabel = QtGui.QLabel(editVerseDialog)
-        self.verseTypeLabel.setObjectName(u'verseTypeLabel')
-        self.verseTypeLayout.addWidget(self.verseTypeLabel)
-        self.verseTypeComboBox = QtGui.QComboBox(editVerseDialog)
-        self.verseTypeComboBox.addItems([u'', u'', u'', u'', u'', u'', u''])
-        self.verseTypeComboBox.setObjectName(u'verseTypeComboBox')
-        self.verseTypeLabel.setBuddy(self.verseTypeComboBox)
-        self.verseTypeLayout.addWidget(self.verseTypeComboBox)
-        self.verseNumberBox = QtGui.QSpinBox(editVerseDialog)
-        self.verseNumberBox.setMinimum(1)
-        self.verseNumberBox.setObjectName(u'verseNumberBox')
-        self.verseTypeLayout.addWidget(self.verseNumberBox)
-        self.insertButton = QtGui.QPushButton(editVerseDialog)
-        self.insertButton.setIcon(build_icon(u':/general/general_add.png'))
-        self.insertButton.setObjectName(u'insertButton')
-        self.verseTypeLayout.addWidget(self.insertButton)
-        self.verseTypeLayout.addStretch()
-        self.dialogLayout.addLayout(self.verseTypeLayout)
-        self.button_box = create_button_box(editVerseDialog, u'button_box', [u'cancel', u'ok'])
-        self.dialogLayout.addWidget(self.button_box)
-        self.retranslateUi(editVerseDialog)
+    def setupUi(self, edit_verse_dialog):
+        edit_verse_dialog.setObjectName(u'edit_verse_dialog')
+        edit_verse_dialog.resize(400, 400)
+        edit_verse_dialog.setModal(True)
+        self.dialog_layout = QtGui.QVBoxLayout(edit_verse_dialog)
+        self.dialog_layout.setObjectName(u'dialog_layout')
+        self.verse_text_edit = SpellTextEdit(edit_verse_dialog)
+        self.verse_text_edit.setObjectName(u'verse_text_edit')
+        self.dialog_layout.addWidget(self.verse_text_edit)
+        self.verse_type_layout = QtGui.QHBoxLayout()
+        self.verse_type_layout.setObjectName(u'verse_type_layout')
+        self.split_button = QtGui.QPushButton(edit_verse_dialog)
+        self.split_button.setIcon(build_icon(u':/general/general_add.png'))
+        self.split_button.setObjectName(u'split_button')
+        self.verse_type_layout.addWidget(self.split_button)
+        self.verse_type_label = QtGui.QLabel(edit_verse_dialog)
+        self.verse_type_label.setObjectName(u'verse_type_label')
+        self.verse_type_layout.addWidget(self.verse_type_label)
+        self.verse_type_combo_box = QtGui.QComboBox(edit_verse_dialog)
+        self.verse_type_combo_box.addItems([u'', u'', u'', u'', u'', u'', u''])
+        self.verse_type_combo_box.setObjectName(u'verse_type_combo_box')
+        self.verse_type_label.setBuddy(self.verse_type_combo_box)
+        self.verse_type_layout.addWidget(self.verse_type_combo_box)
+        self.verse_number_box = QtGui.QSpinBox(edit_verse_dialog)
+        self.verse_number_box.setMinimum(1)
+        self.verse_number_box.setObjectName(u'verse_number_box')
+        self.verse_type_layout.addWidget(self.verse_number_box)
+        self.insert_button = QtGui.QPushButton(edit_verse_dialog)
+        self.insert_button.setIcon(build_icon(u':/general/general_add.png'))
+        self.insert_button.setObjectName(u'insert_button')
+        self.verse_type_layout.addWidget(self.insert_button)
+        self.verse_type_layout.addStretch()
+        self.dialog_layout.addLayout(self.verse_type_layout)
+        self.button_box = create_button_box(edit_verse_dialog, u'button_box', [u'cancel', u'ok'])
+        self.dialog_layout.addWidget(self.button_box)
+        self.retranslateUi(edit_verse_dialog)
 
-    def retranslateUi(self, editVerseDialog):
-        editVerseDialog.setWindowTitle(translate('SongsPlugin.EditVerseForm', 'Edit Verse'))
-        self.verseTypeLabel.setText(translate('SongsPlugin.EditVerseForm', '&Verse type:'))
-        self.verseTypeComboBox.setItemText(VerseType.Verse, VerseType.translated_names[VerseType.Verse])
-        self.verseTypeComboBox.setItemText(VerseType.Chorus, VerseType.translated_names[VerseType.Chorus])
-        self.verseTypeComboBox.setItemText(VerseType.Bridge, VerseType.translated_names[VerseType.Bridge])
-        self.verseTypeComboBox.setItemText(VerseType.PreChorus, VerseType.translated_names[VerseType.PreChorus])
-        self.verseTypeComboBox.setItemText(VerseType.Intro, VerseType.translated_names[VerseType.Intro])
-        self.verseTypeComboBox.setItemText(VerseType.Ending, VerseType.translated_names[VerseType.Ending])
-        self.verseTypeComboBox.setItemText(VerseType.Other, VerseType.translated_names[VerseType.Other])
-        self.splitButton.setText(UiStrings().Split)
-        self.splitButton.setToolTip(UiStrings().SplitToolTip)
-        self.insertButton.setText(translate('SongsPlugin.EditVerseForm', '&Insert'))
-        self.insertButton.setToolTip(translate('SongsPlugin.EditVerseForm',
+    def retranslateUi(self, edit_verse_dialog):
+        edit_verse_dialog.setWindowTitle(translate('SongsPlugin.EditVerseForm', 'Edit Verse'))
+        self.verse_type_label.setText(translate('SongsPlugin.EditVerseForm', '&Verse type:'))
+        self.verse_type_combo_box.setItemText(VerseType.Verse, VerseType.translated_names[VerseType.Verse])
+        self.verse_type_combo_box.setItemText(VerseType.Chorus, VerseType.translated_names[VerseType.Chorus])
+        self.verse_type_combo_box.setItemText(VerseType.Bridge, VerseType.translated_names[VerseType.Bridge])
+        self.verse_type_combo_box.setItemText(VerseType.PreChorus, VerseType.translated_names[VerseType.PreChorus])
+        self.verse_type_combo_box.setItemText(VerseType.Intro, VerseType.translated_names[VerseType.Intro])
+        self.verse_type_combo_box.setItemText(VerseType.Ending, VerseType.translated_names[VerseType.Ending])
+        self.verse_type_combo_box.setItemText(VerseType.Other, VerseType.translated_names[VerseType.Other])
+        self.split_button.setText(UiStrings().Split)
+        self.split_button.setToolTip(UiStrings().SplitToolTip)
+        self.insert_button.setText(translate('SongsPlugin.EditVerseForm', '&Insert'))
+        self.insert_button.setToolTip(translate('SongsPlugin.EditVerseForm',
             'Split a slide into two by inserting a verse splitter.'))

=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py	2013-03-08 08:14:39 +0000
+++ openlp/plugins/songs/forms/editverseform.py	2013-03-18 12:12:23 +0000
@@ -50,56 +50,56 @@
         """
         QtGui.QDialog.__init__(self, parent)
         self.setupUi(self)
-        self.verseTextEdit.customContextMenuRequested.connect(self.contextMenu)
-        self.insertButton.clicked.connect(self.onInsertButtonClicked)
-        self.splitButton.clicked.connect(self.onSplitButtonClicked)
-        self.verseTextEdit.cursorPositionChanged.connect(self.onCursorPositionChanged)
-        self.verseTypeComboBox.currentIndexChanged.connect(self.onVerseTypeComboBoxChanged)
+        self.verse_text_edit.customContextMenuRequested.connect(self.context_menu)
+        self.insert_button.clicked.connect(self.on_insert_button_clicked)
+        self.split_button.clicked.connect(self.on_split_button_clicked)
+        self.verse_text_edit.cursorPositionChanged.connect(self.on_cursor_position_changed)
+        self.verse_type_combo_box.currentIndexChanged.connect(self.on_verse_type_combo_box_changed)
 
-    def contextMenu(self, point):
+    def context_menu(self, point):
         item = self.serviceManagerList.itemAt(point)
 
-    def insertVerse(self, verse_tag, verse_num=1):
-        if self.verseTextEdit.textCursor().columnNumber() != 0:
-            self.verseTextEdit.insertPlainText(u'\n')
+    def insert_verse(self, verse_tag, verse_num=1):
+        if self.verse_text_edit.textCursor().columnNumber() != 0:
+            self.verse_text_edit.insertPlainText(u'\n')
         verse_tag = VerseType.translated_name(verse_tag)
-        self.verseTextEdit.insertPlainText(u'---[%s:%s]---\n' % (verse_tag, verse_num))
-        self.verseTextEdit.setFocus()
+        self.verse_text_edit.insertPlainText(u'---[%s:%s]---\n' % (verse_tag, verse_num))
+        self.verse_text_edit.setFocus()
 
-    def onSplitButtonClicked(self):
-        text = self.verseTextEdit.toPlainText()
-        position = self.verseTextEdit.textCursor().position()
+    def on_split_button_clicked(self):
+        text = self.verse_text_edit.toPlainText()
+        position = self.verse_text_edit.textCursor().position()
         insert_string = u'[---]'
         if position and text[position-1] != u'\n':
-             insert_string = u'\n' + insert_string
+            insert_string = u'\n' + insert_string
         if position ==  len(text) or text[position] != u'\n':
-             insert_string += u'\n'
-        self.verseTextEdit.insertPlainText(insert_string)
-        self.verseTextEdit.setFocus()
-
-    def onInsertButtonClicked(self):
-        verse_type_index = self.verseTypeComboBox.currentIndex()
-        self.insertVerse(VerseType.tags[verse_type_index], self.verseNumberBox.value())
-
-    def onVerseTypeComboBoxChanged(self):
-        self.updateSuggestedVerseNumber()
-
-    def onCursorPositionChanged(self):
-        self.updateSuggestedVerseNumber()
-
-    def updateSuggestedVerseNumber(self):
+            insert_string += u'\n'
+        self.verse_text_edit.insertPlainText(insert_string)
+        self.verse_text_edit.setFocus()
+
+    def on_insert_button_clicked(self):
+        verse_type_index = self.verse_type_combo_box.currentIndex()
+        self.insert_verse(VerseType.tags[verse_type_index], self.verse_number_box.value())
+
+    def on_verse_type_combo_box_changed(self):
+        self.update_suggested_verse_number()
+
+    def on_cursor_position_changed(self):
+        self.update_suggested_verse_number()
+
+    def update_suggested_verse_number(self):
         """
         Adjusts the verse number SpinBox in regard to the selected verse type and the cursor's position.
         """
-        position = self.verseTextEdit.textCursor().position()
-        text = self.verseTextEdit.toPlainText()
+        position = self.verse_text_edit.textCursor().position()
+        text = self.verse_text_edit.toPlainText()
         verse_name = VerseType.translated_names[
-            self.verseTypeComboBox.currentIndex()]
+            self.verse_type_combo_box.currentIndex()]
         if not text:
             return
         position = text.rfind(u'---[%s' % verse_name, 0, position)
         if position == -1:
-            self.verseNumberBox.setValue(1)
+            self.verse_number_box.setValue(1)
             return
         text = text[position:]
         position = text.find(u']---')
@@ -108,39 +108,39 @@
         text = text[:position + 4]
         match = VERSE_REGEX.match(text)
         if match:
-            verse_tag = match.group(1)
+            # TODO: Not used, remove?
+            # verse_tag = match.group(1)
             try:
                 verse_num = int(match.group(2)) + 1
             except ValueError:
                 verse_num = 1
-            self.verseNumberBox.setValue(verse_num)
+            self.verse_number_box.setValue(verse_num)
 
-    def setVerse(self, text, single=False, tag=u'%s1' % VerseType.tags[VerseType.Verse]):
-        self.hasSingleVerse = single
+    def set_verse(self, text, single=False, tag=u'%s1' % VerseType.tags[VerseType.Verse]):
+        self.has_single_verse = single
         if single:
             verse_type_index = VerseType.from_tag(tag[0], None)
             verse_number = tag[1:]
             if verse_type_index is not None:
-                self.verseTypeComboBox.setCurrentIndex(verse_type_index)
-            self.verseNumberBox.setValue(int(verse_number))
-            self.insertButton.setVisible(False)
+                self.verse_type_combo_box.setCurrentIndex(verse_type_index)
+            self.verse_number_box.setValue(int(verse_number))
+            self.insert_button.setVisible(False)
         else:
             if not text:
                 text = u'---[%s:1]---\n' % VerseType.translated_names[VerseType.Verse]
-            self.verseTypeComboBox.setCurrentIndex(0)
-            self.verseNumberBox.setValue(1)
-            self.insertButton.setVisible(True)
-        self.verseTextEdit.setPlainText(text)
-        self.verseTextEdit.setFocus()
-        self.verseTextEdit.moveCursor(QtGui.QTextCursor.End)
-
-    def getVerse(self):
-        return self.verseTextEdit.toPlainText(), VerseType.tags[self.verseTypeComboBox.currentIndex()], \
-            unicode(self.verseNumberBox.value())
-
-    def getVerseAll(self):
-        text = self.verseTextEdit.toPlainText()
+            self.verse_type_combo_box.setCurrentIndex(0)
+            self.verse_number_box.setValue(1)
+            self.insert_button.setVisible(True)
+        self.verse_text_edit.setPlainText(text)
+        self.verse_text_edit.setFocus()
+        self.verse_text_edit.moveCursor(QtGui.QTextCursor.End)
+
+    def get_verse(self):
+        return self.verse_text_edit.toPlainText(), VerseType.tags[self.verse_type_combo_box.currentIndex()], \
+            unicode(self.verse_number_box.value())
+
+    def get_all_verses(self):
+        text = self.verse_text_edit.toPlainText()
         if not text.startswith(u'---['):
             text = u'---[%s:1]---\n%s' % (VerseType.translated_names[VerseType.Verse], text)
         return text
-

=== modified file 'openlp/plugins/songs/forms/mediafilesdialog.py'
--- openlp/plugins/songs/forms/mediafilesdialog.py	2013-01-27 20:36:18 +0000
+++ openlp/plugins/songs/forms/mediafilesdialog.py	2013-03-18 12:12:23 +0000
@@ -32,32 +32,42 @@
 from openlp.core.lib import translate, build_icon
 from openlp.core.lib.ui import create_button_box
 
+
 class Ui_MediaFilesDialog(object):
-    def setupUi(self, mediaFilesDialog):
-        mediaFilesDialog.setObjectName(u'mediaFilesDialog')
-        mediaFilesDialog.setWindowModality(QtCore.Qt.ApplicationModal)
-        mediaFilesDialog.resize(400, 300)
-        mediaFilesDialog.setModal(True)
-        mediaFilesDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
-        self.filesVerticalLayout = QtGui.QVBoxLayout(mediaFilesDialog)
-        self.filesVerticalLayout.setSpacing(8)
-        self.filesVerticalLayout.setMargin(8)
-        self.filesVerticalLayout.setObjectName(u'filesVerticalLayout')
-        self.selectLabel = QtGui.QLabel(mediaFilesDialog)
-        self.selectLabel.setWordWrap(True)
-        self.selectLabel.setObjectName(u'selectLabel')
-        self.filesVerticalLayout.addWidget(self.selectLabel)
-        self.fileListWidget = QtGui.QListWidget(mediaFilesDialog)
-        self.fileListWidget.setAlternatingRowColors(True)
-        self.fileListWidget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
-        self.fileListWidget.setObjectName(u'fileListWidget')
-        self.filesVerticalLayout.addWidget(self.fileListWidget)
-        self.button_box = create_button_box(mediaFilesDialog, u'button_box', [u'cancel', u'ok'])
-        self.filesVerticalLayout.addWidget(self.button_box)
-        self.retranslateUi(mediaFilesDialog)
+    """
+    The user interface for the media files dialog.
+    """
+    def setupUi(self, media_files_dialog):
+        """
+        Set up the user interface.
+        """
+        media_files_dialog.setObjectName(u'media_files_dialog')
+        media_files_dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+        media_files_dialog.resize(400, 300)
+        media_files_dialog.setModal(True)
+        media_files_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
+        self.files_vertical_layout = QtGui.QVBoxLayout(media_files_dialog)
+        self.files_vertical_layout.setSpacing(8)
+        self.files_vertical_layout.setMargin(8)
+        self.files_vertical_layout.setObjectName(u'files_vertical_layout')
+        self.select_label = QtGui.QLabel(media_files_dialog)
+        self.select_label.setWordWrap(True)
+        self.select_label.setObjectName(u'select_label')
+        self.files_vertical_layout.addWidget(self.select_label)
+        self.file_list_widget = QtGui.QListWidget(media_files_dialog)
+        self.file_list_widget.setAlternatingRowColors(True)
+        self.file_list_widget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
+        self.file_list_widget.setObjectName(u'file_list_widget')
+        self.files_vertical_layout.addWidget(self.file_list_widget)
+        self.button_box = create_button_box(media_files_dialog, u'button_box', [u'cancel', u'ok'])
+        self.files_vertical_layout.addWidget(self.button_box)
+        self.retranslateUi(media_files_dialog)
 
-    def retranslateUi(self, mediaFilesDialog):
-        mediaFilesDialog.setWindowTitle(translate('SongsPlugin.MediaFilesForm', 'Select Media File(s)'))
-        self.selectLabel.setText(translate('SongsPlugin.MediaFilesForm',
+    def retranslateUi(self, media_files_dialog):
+        """
+        Translate the UI on the fly.
+        """
+        media_files_dialog.setWindowTitle(translate('SongsPlugin.MediaFilesForm', 'Select Media File(s)'))
+        self.select_label.setText(translate('SongsPlugin.MediaFilesForm',
             'Select one or more audio files from the list below, and click OK to import them into this song.'))
 

=== modified file 'openlp/plugins/songs/forms/mediafilesform.py'
--- openlp/plugins/songs/forms/mediafilesform.py	2013-03-07 12:34:35 +0000
+++ openlp/plugins/songs/forms/mediafilesform.py	2013-03-18 12:12:23 +0000
@@ -48,13 +48,13 @@
         self.setupUi(self)
 
     def populateFiles(self, files):
-        self.fileListWidget.clear()
+        self.file_list_widget.clear()
         for file in files:
             item = QtGui.QListWidgetItem(os.path.split(file)[1])
             item.setData(QtCore.Qt.UserRole, file)
-            self.fileListWidget.addItem(item)
+            self.file_list_widget.addItem(item)
 
     def getSelectedFiles(self):
         return map(lambda item: item.data(QtCore.Qt.UserRole),
-            self.fileListWidget.selectedItems())
+            self.file_list_widget.selectedItems())
 

=== modified file 'openlp/plugins/songs/forms/songbookdialog.py'
--- openlp/plugins/songs/forms/songbookdialog.py	2013-01-27 20:36:18 +0000
+++ openlp/plugins/songs/forms/songbookdialog.py	2013-03-18 12:12:23 +0000
@@ -32,33 +32,43 @@
 from openlp.core.lib import translate
 from openlp.core.lib.ui import create_button_box
 
+
 class Ui_SongBookDialog(object):
-    def setupUi(self, songBookDialog):
-        songBookDialog.setObjectName(u'songBookDialog')
-        songBookDialog.resize(300, 10)
-        self.dialogLayout = QtGui.QVBoxLayout(songBookDialog)
-        self.dialogLayout.setObjectName(u'dialog_layout')
-        self.bookLayout = QtGui.QFormLayout()
-        self.bookLayout.setObjectName(u'bookLayout')
-        self.nameLabel = QtGui.QLabel(songBookDialog)
-        self.nameLabel.setObjectName(u'nameLabel')
-        self.nameEdit = QtGui.QLineEdit(songBookDialog)
-        self.nameEdit.setObjectName(u'nameEdit')
-        self.nameLabel.setBuddy(self.nameEdit)
-        self.bookLayout.addRow(self.nameLabel, self.nameEdit)
-        self.publisherLabel = QtGui.QLabel(songBookDialog)
-        self.publisherLabel.setObjectName(u'publisherLabel')
-        self.publisherEdit = QtGui.QLineEdit(songBookDialog)
-        self.publisherEdit.setObjectName(u'publisherEdit')
-        self.publisherLabel.setBuddy(self.publisherEdit)
-        self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
-        self.dialogLayout.addLayout(self.bookLayout)
-        self.button_box = create_button_box(songBookDialog, u'button_box', [u'cancel', u'save'])
-        self.dialogLayout.addWidget(self.button_box)
-        self.retranslateUi(songBookDialog)
-        songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
+    """
+    The user interface for the song book dialog.
+    """
+    def setupUi(self, song_book_dialog):
+        """
+        Set up the user interface.
+        """
+        song_book_dialog.setObjectName(u'song_book_dialog')
+        song_book_dialog.resize(300, 10)
+        self.dialog_layout = QtGui.QVBoxLayout(song_book_dialog)
+        self.dialog_layout.setObjectName(u'dialog_layout')
+        self.book_layout = QtGui.QFormLayout()
+        self.book_layout.setObjectName(u'book_layout')
+        self.name_label = QtGui.QLabel(song_book_dialog)
+        self.name_label.setObjectName(u'name_label')
+        self.name_edit = QtGui.QLineEdit(song_book_dialog)
+        self.name_edit.setObjectName(u'name_edit')
+        self.name_label.setBuddy(self.name_edit)
+        self.book_layout.addRow(self.name_label, self.name_edit)
+        self.publisher_label = QtGui.QLabel(song_book_dialog)
+        self.publisher_label.setObjectName(u'publisher_label')
+        self.publisher_edit = QtGui.QLineEdit(song_book_dialog)
+        self.publisher_edit.setObjectName(u'publisher_edit')
+        self.publisher_label.setBuddy(self.publisher_edit)
+        self.book_layout.addRow(self.publisher_label, self.publisher_edit)
+        self.dialog_layout.addLayout(self.book_layout)
+        self.button_box = create_button_box(song_book_dialog, u'button_box', [u'cancel', u'save'])
+        self.dialog_layout.addWidget(self.button_box)
+        self.retranslateUi(song_book_dialog)
+        song_book_dialog.setMaximumHeight(song_book_dialog.sizeHint().height())
 
-    def retranslateUi(self, songBookDialog):
-        songBookDialog.setWindowTitle(translate('SongsPlugin.SongBookForm', 'Song Book Maintenance'))
-        self.nameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:'))
-        self.publisherLabel.setText(translate('SongsPlugin.SongBookForm', '&Publisher:'))
+    def retranslateUi(self, song_book_dialog):
+        """
+        Translate the UI on the fly.
+        """
+        song_book_dialog.setWindowTitle(translate('SongsPlugin.SongBookForm', 'Song Book Maintenance'))
+        self.name_label.setText(translate('SongsPlugin.SongBookForm', '&Name:'))
+        self.publisher_label.setText(translate('SongsPlugin.SongBookForm', '&Publisher:'))

=== modified file 'openlp/plugins/songs/forms/songbookform.py'
--- openlp/plugins/songs/forms/songbookform.py	2013-01-31 22:01:41 +0000
+++ openlp/plugins/songs/forms/songbookform.py	2013-03-18 12:12:23 +0000
@@ -26,6 +26,9 @@
 # with this program; if not, write to the Free Software Foundation, Inc., 59  #
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
+"""
+This module contains the song book form
+"""
 
 from PyQt4 import QtGui
 
@@ -53,19 +56,19 @@
             Clear the fields on the form before displaying it.
         """
         if clear:
-            self.nameEdit.clear()
-            self.publisherEdit.clear()
-        self.nameEdit.setFocus()
+            self.name_edit.clear()
+            self.publisher_edit.clear()
+        self.name_edit.setFocus()
         return QtGui.QDialog.exec_(self)
 
     def accept(self):
         """
         Override the inherited method to check that the name of the book has been typed in.
         """
-        if not self.nameEdit.text():
+        if not self.name_edit.text():
             critical_error_message_box(
                 message=translate('SongsPlugin.SongBookForm', 'You need to type in a name for the book.'))
-            self.nameEdit.setFocus()
+            self.name_edit.setFocus()
             return False
         else:
             return QtGui.QDialog.accept(self)

=== modified file 'openlp/plugins/songs/forms/songexportform.py'
--- openlp/plugins/songs/forms/songexportform.py	2013-03-07 17:58:15 +0000
+++ openlp/plugins/songs/forms/songexportform.py	2013-03-18 12:12:23 +0000
@@ -43,6 +43,7 @@
 
 log = logging.getLogger(__name__)
 
+
 class SongExportForm(OpenLPWizard):
     """
     This is the Song Export Wizard, which allows easy exporting of Songs to the
@@ -60,7 +61,7 @@
         ``plugin``
             The songs plugin.
         """
-        OpenLPWizard.__init__(self, parent, plugin, u'songExportWizard', u':/wizards/wizard_exportsong.bmp')
+        OpenLPWizard.__init__(self, parent, plugin, u'song_export_wizard', u':/wizards/wizard_exportsong.bmp')
         self.stop_export_flag = False
         Registry().register_function(u'openlp_stop_wizard', self.stop_export)
 
@@ -77,13 +78,7 @@
         """
         OpenLPWizard.setupUi(self, image)
 
-    def customInit(self):
-        """
-        Song wizard specific initialisation.
-        """
-        pass
-
-    def customSignals(self):
+    def custom_signals(self):
         """
         Song wizard specific signals.
         """
@@ -93,7 +88,7 @@
         self.checkButton.clicked.connect(self.onCheckButtonClicked)
         self.directoryButton.clicked.connect(self.onDirectoryButtonClicked)
 
-    def addCustomPages(self):
+    def add_custom_pages(self):
         """
         Add song wizard specific pages.
         """

=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2013-03-07 17:58:15 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2013-03-18 12:12:23 +0000
@@ -67,7 +67,7 @@
         """
         Set up the song wizard UI.
         """
-        self.format_widgets = dict([(format, {}) for format in SongFormat.get_format_list()])
+        self.format_widgets = dict([(song_format, {}) for song_format in SongFormat.get_format_list()])
         OpenLPWizard.setupUi(self, image)
         self.current_format = SongFormat.OpenLyrics
         self.format_stack.setCurrentIndex(self.current_format)
@@ -81,29 +81,29 @@
         self.format_stack.setCurrentIndex(index)
         self.source_page.emit(QtCore.SIGNAL(u'completeChanged()'))
 
-    def customInit(self):
+    def custom_init(self):
         """
         Song wizard specific initialisation.
         """
-        for format in SongFormat.get_format_list():
-            if not SongFormat.get(format, u'availability'):
-                self.format_widgets[format][u'disabled_widget'].setVisible(True)
-                self.format_widgets[format][u'import_widget'].setVisible(False)
+        for song_format in SongFormat.get_format_list():
+            if not SongFormat.get(song_format, u'availability'):
+                self.format_widgets[song_format][u'disabled_widget'].setVisible(True)
+                self.format_widgets[song_format][u'import_widget'].setVisible(False)
 
-    def customSignals(self):
+    def custom_signals(self):
         """
         Song wizard specific signals.
         """
-        for format in SongFormat.get_format_list():
-            select_mode = SongFormat.get(format, u'selectMode')
+        for song_format in SongFormat.get_format_list():
+            select_mode = SongFormat.get(song_format, u'selectMode')
             if select_mode == SongFormatSelect.MultipleFiles:
-                self.format_widgets[format][u'addButton'].clicked.connect(self.on_add_button_clicked)
-                self.format_widgets[format][u'removeButton'].clicked.connect(self.onRemoveButtonClicked)
+                self.format_widgets[song_format][u'addButton'].clicked.connect(self.on_add_button_clicked)
+                self.format_widgets[song_format][u'removeButton'].clicked.connect(self.onRemoveButtonClicked)
             else:
-                self.format_widgets[format][u'browseButton'].clicked.connect(self.on_browse_button_clicked)
-                self.format_widgets[format][u'file_path_edit'].textChanged.connect(self.onFilepathEditTextChanged)
+                self.format_widgets[song_format][u'browseButton'].clicked.connect(self.on_browse_button_clicked)
+                self.format_widgets[song_format][u'file_path_edit'].textChanged.connect(self.onFilepathEditTextChanged)
 
-    def addCustomPages(self):
+    def add_custom_pages(self):
         """
         Add song wizard specific pages.
         """
@@ -210,7 +210,7 @@
             Settings().setValue(u'songs/last import type', this_format)
             select_mode, class_, error_msg = SongFormat.get(this_format, u'selectMode', u'class', u'invalidSourceMsg')
             if select_mode == SongFormatSelect.MultipleFiles:
-                import_source = self.get_list_of_files(self.format_widgets[this_format][u'fileListWidget'])
+                import_source = self.get_list_of_files(self.format_widgets[this_format][u'file_list_widget'])
                 error_title = UiStrings().IFSp
                 focus_button = self.format_widgets[this_format][u'addButton']
             else:
@@ -287,14 +287,14 @@
             SongFormat.get(this_format, u'selectMode', u'name', u'filter', u'getFilesTitle')
         title = custom_title if custom_title else WizardStrings.OpenTypeFile % format_name
         if select_mode == SongFormatSelect.MultipleFiles:
-            self.get_files(title, self.format_widgets[this_format][u'fileListWidget'], ext_filter)
+            self.get_files(title, self.format_widgets[this_format][u'file_list_widget'], ext_filter)
             self.source_page.emit(QtCore.SIGNAL(u'completeChanged()'))
 
     def onRemoveButtonClicked(self):
         """
         Remove a file from the list.
         """
-        self.remove_selected_items(self.format_widgets[self.current_format][u'fileListWidget'])
+        self.remove_selected_items(self.format_widgets[self.current_format][u'file_list_widget'])
         self.source_page.emit(QtCore.SIGNAL(u'completeChanged()'))
 
     def onFilepathEditTextChanged(self):
@@ -317,7 +317,7 @@
         for format in SongFormat.get_format_list():
             select_mode = SongFormat.get(format, u'selectMode')
             if select_mode == SongFormatSelect.MultipleFiles:
-                self.format_widgets[format][u'fileListWidget'].clear()
+                self.format_widgets[format][u'file_list_widget'].clear()
             else:
                 self.format_widgets[format][u'file_path_edit'].setText(u'')
         self.error_report_text_edit.clear()
@@ -349,7 +349,7 @@
                 folder=self.format_widgets[source_format][u'file_path_edit'].text())
         else:
             importer = self.plugin.importSongs(source_format,
-                filenames=self.get_list_of_files(self.format_widgets[source_format][u'fileListWidget']))
+                filenames=self.get_list_of_files(self.format_widgets[source_format][u'file_list_widget']))
         importer.doImport()
         self.progress_label.setText(WizardStrings.FinishedImport)
 
@@ -440,7 +440,7 @@
             removeButton.setObjectName(prefix + u'RemoveButton')
             button_layout.addWidget(removeButton)
             importLayout.addLayout(button_layout)
-            self.format_widgets[this_format][u'fileListWidget'] = fileListWidget
+            self.format_widgets[this_format][u'file_list_widget'] = fileListWidget
             self.format_widgets[this_format][u'button_layout'] = button_layout
             self.format_widgets[this_format][u'addButton'] = addButton
             self.format_widgets[this_format][u'removeButton'] = removeButton
@@ -512,7 +512,7 @@
         select_mode, format_available = SongFormat.get(this_format, u'selectMode', u'availability')
         if format_available:
             if select_mode == SongFormatSelect.MultipleFiles:
-                if wizard.format_widgets[this_format][u'fileListWidget'].count() > 0:
+                if wizard.format_widgets[this_format][u'file_list_widget'].count() > 0:
                     return True
             else:
                 filepath = unicode(wizard.format_widgets[this_format][u'file_path_edit'].text())

=== modified file 'openlp/plugins/songs/forms/songmaintenancedialog.py'
--- openlp/plugins/songs/forms/songmaintenancedialog.py	2013-03-08 08:14:39 +0000
+++ openlp/plugins/songs/forms/songmaintenancedialog.py	2013-03-18 12:12:23 +0000
@@ -33,123 +33,133 @@
 from openlp.core.lib.ui import create_button_box
 from openlp.plugins.songs.lib.ui import SongStrings
 
+
 class Ui_SongMaintenanceDialog(object):
-    def setupUi(self, songMaintenanceDialog):
-        songMaintenanceDialog.setObjectName(u'songMaintenanceDialog')
-        songMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal)
-        songMaintenanceDialog.resize(10, 350)
-        self.dialogLayout = QtGui.QGridLayout(songMaintenanceDialog)
-        self.dialogLayout.setObjectName(u'dialog_layout')
-        self.typeListWidget = QtGui.QListWidget(songMaintenanceDialog)
-        self.typeListWidget.setIconSize(QtCore.QSize(32, 32))
-        self.typeListWidget.setUniformItemSizes(True)
-        self.typeListWidget.setObjectName(u'typeListWidget')
-        self.listItemAuthors = QtGui.QListWidgetItem(self.typeListWidget)
-        self.listItemAuthors.setIcon(build_icon(u':/songs/author_maintenance.png'))
-        self.listItemTopics = QtGui.QListWidgetItem(self.typeListWidget)
-        self.listItemTopics.setIcon(build_icon(u':/songs/topic_maintenance.png'))
-        self.listItemBooks = QtGui.QListWidgetItem(self.typeListWidget)
-        self.listItemBooks.setIcon(build_icon(u':/songs/book_maintenance.png'))
-        self.dialogLayout.addWidget(self.typeListWidget, 0, 0)
-        self.stackedLayout = QtGui.QStackedLayout()
-        self.stackedLayout.setObjectName(u'stackedLayout')
+    """
+    The user interface for the song maintenance dialog
+    """
+    def setupUi(self, song_maintenance_dialog):
+        """
+        Set up the user interface for the song maintenance dialog
+        """
+        song_maintenance_dialog.setObjectName(u'song_maintenance_dialog')
+        song_maintenance_dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+        song_maintenance_dialog.resize(10, 350)
+        self.dialog_layout = QtGui.QGridLayout(song_maintenance_dialog)
+        self.dialog_layout.setObjectName(u'dialog_layout')
+        self.type_list_widget = QtGui.QListWidget(song_maintenance_dialog)
+        self.type_list_widget.setIconSize(QtCore.QSize(32, 32))
+        self.type_list_widget.setUniformItemSizes(True)
+        self.type_list_widget.setObjectName(u'type_list_widget')
+        self.authors_list_item = QtGui.QListWidgetItem(self.type_list_widget)
+        self.authors_list_item.setIcon(build_icon(u':/songs/author_maintenance.png'))
+        self.topics_list_item = QtGui.QListWidgetItem(self.type_list_widget)
+        self.topics_list_item.setIcon(build_icon(u':/songs/topic_maintenance.png'))
+        self.books_list_item = QtGui.QListWidgetItem(self.type_list_widget)
+        self.books_list_item.setIcon(build_icon(u':/songs/book_maintenance.png'))
+        self.dialog_layout.addWidget(self.type_list_widget, 0, 0)
+        self.stacked_layout = QtGui.QStackedLayout()
+        self.stacked_layout.setObjectName(u'stacked_layout')
         # authors page
-        self.authorsPage = QtGui.QWidget(songMaintenanceDialog)
-        self.authorsPage.setObjectName(u'authorsPage')
-        self.authorsLayout = QtGui.QVBoxLayout(self.authorsPage)
-        self.authorsLayout.setObjectName(u'authors_layout')
-        self.authorsListWidget = QtGui.QListWidget(self.authorsPage)
-        self.authorsListWidget.setObjectName(u'authorsListWidget')
-        self.authorsLayout.addWidget(self.authorsListWidget)
-        self.authorsButtonsLayout = QtGui.QHBoxLayout()
-        self.authorsButtonsLayout.setObjectName(u'authorsButtonsLayout')
-        self.authorsButtonsLayout.addStretch()
-        self.authorsAddButton = QtGui.QPushButton(self.authorsPage)
-        self.authorsAddButton.setIcon(build_icon(u':/songs/author_add.png'))
-        self.authorsAddButton.setObjectName(u'authorsAddButton')
-        self.authorsButtonsLayout.addWidget(self.authorsAddButton)
-        self.authorsEditButton = QtGui.QPushButton(self.authorsPage)
-        self.authorsEditButton.setIcon(build_icon(u':/songs/author_edit.png'))
-        self.authorsEditButton.setObjectName(u'authorsEditButton')
-        self.authorsButtonsLayout.addWidget(self.authorsEditButton)
-        self.authorsDeleteButton = QtGui.QPushButton(self.authorsPage)
-        self.authorsDeleteButton.setIcon(build_icon(u':/songs/author_delete.png'))
-        self.authorsDeleteButton.setObjectName(u'authorsDeleteButton')
-        self.authorsButtonsLayout.addWidget(self.authorsDeleteButton)
-        self.authorsLayout.addLayout(self.authorsButtonsLayout)
-        self.stackedLayout.addWidget(self.authorsPage)
+        self.authors_page = QtGui.QWidget(song_maintenance_dialog)
+        self.authors_page.setObjectName(u'authors_page')
+        self.authors_layout = QtGui.QVBoxLayout(self.authors_page)
+        self.authors_layout.setObjectName(u'authors_layout')
+        self.authors_list_widget = QtGui.QListWidget(self.authors_page)
+        self.authors_list_widget.setObjectName(u'authors_list_widget')
+        self.authors_layout.addWidget(self.authors_list_widget)
+        self.authors_buttons_layout = QtGui.QHBoxLayout()
+        self.authors_buttons_layout.setObjectName(u'authors_buttons_layout')
+        self.authors_buttons_layout.addStretch()
+        self.add_author_button = QtGui.QPushButton(self.authors_page)
+        self.add_author_button.setIcon(build_icon(u':/songs/author_add.png'))
+        self.add_author_button.setObjectName(u'add_author_button')
+        self.authors_buttons_layout.addWidget(self.add_author_button)
+        self.edit_author_button = QtGui.QPushButton(self.authors_page)
+        self.edit_author_button.setIcon(build_icon(u':/songs/author_edit.png'))
+        self.edit_author_button.setObjectName(u'edit_author_button')
+        self.authors_buttons_layout.addWidget(self.edit_author_button)
+        self.delete_author_button = QtGui.QPushButton(self.authors_page)
+        self.delete_author_button.setIcon(build_icon(u':/songs/author_delete.png'))
+        self.delete_author_button.setObjectName(u'delete_author_button')
+        self.authors_buttons_layout.addWidget(self.delete_author_button)
+        self.authors_layout.addLayout(self.authors_buttons_layout)
+        self.stacked_layout.addWidget(self.authors_page)
         # topics page
-        self.topicsPage = QtGui.QWidget(songMaintenanceDialog)
-        self.topicsPage.setObjectName(u'topicsPage')
-        self.topicsLayout = QtGui.QVBoxLayout(self.topicsPage)
-        self.topicsLayout.setObjectName(u'topics_layout')
-        self.topicsListWidget = QtGui.QListWidget(self.topicsPage)
-        self.topicsListWidget.setObjectName(u'topicsListWidget')
-        self.topicsLayout.addWidget(self.topicsListWidget)
-        self.topicsButtonsLayout = QtGui.QHBoxLayout()
-        self.topicsButtonsLayout.setObjectName(u'topicsButtonLayout')
-        self.topicsButtonsLayout.addStretch()
-        self.topicsAddButton = QtGui.QPushButton(self.topicsPage)
-        self.topicsAddButton.setIcon(build_icon(u':/songs/topic_add.png'))
-        self.topicsAddButton.setObjectName(u'topicsAddButton')
-        self.topicsButtonsLayout.addWidget(self.topicsAddButton)
-        self.topicsEditButton = QtGui.QPushButton(self.topicsPage)
-        self.topicsEditButton.setIcon(build_icon(u':/songs/topic_edit.png'))
-        self.topicsEditButton.setObjectName(u'topicsEditButton')
-        self.topicsButtonsLayout.addWidget(self.topicsEditButton)
-        self.topicsDeleteButton = QtGui.QPushButton(self.topicsPage)
-        self.topicsDeleteButton.setIcon(build_icon(u':/songs/topic_delete.png'))
-        self.topicsDeleteButton.setObjectName(u'topicsDeleteButton')
-        self.topicsButtonsLayout.addWidget(self.topicsDeleteButton)
-        self.topicsLayout.addLayout(self.topicsButtonsLayout)
-        self.stackedLayout.addWidget(self.topicsPage)
+        self.topics_page = QtGui.QWidget(song_maintenance_dialog)
+        self.topics_page.setObjectName(u'topics_page')
+        self.topics_layout = QtGui.QVBoxLayout(self.topics_page)
+        self.topics_layout.setObjectName(u'topics_layout')
+        self.topics_list_widget = QtGui.QListWidget(self.topics_page)
+        self.topics_list_widget.setObjectName(u'topics_list_widget')
+        self.topics_layout.addWidget(self.topics_list_widget)
+        self.topics_buttons_layout = QtGui.QHBoxLayout()
+        self.topics_buttons_layout.setObjectName(u'topicsButtonLayout')
+        self.topics_buttons_layout.addStretch()
+        self.add_topic_button = QtGui.QPushButton(self.topics_page)
+        self.add_topic_button.setIcon(build_icon(u':/songs/topic_add.png'))
+        self.add_topic_button.setObjectName(u'add_topic_button')
+        self.topics_buttons_layout.addWidget(self.add_topic_button)
+        self.edit_topic_button = QtGui.QPushButton(self.topics_page)
+        self.edit_topic_button.setIcon(build_icon(u':/songs/topic_edit.png'))
+        self.edit_topic_button.setObjectName(u'edit_topic_button')
+        self.topics_buttons_layout.addWidget(self.edit_topic_button)
+        self.delete_topic_button = QtGui.QPushButton(self.topics_page)
+        self.delete_topic_button.setIcon(build_icon(u':/songs/topic_delete.png'))
+        self.delete_topic_button.setObjectName(u'delete_topic_button')
+        self.topics_buttons_layout.addWidget(self.delete_topic_button)
+        self.topics_layout.addLayout(self.topics_buttons_layout)
+        self.stacked_layout.addWidget(self.topics_page)
         # song books page
-        self.booksPage = QtGui.QWidget(songMaintenanceDialog)
-        self.booksPage.setObjectName(u'booksPage')
-        self.booksLayout = QtGui.QVBoxLayout(self.booksPage)
-        self.booksLayout.setObjectName(u'booksLayout')
-        self.booksListWidget = QtGui.QListWidget(self.booksPage)
-        self.booksListWidget.setObjectName(u'booksListWidget')
-        self.booksLayout.addWidget(self.booksListWidget)
-        self.booksButtonsLayout = QtGui.QHBoxLayout()
-        self.booksButtonsLayout.setObjectName(u'booksButtonLayout')
-        self.booksButtonsLayout.addStretch()
-        self.booksAddButton = QtGui.QPushButton(self.booksPage)
-        self.booksAddButton.setIcon(build_icon(u':/songs/book_add.png'))
-        self.booksAddButton.setObjectName(u'booksAddButton')
-        self.booksButtonsLayout.addWidget(self.booksAddButton)
-        self.booksEditButton = QtGui.QPushButton(self.booksPage)
-        self.booksEditButton.setIcon(build_icon(u':/songs/book_edit.png'))
-        self.booksEditButton.setObjectName(u'booksEditButton')
-        self.booksButtonsLayout.addWidget(self.booksEditButton)
-        self.booksDeleteButton = QtGui.QPushButton(self.booksPage)
-        self.booksDeleteButton.setIcon(build_icon(u':/songs/book_delete.png'))
-        self.booksDeleteButton.setObjectName(u'booksDeleteButton')
-        self.booksButtonsLayout.addWidget(self.booksDeleteButton)
-        self.booksLayout.addLayout(self.booksButtonsLayout)
-        self.stackedLayout.addWidget(self.booksPage)
+        self.books_page = QtGui.QWidget(song_maintenance_dialog)
+        self.books_page.setObjectName(u'books_page')
+        self.books_layout = QtGui.QVBoxLayout(self.books_page)
+        self.books_layout.setObjectName(u'books_layout')
+        self.song_books_list_widget = QtGui.QListWidget(self.books_page)
+        self.song_books_list_widget.setObjectName(u'song_books_list_widget')
+        self.books_layout.addWidget(self.song_books_list_widget)
+        self.books_buttons_layout = QtGui.QHBoxLayout()
+        self.books_buttons_layout.setObjectName(u'booksButtonLayout')
+        self.books_buttons_layout.addStretch()
+        self.add_book_button = QtGui.QPushButton(self.books_page)
+        self.add_book_button.setIcon(build_icon(u':/songs/book_add.png'))
+        self.add_book_button.setObjectName(u'add_book_button')
+        self.books_buttons_layout.addWidget(self.add_book_button)
+        self.edit_book_button = QtGui.QPushButton(self.books_page)
+        self.edit_book_button.setIcon(build_icon(u':/songs/book_edit.png'))
+        self.edit_book_button.setObjectName(u'edit_book_button')
+        self.books_buttons_layout.addWidget(self.edit_book_button)
+        self.delete_book_button = QtGui.QPushButton(self.books_page)
+        self.delete_book_button.setIcon(build_icon(u':/songs/book_delete.png'))
+        self.delete_book_button.setObjectName(u'delete_book_button')
+        self.books_buttons_layout.addWidget(self.delete_book_button)
+        self.books_layout.addLayout(self.books_buttons_layout)
+        self.stacked_layout.addWidget(self.books_page)
         #
-        self.dialogLayout.addLayout(self.stackedLayout, 0, 1)
-        self.button_box = create_button_box(songMaintenanceDialog, u'button_box', [u'close'])
-        self.dialogLayout.addWidget(self.button_box, 1, 0, 1, 2)
-        self.retranslateUi(songMaintenanceDialog)
-        self.stackedLayout.setCurrentIndex(0)
-        self.typeListWidget.currentRowChanged.connect(self.stackedLayout.setCurrentIndex)
+        self.dialog_layout.addLayout(self.stacked_layout, 0, 1)
+        self.button_box = create_button_box(song_maintenance_dialog, u'button_box', [u'close'])
+        self.dialog_layout.addWidget(self.button_box, 1, 0, 1, 2)
+        self.retranslateUi(song_maintenance_dialog)
+        self.stacked_layout.setCurrentIndex(0)
+        self.type_list_widget.currentRowChanged.connect(self.stacked_layout.setCurrentIndex)
 
-    def retranslateUi(self, songMaintenanceDialog):
-        songMaintenanceDialog.setWindowTitle(SongStrings.SongMaintenance)
-        self.listItemAuthors.setText(SongStrings.Authors)
-        self.listItemTopics.setText(SongStrings.Topics)
-        self.listItemBooks.setText(SongStrings.SongBooks)
-        self.authorsAddButton.setText(UiStrings().Add)
-        self.authorsEditButton.setText(UiStrings().Edit)
-        self.authorsDeleteButton.setText(UiStrings().Delete)
-        self.topicsAddButton.setText(UiStrings().Add)
-        self.topicsEditButton.setText(UiStrings().Edit)
-        self.topicsDeleteButton.setText(UiStrings().Delete)
-        self.booksAddButton.setText(UiStrings().Add)
-        self.booksEditButton.setText(UiStrings().Edit)
-        self.booksDeleteButton.setText(UiStrings().Delete)
+    def retranslateUi(self, song_maintenance_dialog):
+        """
+        Translate the UI on the fly.
+        """
+        song_maintenance_dialog.setWindowTitle(SongStrings.SongMaintenance)
+        self.authors_list_item.setText(SongStrings.Authors)
+        self.topics_list_item.setText(SongStrings.Topics)
+        self.books_list_item.setText(SongStrings.SongBooks)
+        self.add_author_button.setText(UiStrings().Add)
+        self.edit_author_button.setText(UiStrings().Edit)
+        self.delete_author_button.setText(UiStrings().Delete)
+        self.add_topic_button.setText(UiStrings().Add)
+        self.edit_topic_button.setText(UiStrings().Edit)
+        self.delete_topic_button.setText(UiStrings().Delete)
+        self.add_book_button.setText(UiStrings().Add)
+        self.edit_book_button.setText(UiStrings().Edit)
+        self.delete_book_button.setText(UiStrings().Delete)
         typeListWidth = max(self.fontMetrics().width(SongStrings.Authors),
             self.fontMetrics().width(SongStrings.Topics), self.fontMetrics().width(SongStrings.SongBooks))
-        self.typeListWidget.setFixedWidth(typeListWidth + self.typeListWidget.iconSize().width() + 32)
+        self.type_list_widget.setFixedWidth(typeListWidth + self.type_list_widget.iconSize().width() + 32)

=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py	2013-03-08 08:14:39 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py	2013-03-18 12:12:23 +0000
@@ -53,47 +53,47 @@
         super(SongMaintenanceForm, self).__init__(parent)
         self.setupUi(self)
         self.manager = manager
-        self.authorform = AuthorsForm(self)
-        self.topicform = TopicsForm(self)
-        self.bookform = SongBookForm(self)
+        self.author_form = AuthorsForm(self)
+        self.topic_form = TopicsForm(self)
+        self.song_book_form = SongBookForm(self)
         # Disable all edit and delete buttons, as there is no row selected.
-        self.authorsDeleteButton.setEnabled(False)
-        self.authorsEditButton.setEnabled(False)
-        self.topicsDeleteButton.setEnabled(False)
-        self.topicsEditButton.setEnabled(False)
-        self.booksDeleteButton.setEnabled(False)
-        self.booksEditButton.setEnabled(False)
+        self.delete_author_button.setEnabled(False)
+        self.edit_author_button.setEnabled(False)
+        self.delete_topic_button.setEnabled(False)
+        self.edit_topic_button.setEnabled(False)
+        self.delete_book_button.setEnabled(False)
+        self.edit_book_button.setEnabled(False)
         # Signals
-        self.authorsAddButton.clicked.connect(self.onAuthorAddButtonClicked)
-        self.topicsAddButton.clicked.connect(self.onTopicAddButtonClicked)
-        self.booksAddButton.clicked.connect(self.onBookAddButtonClicked)
-        self.authorsEditButton.clicked.connect(self.onAuthorEditButtonClicked)
-        self.topicsEditButton.clicked.connect(self.onTopicEditButtonClicked)
-        self.booksEditButton.clicked.connect(self.onBookEditButtonClicked)
-        self.authorsDeleteButton.clicked.connect(self.onAuthorDeleteButtonClicked)
-        self.topicsDeleteButton.clicked.connect(self.onTopicDeleteButtonClicked)
-        self.booksDeleteButton.clicked.connect(self.onBookDeleteButtonClicked)
-        self.authorsListWidget.currentRowChanged.connect(self.onAuthorsListRowChanged)
-        self.topicsListWidget.currentRowChanged.connect(self.onTopicsListRowChanged)
-        self.booksListWidget.currentRowChanged.connect(self.onBooksListRowChanged)
+        self.add_author_button.clicked.connect(self.on_add_author_button_clicked)
+        self.add_topic_button.clicked.connect(self.on_add_topic_button_clicked)
+        self.add_book_button.clicked.connect(self.on_add_book_button_clicked)
+        self.edit_author_button.clicked.connect(self.on_edit_author_button_clicked)
+        self.edit_topic_button.clicked.connect(self.on_edit_topic_button_clicked)
+        self.edit_book_button.clicked.connect(self.on_edit_book_button_clicked)
+        self.delete_author_button.clicked.connect(self.on_delete_author_button_clicked)
+        self.delete_topic_button.clicked.connect(self.on_delete_topic_button_clicked)
+        self.delete_book_button.clicked.connect(self.on_delete_book_button_clicked)
+        self.authors_list_widget.currentRowChanged.connect(self.on_authors_list_row_changed)
+        self.topics_list_widget.currentRowChanged.connect(self.on_topics_list_row_changed)
+        self.song_books_list_widget.currentRowChanged.connect(self.on_song_books_list_row_changed)
 
-    def exec_(self, fromSongEdit=False):
+    def exec_(self, from_song_edit=False):
         """
         Show the dialog.
 
-        ``fromSongEdit``
+        ``from_song_edit``
             Indicates if the maintenance dialog has been opened from song edit
             or from the media manager. Defaults to **False**.
         """
-        self.fromSongEdit = fromSongEdit
-        self.typeListWidget.setCurrentRow(0)
-        self.resetAuthors()
-        self.resetTopics()
-        self.resetBooks()
-        self.typeListWidget.setFocus()
+        self.from_song_edit = from_song_edit
+        self.type_list_widget.setCurrentRow(0)
+        self.reset_authors()
+        self.reset_topics()
+        self.reset_song_books()
+        self.type_list_widget.setFocus()
         return QtGui.QDialog.exec_(self)
 
-    def _getCurrentItemId(self, list_widget):
+    def _get_current_item_id(self, list_widget):
         """
         Get the ID of the currently selected item.
 
@@ -107,27 +107,27 @@
         else:
             return -1
 
-    def _deleteItem(self, itemClass, listWidget, resetFunc, dlgTitle, del_text, err_text):
+    def _delete_item(self, item_class, list_widget, reset_func, dlg_title, del_text, err_text):
         """
         Delete an item.
         """
-        item_id = self._getCurrentItemId(listWidget)
+        item_id = self._get_current_item_id(list_widget)
         if item_id != -1:
-            item = self.manager.get_object(itemClass, item_id)
+            item = self.manager.get_object(item_class, item_id)
             if item and not item.songs:
-                if critical_error_message_box(dlgTitle, del_text, self, True) == QtGui.QMessageBox.Yes:
-                    self.manager.delete_object(itemClass, item.id)
-                    resetFunc()
+                if critical_error_message_box(dlg_title, del_text, self, True) == QtGui.QMessageBox.Yes:
+                    self.manager.delete_object(item_class, item.id)
+                    reset_func()
             else:
-                critical_error_message_box(dlgTitle, err_text)
+                critical_error_message_box(dlg_title, err_text)
         else:
-            critical_error_message_box(dlgTitle, UiStrings().NISs)
+            critical_error_message_box(dlg_title, UiStrings().NISs)
 
-    def resetAuthors(self):
+    def reset_authors(self):
         """
         Reloads the Authors list.
         """
-        self.authorsListWidget.clear()
+        self.authors_list_widget.clear()
         authors = self.manager.get_all_objects(Author, order_by_ref=Author.display_name)
         for author in authors:
             if author.display_name:
@@ -135,68 +135,72 @@
             else:
                 author_name = QtGui.QListWidgetItem(u' '.join([author.first_name, author.last_name]))
             author_name.setData(QtCore.Qt.UserRole, author.id)
-            self.authorsListWidget.addItem(author_name)
+            self.authors_list_widget.addItem(author_name)
 
-    def resetTopics(self):
+    def reset_topics(self):
         """
         Reloads the Topics list.
         """
-        self.topicsListWidget.clear()
+        self.topics_list_widget.clear()
         topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name)
         for topic in topics:
             topic_name = QtGui.QListWidgetItem(topic.name)
             topic_name.setData(QtCore.Qt.UserRole, topic.id)
-            self.topicsListWidget.addItem(topic_name)
+            self.topics_list_widget.addItem(topic_name)
 
-    def resetBooks(self):
+    def reset_song_books(self):
         """
         Reloads the Books list.
         """
-        self.booksListWidget.clear()
+        self.song_books_list_widget.clear()
         books = self.manager.get_all_objects(Book, order_by_ref=Book.name)
         for book in books:
             book_name = QtGui.QListWidgetItem(u'%s (%s)' % (book.name, book.publisher))
             book_name.setData(QtCore.Qt.UserRole, book.id)
-            self.booksListWidget.addItem(book_name)
+            self.song_books_list_widget.addItem(book_name)
 
-    def checkAuthor(self, newAuthor, edit=False):
+    def check_author_exists(self, new_author, edit=False):
         """
         Returns *False* if the given Author already exists, otherwise *True*.
         """
-        authors = self.manager.get_all_objects(Author,
-            and_(Author.first_name == newAuthor.first_name,
-                Author.last_name == newAuthor.last_name,
-                Author.display_name == newAuthor.display_name))
-        return self.__checkObject(authors, newAuthor, edit)
+        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
+            )
+        )
+        return self.__check_object_exists(authors, new_author, edit)
 
-    def checkTopic(self, newTopic, edit=False):
+    def check_topic_exists(self, new_topic, edit=False):
         """
         Returns *False* if the given Topic already exists, otherwise *True*.
         """
-        topics = self.manager.get_all_objects(Topic, Topic.name == newTopic.name)
-        return self.__checkObject(topics, newTopic, edit)
+        topics = self.manager.get_all_objects(Topic, Topic.name == new_topic.name)
+        return self.__check_object_exists(topics, new_topic, edit)
 
-    def checkBook(self, newBook, edit=False):
+    def check_song_book_exists(self, new_book, edit=False):
         """
         Returns *False* if the given Topic already exists, otherwise *True*.
         """
         books = self.manager.get_all_objects(Book,
-            and_(Book.name == newBook.name, Book.publisher == newBook.publisher))
-        return self.__checkObject(books, newBook, edit)
+            and_(Book.name == new_book.name, Book.publisher == new_book.publisher))
+        return self.__check_object_exists(books, new_book, edit)
 
-    def __checkObject(self, objects, newObject, edit):
+    def __check_object_exists(self, existing_objects, new_object, edit):
         """
         Utility method to check for an existing object.
 
         ``edit``
             If we edit an item, this should be *True*.
         """
-        if objects:
+        if existing_objects:
             # If we edit an existing object, we need to make sure that we do
             # not return False when nothing has changed.
             if edit:
-                for object in objects:
-                    if object.id != newObject.id:
+                for existing_object in existing_objects:
+                    if existing_object.id != new_object.id:
                         return False
                 return True
             else:
@@ -204,20 +208,20 @@
         else:
             return True
 
-    def onAuthorAddButtonClicked(self):
+    def on_add_author_button_clicked(self):
         """
         Add an author to the list.
         """
-        self.authorform.auto_display_name = True
-        if self.authorform.exec_():
+        self.author_form.auto_display_name = True
+        if self.author_form.exec_():
             author = Author.populate(
-                first_name=self.authorform.first_name,
-                last_name=self.authorform.last_name,
-                display_name=self.authorform.display_name
+                first_name=self.author_form.first_name,
+                last_name=self.author_form.last_name,
+                display_name=self.author_form.display_name
             )
-            if self.checkAuthor(author):
+            if self.check_author_exists(author):
                 if self.manager.save_object(author):
-                    self.resetAuthors()
+                    self.reset_authors()
                 else:
                     critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm', 'Could not add your author.'))
@@ -225,15 +229,15 @@
                 critical_error_message_box(
                     message=translate('SongsPlugin.SongMaintenanceForm', 'This author already exists.'))
 
-    def onTopicAddButtonClicked(self):
+    def on_add_topic_button_clicked(self):
         """
         Add a topic to the list.
         """
-        if self.topicform.exec_():
-            topic = Topic.populate(name=self.topicform.nameEdit.text())
-            if self.checkTopic(topic):
+        if self.topic_form.exec_():
+            topic = Topic.populate(name=self.topic_form.name)
+            if self.check_topic_exists(topic):
                 if self.manager.save_object(topic):
-                    self.resetTopics()
+                    self.reset_topics()
                 else:
                     critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm', 'Could not add your topic.'))
@@ -241,16 +245,16 @@
                 critical_error_message_box(
                     message=translate('SongsPlugin.SongMaintenanceForm', 'This topic already exists.'))
 
-    def onBookAddButtonClicked(self):
+    def on_add_book_button_clicked(self):
         """
         Add a book to the list.
         """
-        if self.bookform.exec_():
-            book = Book.populate(name=self.bookform.nameEdit.text(),
-                publisher=self.bookform.publisherEdit.text())
-            if self.checkBook(book):
+        if self.song_book_form.exec_():
+            book = Book.populate(name=self.song_book_form.name_edit.text(),
+                                 publisher=self.song_book_form.publisher_edit.text())
+            if self.check_song_book_exists(book):
                 if self.manager.save_object(book):
-                    self.resetBooks()
+                    self.reset_song_books()
                 else:
                     critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm', 'Could not add your book.'))
@@ -258,31 +262,31 @@
                 critical_error_message_box(
                     message=translate('SongsPlugin.SongMaintenanceForm', 'This book already exists.'))
 
-    def onAuthorEditButtonClicked(self):
+    def on_edit_author_button_clicked(self):
         """
         Edit an author.
         """
-        author_id = self._getCurrentItemId(self.authorsListWidget)
+        author_id = self._get_current_item_id(self.authors_list_widget)
         if author_id == -1:
             return
         author = self.manager.get_object(Author, author_id)
-        self.authorform.auto_display_name = False
-        self.authorform.first_name_edit.setText(author.first_name)
-        self.authorform.last_name_edit.setText(author.last_name)
-        self.authorform.display_edit.setText(author.display_name)
+        self.author_form.auto_display_name = False
+        self.author_form.first_name_edit.setText(author.first_name)
+        self.author_form.last_name_edit.setText(author.last_name)
+        self.author_form.display_edit.setText(author.display_name)
         # Save the author's first and last name as well as the display name
         # for the case that they have to be restored.
         temp_first_name = author.first_name
         temp_last_name = author.last_name
         temp_display_name = author.display_name
-        if self.authorform.exec_(False):
-            author.first_name = self.authorform.first_name_edit.text()
-            author.last_name = self.authorform.last_name_edit.text()
-            author.display_name = self.authorform.display_edit.text()
-            if self.checkAuthor(author, True):
+        if self.author_form.exec_(False):
+            author.first_name = self.author_form.first_name_edit.text()
+            author.last_name = self.author_form.last_name_edit.text()
+            author.display_name = self.author_form.display_edit.text()
+            if self.check_author_exists(author, True):
                 if self.manager.save_object(author):
-                    self.resetAuthors()
-                    if not self.fromSongEdit:
+                    self.reset_authors()
+                    if not self.from_song_edit:
                         Registry().execute(u'songs_load_list')
                 else:
                     critical_error_message_box(
@@ -292,8 +296,8 @@
                 'author %s use the existing author %s?') %
                     (author.display_name, temp_display_name, author.display_name), parent=self, question=True) == \
                     QtGui.QMessageBox.Yes:
-                self.__mergeObjects(author, self.mergeAuthors,
-                    self.resetAuthors)
+                self._merge_objects(author, self.merge_authors,
+                    self.reset_authors)
             else:
                 # We restore the author's old first and last name as well as
                 # his display name.
@@ -302,24 +306,24 @@
                 author.display_name = temp_display_name
                 critical_error_message_box(
                     message=translate('SongsPlugin.SongMaintenanceForm',
-                    'Could not save your modified author, because the author already exists.'))
+                                      'Could not save your modified author, because the author already exists.'))
 
-    def onTopicEditButtonClicked(self):
+    def on_edit_topic_button_clicked(self):
         """
         Edit a topic.
         """
-        topic_id = self._getCurrentItemId(self.topicsListWidget)
+        topic_id = self._get_current_item_id(self.topics_list_widget)
         if topic_id == -1:
             return
         topic = self.manager.get_object(Topic, topic_id)
-        self.topicform.nameEdit.setText(topic.name)
+        self.topic_form.name = topic.name
         # Save the topic's name for the case that he has to be restored.
         temp_name = topic.name
-        if self.topicform.exec_(False):
-            topic.name = self.topicform.nameEdit.text()
-            if self.checkTopic(topic, True):
+        if self.topic_form.exec_(False):
+            topic.name = self.topic_form.name_edit.text()
+            if self.check_topic_exists(topic, True):
                 if self.manager.save_object(topic):
-                    self.resetTopics()
+                    self.reset_topics()
                 else:
                     critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm', 'Could not save your changes.'))
@@ -327,7 +331,7 @@
                 message=translate('SongsPlugin.SongMaintenanceForm',
                 'The topic %s already exists. Would you like to make songs with topic %s use the existing topic %s?') %
                 (topic.name, temp_name, topic.name), parent=self, question=True) == QtGui.QMessageBox.Yes:
-                self.__mergeObjects(topic, self.mergeTopics, self.resetTopics)
+                self._merge_objects(topic, self.merge_topics, self.reset_topics)
             else:
                 # We restore the topics's old name.
                 topic.name = temp_name
@@ -335,28 +339,28 @@
                     message=translate('SongsPlugin.SongMaintenanceForm',
                     'Could not save your modified topic, because it already exists.'))
 
-    def onBookEditButtonClicked(self):
+    def on_edit_book_button_clicked(self):
         """
         Edit a book.
         """
-        book_id = self._getCurrentItemId(self.booksListWidget)
+        book_id = self._get_current_item_id(self.song_books_list_widget)
         if book_id == -1:
             return
         book = self.manager.get_object(Book, book_id)
         if book.publisher is None:
             book.publisher = u''
-        self.bookform.nameEdit.setText(book.name)
-        self.bookform.publisherEdit.setText(book.publisher)
+        self.song_book_form.name_edit.setText(book.name)
+        self.song_book_form.publisher_edit.setText(book.publisher)
         # Save the book's name and publisher for the case that they have to
         # be restored.
         temp_name = book.name
         temp_publisher = book.publisher
-        if self.bookform.exec_(False):
-            book.name = self.bookform.nameEdit.text()
-            book.publisher = self.bookform.publisherEdit.text()
-            if self.checkBook(book, True):
+        if self.song_book_form.exec_(False):
+            book.name = self.song_book_form.name_edit.text()
+            book.publisher = self.song_book_form.publisher_edit.text()
+            if self.check_song_book_exists(book, True):
                 if self.manager.save_object(book):
-                    self.resetBooks()
+                    self.reset_song_books()
                 else:
                     critical_error_message_box(
                         message=translate('SongsPlugin.SongMaintenanceForm', 'Could not save your changes.'))
@@ -364,138 +368,148 @@
                 message=translate('SongsPlugin.SongMaintenanceForm',
                     'The book %s already exists. Would you like to make songs with book %s use the existing book %s?') %
                 (book.name, temp_name, book.name), parent=self, question=True) == QtGui.QMessageBox.Yes:
-                self.__mergeObjects(book, self.mergeBooks, self.resetBooks)
+                self._merge_objects(book, self.merge_song_books, self.reset_song_books)
             else:
                 # We restore the book's old name and publisher.
                 book.name = temp_name
                 book.publisher = temp_publisher
 
-    def __mergeObjects(self, dbObject, merge, reset):
+    def _merge_objects(self, db_object, merge, reset):
         """
         Utility method to merge two objects to leave one in the database.
         """
         self.application.set_busy_cursor()
-        merge(dbObject)
+        merge(db_object)
         reset()
-        if not self.fromSongEdit:
+        if not self.from_song_edit:
             Registry().execute(u'songs_load_list')
         self.application.set_normal_cursor()
 
-    def mergeAuthors(self, oldAuthor):
+    def merge_authors(self, old_author):
         """
         Merges two authors into one author.
 
-        ``oldAuthor``
+        ``old_author``
             The object, which was edited, that will be deleted
         """
         # Find the duplicate.
-        existing_author = self.manager.get_object_filtered(Author,
-            and_(Author.first_name == oldAuthor.first_name,
-                Author.last_name == oldAuthor.last_name,
-                Author.display_name == oldAuthor.display_name,
-                Author.id != oldAuthor.id))
-        # Find the songs, which have the oldAuthor as author.
-        songs = self.manager.get_all_objects(Song,
-            Song.authors.contains(oldAuthor))
+        existing_author = self.manager.get_object_filtered(
+            Author,
+            and_(
+                Author.first_name == old_author.first_name,
+                Author.last_name == old_author.last_name,
+                Author.display_name == old_author.display_name,
+                Author.id != old_author.id
+            )
+        )
+        # Find the songs, which have the old_author as author.
+        songs = self.manager.get_all_objects(Song, Song.authors.contains(old_author))
         for song in songs:
             # We check if the song has already existing_author as author. If
             # that is not the case we add it.
             if existing_author not in song.authors:
                 song.authors.append(existing_author)
-            song.authors.remove(oldAuthor)
+            song.authors.remove(old_author)
             self.manager.save_object(song)
-        self.manager.delete_object(Author, oldAuthor.id)
+        self.manager.delete_object(Author, old_author.id)
 
-    def mergeTopics(self, oldTopic):
+    def merge_topics(self, old_topic):
         """
         Merges two topics into one topic.
 
-        ``oldTopic``
+        ``old_topic``
             The object, which was edited, that will be deleted
         """
         # Find the duplicate.
-        existing_topic = self.manager.get_object_filtered(Topic,
-            and_(Topic.name == oldTopic.name, Topic.id != oldTopic.id))
-        # Find the songs, which have the oldTopic as topic.
-        songs = self.manager.get_all_objects(Song, Song.topics.contains(oldTopic))
+        existing_topic = self.manager.get_object_filtered(
+            Topic,
+            and_(
+                Topic.name == old_topic.name, Topic.id != old_topic.id
+            )
+        )
+        # Find the songs, which have the old_topic as topic.
+        songs = self.manager.get_all_objects(Song, Song.topics.contains(old_topic))
         for song in songs:
             # We check if the song has already existing_topic as topic. If that
             # is not the case we add it.
             if existing_topic not in song.topics:
                 song.topics.append(existing_topic)
-            song.topics.remove(oldTopic)
+            song.topics.remove(old_topic)
             self.manager.save_object(song)
-        self.manager.delete_object(Topic, oldTopic.id)
+        self.manager.delete_object(Topic, old_topic.id)
 
-    def mergeBooks(self, oldBook):
+    def merge_song_books(self, old_song_book):
         """
         Merges two books into one book.
 
-        ``oldBook``
+        ``old_song_book``
             The object, which was edited, that will be deleted
         """
         # Find the duplicate.
-        existing_book = self.manager.get_object_filtered(Book,
-            and_(Book.name == oldBook.name,
-                Book.publisher == oldBook.publisher,
-                Book.id != oldBook.id))
-        # Find the songs, which have the oldBook as book.
-        songs = self.manager.get_all_objects(Song,
-            Song.song_book_id == oldBook.id)
+        existing_book = self.manager.get_object_filtered(
+            Book,
+            and_(
+                Book.name == old_song_book.name,
+                Book.publisher == old_song_book.publisher,
+                Book.id != old_song_book.id
+            )
+        )
+        # Find the songs, which have the old_song_book as book.
+        songs = self.manager.get_all_objects(Song, Song.song_book_id == old_song_book.id)
         for song in songs:
             song.song_book_id = existing_book.id
             self.manager.save_object(song)
-        self.manager.delete_object(Book, oldBook.id)
+        self.manager.delete_object(Book, old_song_book.id)
 
-    def onAuthorDeleteButtonClicked(self):
+    def on_delete_author_button_clicked(self):
         """
         Delete the author if the author is not attached to any songs.
         """
-        self._deleteItem(Author, self.authorsListWidget, self.resetAuthors,
+        self._delete_item(Author, self.authors_list_widget, self.reset_authors,
             translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'),
             translate('SongsPlugin.SongMaintenanceForm', 'Are you sure you want to delete the selected author?'),
             translate('SongsPlugin.SongMaintenanceForm',
                 'This author cannot be deleted, they are currently assigned to at least one song.'))
 
-    def onTopicDeleteButtonClicked(self):
+    def on_delete_topic_button_clicked(self):
         """
         Delete the Book if the Book is not attached to any songs.
         """
-        self._deleteItem(Topic, self.topicsListWidget, self.resetTopics,
+        self._delete_item(Topic, self.topics_list_widget, self.reset_topics,
             translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
             translate('SongsPlugin.SongMaintenanceForm', 'Are you sure you want to delete the selected topic?'),
             translate('SongsPlugin.SongMaintenanceForm',
                 'This topic cannot be deleted, it is currently assigned to at least one song.'))
 
-    def onBookDeleteButtonClicked(self):
+    def on_delete_book_button_clicked(self):
         """
         Delete the Book if the Book is not attached to any songs.
         """
-        self._deleteItem(Book, self.booksListWidget, self.resetBooks,
+        self._delete_item(Book, self.song_books_list_widget, self.reset_song_books,
             translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),
             translate('SongsPlugin.SongMaintenanceForm', 'Are you sure you want to delete the selected book?'),
             translate('SongsPlugin.SongMaintenanceForm',
                 'This book cannot be deleted, it is currently assigned to at least one song.'))
 
-    def onAuthorsListRowChanged(self, row):
-        """
-        Called when the *authorsListWidget*'s current row has changed.
-        """
-        self.__rowChange(row, self.authorsEditButton, self.authorsDeleteButton)
-
-    def onTopicsListRowChanged(self, row):
-        """
-        Called when the *topicsListWidget*'s current row has changed.
-        """
-        self.__rowChange(row, self.topicsEditButton, self.topicsDeleteButton)
-
-    def onBooksListRowChanged(self, row):
-        """
-        Called when the *booksListWidget*'s current row has changed.
-        """
-        self.__rowChange(row, self.booksEditButton, self.booksDeleteButton)
-
-    def __rowChange(self, row, editButton, deleteButton):
+    def on_authors_list_row_changed(self, row):
+        """
+        Called when the *authors_list_widget*'s current row has changed.
+        """
+        self._row_change(row, self.edit_author_button, self.delete_author_button)
+
+    def on_topics_list_row_changed(self, row):
+        """
+        Called when the *topics_list_widget*'s current row has changed.
+        """
+        self._row_change(row, self.edit_topic_button, self.delete_topic_button)
+
+    def on_song_books_list_row_changed(self, row):
+        """
+        Called when the *song_books_list_widget*'s current row has changed.
+        """
+        self._row_change(row, self.edit_book_button, self.delete_book_button)
+
+    def _row_change(self, row, edit_button, delete_button):
         """
         Utility method to toggle if buttons are enabled.
 
@@ -503,15 +517,15 @@
             The current row. If there is no current row, the value is -1.
         """
         if row == -1:
-            deleteButton.setEnabled(False)
-            editButton.setEnabled(False)
+            delete_button.setEnabled(False)
+            edit_button.setEnabled(False)
         else:
-            deleteButton.setEnabled(True)
-            editButton.setEnabled(True)
+            delete_button.setEnabled(True)
+            edit_button.setEnabled(True)
 
     def _get_application(self):
         """
-        Adds the openlp to the class dynamically
+        Adds the application to the class dynamically
         """
         if not hasattr(self, u'_application'):
             self._application = Registry().get(u'application')

=== modified file 'openlp/plugins/songs/forms/topicsdialog.py'
--- openlp/plugins/songs/forms/topicsdialog.py	2013-01-27 20:36:18 +0000
+++ openlp/plugins/songs/forms/topicsdialog.py	2013-03-18 12:12:23 +0000
@@ -32,26 +32,36 @@
 from openlp.core.lib import translate
 from openlp.core.lib.ui import create_button_box
 
+
 class Ui_TopicsDialog(object):
-    def setupUi(self, topicsDialog):
-        topicsDialog.setObjectName(u'topicsDialog')
-        topicsDialog.resize(300, 10)
-        self.dialogLayout = QtGui.QVBoxLayout(topicsDialog)
-        self.dialogLayout.setObjectName(u'dialog_layout')
-        self.nameLayout = QtGui.QFormLayout()
-        self.nameLayout.setObjectName(u'nameLayout')
-        self.nameLabel = QtGui.QLabel(topicsDialog)
-        self.nameLabel.setObjectName(u'nameLabel')
-        self.nameEdit = QtGui.QLineEdit(topicsDialog)
-        self.nameEdit.setObjectName(u'nameEdit')
-        self.nameLabel.setBuddy(self.nameEdit)
-        self.nameLayout.addRow(self.nameLabel, self.nameEdit)
-        self.dialogLayout.addLayout(self.nameLayout)
-        self.button_box = create_button_box(topicsDialog, u'button_box', [u'cancel', u'save'])
-        self.dialogLayout.addWidget(self.button_box)
-        self.retranslateUi(topicsDialog)
-        topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
+    """
+    The user interface for the topics dialog.
+    """
+    def setupUi(self, topics_dialog):
+        """
+        Set up the user interface for the topics dialog.
+        """
+        topics_dialog.setObjectName(u'topics_dialog')
+        topics_dialog.resize(300, 10)
+        self.dialog_layout = QtGui.QVBoxLayout(topics_dialog)
+        self.dialog_layout.setObjectName(u'dialog_layout')
+        self.name_layout = QtGui.QFormLayout()
+        self.name_layout.setObjectName(u'name_layout')
+        self.name_label = QtGui.QLabel(topics_dialog)
+        self.name_label.setObjectName(u'name_label')
+        self.name_edit = QtGui.QLineEdit(topics_dialog)
+        self.name_edit.setObjectName(u'name_edit')
+        self.name_label.setBuddy(self.name_edit)
+        self.name_layout.addRow(self.name_label, self.name_edit)
+        self.dialog_layout.addLayout(self.name_layout)
+        self.button_box = create_button_box(topics_dialog, u'button_box', [u'cancel', u'save'])
+        self.dialog_layout.addWidget(self.button_box)
+        self.retranslateUi(topics_dialog)
+        topics_dialog.setMaximumHeight(topics_dialog.sizeHint().height())
 
-    def retranslateUi(self, topicsDialog):
-        topicsDialog.setWindowTitle(translate('SongsPlugin.TopicsForm', 'Topic Maintenance'))
-        self.nameLabel.setText(translate('SongsPlugin.TopicsForm', 'Topic name:'))
+    def retranslateUi(self, topics_dialog):
+        """
+        Translate the UI on the fly.
+        """
+        topics_dialog.setWindowTitle(translate('SongsPlugin.TopicsForm', 'Topic Maintenance'))
+        self.name_label.setText(translate('SongsPlugin.TopicsForm', 'Topic name:'))

=== modified file 'openlp/plugins/songs/forms/topicsform.py'
--- openlp/plugins/songs/forms/topicsform.py	2013-01-31 22:01:41 +0000
+++ openlp/plugins/songs/forms/topicsform.py	2013-03-18 12:12:23 +0000
@@ -26,6 +26,9 @@
 # with this program; if not, write to the Free Software Foundation, Inc., 59  #
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
+"""
+This module contains the topic edit form.
+"""
 
 from PyQt4 import QtGui
 
@@ -50,18 +53,32 @@
         Execute the dialog.
         """
         if clear:
-            self.nameEdit.clear()
-        self.nameEdit.setFocus()
+            self.name_edit.clear()
+        self.name_edit.setFocus()
         return QtGui.QDialog.exec_(self)
 
     def accept(self):
         """
         Override the inherited method to check before we close.
         """
-        if not self.nameEdit.text():
+        if not self.name_edit.text():
             critical_error_message_box(message=translate('SongsPlugin.TopicsForm',
                 'You need to type in a topic name.'))
-            self.nameEdit.setFocus()
+            self.name_edit.setFocus()
             return False
         else:
             return QtGui.QDialog.accept(self)
+
+    def _get_name(self):
+        """
+        Return the name of the topic.
+        """
+        return self.name_edit.text()
+
+    def _set_name(self, value):
+        """
+        Set the topic name.
+        """
+        self.name_edit.setText(value)
+
+    name = property(_get_name, _set_name)

=== modified file 'openlp/plugins/songs/lib/__init__.py'
--- openlp/plugins/songs/lib/__init__.py	2013-03-07 21:04:19 +0000
+++ openlp/plugins/songs/lib/__init__.py	2013-03-18 12:12:23 +0000
@@ -386,6 +386,8 @@
     ``song``
         The song object.
     """
+    from xml import SongXML
+
     if isinstance(song.title, buffer):
         song.title = unicode(song.title)
     if isinstance(song.alternate_title, buffer):

=== modified file 'tests/interfaces/__init__.py'
--- tests/interfaces/__init__.py	2013-03-07 12:34:35 +0000
+++ tests/interfaces/__init__.py	2013-03-18 12:12:23 +0000
@@ -7,7 +7,7 @@
 sip.setapi(u'QUrl', 2)
 sip.setapi(u'QVariant', 2)
 
-from PyQt4 import QtGui
+#from PyQt4 import QtGui
 
 # Only one QApplication can be created. Use QtGui.QApplication.instance() when you need to "create" an QApplication.
-application = QtGui.QApplication([])
+#application = QtGui.QApplication([])

=== modified file 'tests/interfaces/openlp_core_lib/test_pluginmanager.py'
--- tests/interfaces/openlp_core_lib/test_pluginmanager.py	2013-03-07 12:34:35 +0000
+++ tests/interfaces/openlp_core_lib/test_pluginmanager.py	2013-03-18 12:12:23 +0000
@@ -29,7 +29,7 @@
         Settings().setValue(u'advanced/data path', self.temp_dir)
         Registry.create()
         Registry().register(u'service_list', MagicMock())
-        self.app = QtGui.QApplication.instance()
+        self.app = QtGui.QApplication([])
         self.main_window = QtGui.QMainWindow()
         Registry().register(u'main_window', self.main_window)
 
@@ -42,7 +42,7 @@
 
     def find_plugins_test(self):
         """
-        Test the find_plugins() method to ensure it imports the correct plugins.
+        Test the find_plugins() method to ensure it imports the correct plugins
         """
         # GIVEN: A plugin manager
         plugin_manager = PluginManager()

=== modified file 'tests/interfaces/openlp_core_ui/test_filerenamedialog.py'
--- tests/interfaces/openlp_core_ui/test_filerenamedialog.py	2013-03-10 20:19:42 +0000
+++ tests/interfaces/openlp_core_ui/test_filerenamedialog.py	2013-03-18 12:12:23 +0000
@@ -16,7 +16,7 @@
         Create the UI
         """
         Registry.create()
-        self.app = QtGui.QApplication.instance()
+        self.app = QtGui.QApplication([])
         self.main_window = QtGui.QMainWindow()
         Registry().register(u'main_window', self.main_window)
         self.form = filerenameform.FileRenameForm()

=== modified file 'tests/interfaces/openlp_core_ui/test_servicemanager.py'
--- tests/interfaces/openlp_core_ui/test_servicemanager.py	2013-02-18 21:36:36 +0000
+++ tests/interfaces/openlp_core_ui/test_servicemanager.py	2013-03-18 12:12:23 +0000
@@ -18,7 +18,7 @@
         Create the UI
         """
         Registry.create()
-        self.app = QtGui.QApplication.instance()
+        self.app = QtGui.QApplication([])
         ScreenList.create(self.app.desktop())
         Registry().register(u'application', MagicMock())
         with patch(u'openlp.core.lib.PluginManager'):

=== modified file 'tests/interfaces/openlp_core_ui/test_servicenotedialog.py'
--- tests/interfaces/openlp_core_ui/test_servicenotedialog.py	2013-03-12 09:37:27 +0000
+++ tests/interfaces/openlp_core_ui/test_servicenotedialog.py	2013-03-18 12:12:23 +0000
@@ -17,7 +17,7 @@
         Create the UI
         """
         Registry.create()
-        self.app = QtGui.QApplication.instance()
+        self.app = QtGui.QApplication([])
         self.main_window = QtGui.QMainWindow()
         Registry().register(u'main_window', self.main_window)
         self.form = servicenoteform.ServiceNoteForm()

=== modified file 'tests/interfaces/openlp_core_ui/test_settings_form.py'
--- tests/interfaces/openlp_core_ui/test_settings_form.py	2013-03-17 20:20:43 +0000
+++ tests/interfaces/openlp_core_ui/test_settings_form.py	2013-03-18 12:12:23 +0000
@@ -5,7 +5,7 @@
 
 from mock import MagicMock, patch
 
-from PyQt4 import QtCore, QtTest
+from PyQt4 import QtCore, QtTest, QtGui
 
 from openlp.core.ui import settingsform
 from openlp.core.lib import Registry, ScreenList
@@ -31,6 +31,7 @@
         self.dummy2 = MagicMock()
         self.dummy3 = MagicMock()
         self.desktop = MagicMock()
+        self.app = QtGui.QApplication([])
         self.desktop.primaryScreen.return_value = SCREEN[u'primary']
         self.desktop.screenCount.return_value = SCREEN[u'number']
         self.desktop.screenGeometry.return_value = SCREEN[u'size']
@@ -43,6 +44,7 @@
         Delete all the C++ objects at the end so that we don't have a segfault
         """
         del self.form
+        del self.app
 
     def basic_cancel_test(self):
         """

=== modified file 'tests/interfaces/openlp_core_ui/test_starttimedialog.py'
--- tests/interfaces/openlp_core_ui/test_starttimedialog.py	2013-03-12 09:37:27 +0000
+++ tests/interfaces/openlp_core_ui/test_starttimedialog.py	2013-03-18 12:12:23 +0000
@@ -18,7 +18,7 @@
         Create the UI
         """
         Registry.create()
-        self.app = QtGui.QApplication.instance()
+        self.app = QtGui.QApplication([])
         self.main_window = QtGui.QMainWindow()
         Registry().register(u'main_window', self.main_window)
         self.form = starttimeform.StartTimeForm()

=== modified file 'tests/interfaces/openlp_plugins_songs_forms/test_authorsform.py'
--- tests/interfaces/openlp_plugins_songs_forms/test_authorsform.py	2013-03-07 12:34:35 +0000
+++ tests/interfaces/openlp_plugins_songs_forms/test_authorsform.py	2013-03-18 12:12:23 +0000
@@ -10,13 +10,16 @@
 
 
 class TestAuthorsForm(TestCase):
+    """
+    Test the AuthorsForm class
+    """
 
     def setUp(self):
         """
         Create the UI
         """
         Registry.create()
-        self.app = QtGui.QApplication.instance()
+        self.app = QtGui.QApplication([])
         self.main_window = QtGui.QMainWindow()
         Registry().register(u'main_window', self.main_window)
         self.form = AuthorsForm()
@@ -39,7 +42,7 @@
 
     def get_first_name_property_test(self):
         """
-        Test that getting the first name property on the AuthorForm works correctly.
+        Test that getting the first name property on the AuthorForm works correctly
         """
         # GIVEN: A first name to set
         first_name = u'John'
@@ -52,7 +55,7 @@
 
     def set_first_name_property_test(self):
         """
-        Test that setting the first name property on the AuthorForm works correctly.
+        Test that setting the first name property on the AuthorForm works correctly
         """
         # GIVEN: A first name to set
         first_name = u'James'
@@ -65,7 +68,7 @@
 
     def get_last_name_property_test(self):
         """
-        Test that getting the last name property on the AuthorForm works correctly.
+        Test that getting the last name property on the AuthorForm works correctly
         """
         # GIVEN: A last name to set
         last_name = u'Smith'
@@ -78,7 +81,7 @@
 
     def set_last_name_property_test(self):
         """
-        Test that setting the last name property on the AuthorForm works correctly.
+        Test that setting the last name property on the AuthorForm works correctly
         """
         # GIVEN: A last name to set
         last_name = u'Potter'
@@ -91,7 +94,7 @@
 
     def get_display_name_property_test(self):
         """
-        Test that getting the display name property on the AuthorForm works correctly.
+        Test that getting the display name property on the AuthorForm works correctly
         """
         # GIVEN: A display name to set
         display_name = u'John'
@@ -104,7 +107,7 @@
 
     def set_display_name_property_test(self):
         """
-        Test that setting the display name property on the AuthorForm works correctly.
+        Test that setting the display name property on the AuthorForm works correctly
         """
         # GIVEN: A display name to set
         display_name = u'John'

=== modified file 'tests/interfaces/openlp_plugins_songs_forms/test_editsongform.py'
--- tests/interfaces/openlp_plugins_songs_forms/test_editsongform.py	2013-03-07 12:34:35 +0000
+++ tests/interfaces/openlp_plugins_songs_forms/test_editsongform.py	2013-03-18 12:12:23 +0000
@@ -11,12 +11,16 @@
 
 
 class TestEditSongForm(TestCase):
+    """
+    Test the EditSongForm class
+    """
+
     def setUp(self):
         """
         Create the UI
         """
         Registry.create()
-        self.app = QtGui.QApplication.instance()
+        self.app = QtGui.QApplication([])
         self.main_window = QtGui.QMainWindow()
         Registry().register(u'main_window', self.main_window)
         Registry().register(u'theme_manager', MagicMock())
@@ -38,3 +42,6 @@
         self.assertFalse(self.form.verse_delete_button.isEnabled(), u'The verse delete button should not be enabled')
         self.assertFalse(self.form.author_remove_button.isEnabled(), u'The author remove button should not be enabled')
         self.assertFalse(self.form.topic_remove_button.isEnabled(), u'The topic remove button should not be enabled')
+
+    def is_verse_edit_form_executed_test(self):
+        pass
\ No newline at end of file

=== modified file 'tests/interfaces/openlp_plugins_songs_forms/test_editverseform.py'
--- tests/interfaces/openlp_plugins_songs_forms/test_editverseform.py	2013-03-07 12:34:35 +0000
+++ tests/interfaces/openlp_plugins_songs_forms/test_editverseform.py	2013-03-18 12:12:23 +0000
@@ -3,19 +3,23 @@
 """
 from unittest import TestCase
 
-from PyQt4 import QtGui
+from PyQt4 import QtCore, QtGui, QtTest
 
 from openlp.core.lib import Registry
 from openlp.plugins.songs.forms.editverseform import EditVerseForm
 
 
 class TestEditVerseForm(TestCase):
+    """
+    Test the EditVerseForm class
+    """
+
     def setUp(self):
         """
         Create the UI
         """
         Registry.create()
-        self.app = QtGui.QApplication.instance()
+        self.app = QtGui.QApplication([])
         self.main_window = QtGui.QMainWindow()
         Registry().register(u'main_window', self.main_window)
         self.form = EditVerseForm()
@@ -32,4 +36,60 @@
         """
         Test the EditVerseForm defaults are correct
         """
-        self.assertEqual(self.form.verseTextEdit.toPlainText(), u'', u'The verse edit box is empty.')
+        # GIVEN: An EditVerseForm instance
+        # WHEN: The form is shown
+        # THEN: The default value is correct
+        self.assertEqual(self.form.verse_text_edit.toPlainText(), u'', u'The verse edit box is empty.')
+
+    def type_verse_text_tests(self):
+        """
+        Test that typing into the verse text edit box returns the correct text
+        """
+        # GIVEN: An instance of the EditVerseForm and some text to type
+        text = 'Amazing Grace, how sweet the sound!'
+
+        # WHEN: Some verse text is typed into the text edit
+        QtTest.QTest.keyClicks(self.form.verse_text_edit, text)
+
+        # THEN: The verse text edit should have the verse text in it
+        self.assertEqual(text, self.form.verse_text_edit.toPlainText(),
+                         u'The verse text edit should have the typed out verse')
+
+    def insert_verse_test(self):
+        """
+        Test that clicking the insert button inserts the correct verse marker
+        """
+        # GIVEN: An instance of the EditVerseForm
+        # WHEN: The Insert button is clicked
+        QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton)
+
+        # THEN: The verse text edit should have a Verse:1 in it
+        self.assertIn(u'---[Verse:1]---', self.form.verse_text_edit.toPlainText(),
+                      u'The verse text edit should have a verse marker')
+
+    def insert_verse_2_test(self):
+        """
+        Test that clicking the up button on the spin box and then clicking the insert button inserts the correct marker
+        """
+        # GIVEN: An instance of the EditVerseForm
+        # WHEN: The spin button and then the Insert button are clicked
+        QtTest.QTest.keyClick(self.form.verse_number_box, QtCore.Qt.Key_Up)
+        QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton)
+
+        # THEN: The verse text edit should have a Verse:1 in it
+        self.assertIn(u'---[Verse:2]---', self.form.verse_text_edit.toPlainText(),
+                      u'The verse text edit should have a "Verse 2" marker')
+
+    def insert_chorus_test(self):
+        """
+        Test that clicking the verse type combo box and then clicking the insert button inserts the correct marker
+        """
+        # GIVEN: An instance of the EditVerseForm
+        # WHEN: The verse type combo box and then the Insert button are clicked
+        QtTest.QTest.keyClick(self.form.verse_type_combo_box, QtCore.Qt.Key_Down)
+        QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton)
+
+        # THEN: The verse text edit should have a Chorus:1 in it
+        self.assertIn(u'---[Chorus:1]---', self.form.verse_text_edit.toPlainText(),
+                      u'The verse text edit should have a "Chorus 1" marker')
+

=== added file 'tests/interfaces/openlp_plugins_songs_forms/test_topicsform.py'
--- tests/interfaces/openlp_plugins_songs_forms/test_topicsform.py	1970-01-01 00:00:00 +0000
+++ tests/interfaces/openlp_plugins_songs_forms/test_topicsform.py	2013-03-18 12:12:23 +0000
@@ -0,0 +1,65 @@
+"""
+Package to test the openlp.plugins.songs.forms.topicsform package.
+"""
+from unittest import TestCase
+
+from PyQt4 import QtGui
+
+from openlp.core.lib import Registry
+from openlp.plugins.songs.forms.topicsform import TopicsForm
+
+
+class TestTopicsForm(TestCase):
+    """
+    Test the TopicsForm class
+    """
+
+    def setUp(self):
+        """
+        Create the UI
+        """
+        Registry.create()
+        self.app = QtGui.QApplication([])
+        self.main_window = QtGui.QMainWindow()
+        Registry().register(u'main_window', self.main_window)
+        self.form = TopicsForm()
+
+    def tearDown(self):
+        """
+        Delete all the C++ objects at the end so that we don't have a segfault
+        """
+        del self.form
+        del self.main_window
+        del self.app
+
+    def ui_defaults_test(self):
+        """
+        Test the TopicsForm defaults are correct
+        """
+        self.assertEqual(self.form.name_edit.text(), u'', u'The first name edit should be empty')
+
+    def get_name_property_test(self):
+        """
+        Test that getting the name property on the TopicsForm works correctly
+        """
+        # GIVEN: A topic name to set
+        topic_name = u'Salvation'
+
+        # WHEN: The name_edit's text is set
+        self.form.name_edit.setText(topic_name)
+
+        # THEN: The name property should have the correct value
+        self.assertEqual(self.form.name, topic_name, u'The name property should be correct')
+
+    def set_name_property_test(self):
+        """
+        Test that setting the name property on the TopicsForm works correctly
+        """
+        # GIVEN: A topic name to set
+        topic_name = u'James'
+
+        # WHEN: The name property is set
+        self.form.name = topic_name
+
+        # THEN: The name_edit should have the correct value
+        self.assertEqual(self.form.name_edit.text(), topic_name, u'The topic name should be set correctly')


Follow ups