← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/trivial into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/trivial into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


- disabled text search for web bibles


-- 
https://code.launchpad.net/~googol-hush/openlp/trivial/+merge/40769
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/trivial into lp:openlp.
=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py	2010-09-14 18:18:47 +0000
+++ openlp/core/ui/themestab.py	2010-11-12 22:31:20 +0000
@@ -183,13 +183,19 @@
 
     def updateThemeList(self, theme_list):
         """
-        Called from ThemeManager when the Themes have changed
+        Called from ThemeManager when the Themes have changed.
+
+        ``theme_list``
+            The list of available themes::
+
+                [u'Song Theme', u'Bible Theme']
         """
-        #reload as may have been triggered by the ThemeManager
+        # Reload as may have been triggered by the ThemeManager.
         self.global_theme = unicode(QtCore.QSettings().value(
             self.settingsSection + u'/global theme',
             QtCore.QVariant(u'')).toString())
         self.DefaultComboBox.clear()
+        theme_list.sort()
         for theme in theme_list:
             self.DefaultComboBox.addItem(theme)
         id = self.DefaultComboBox.findText(

=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py	2010-10-16 19:38:23 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py	2010-11-12 22:31:20 +0000
@@ -133,7 +133,7 @@
                     self.OSISLocationEdit.setFocus()
                     return False
             elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
-                if self.field(u'csv_booksfile').toString() == u'':
+                if not self.field(u'csv_booksfile').toString():
                     QtGui.QMessageBox.critical(self,
                         translate('BiblesPlugin.ImportWizardForm',
                         'Invalid Books File'),
@@ -142,7 +142,7 @@
                         'the Bible to use in the import.'))
                     self.BooksLocationEdit.setFocus()
                     return False
-                elif self.field(u'csv_versefile').toString() == u'':
+                elif not self.field(u'csv_versefile').toString():
                     QtGui.QMessageBox.critical(self,
                         translate('BiblesPlugin.ImportWizardForm',
                         'Invalid Verse File'),
@@ -153,7 +153,7 @@
                     return False
             elif self.field(u'source_format').toInt()[0] == \
                 BibleFormat.OpenSong:
-                if self.field(u'opensong_file').toString() == u'':
+                if not self.field(u'opensong_file').toString():
                     QtGui.QMessageBox.critical(self,
                         translate('BiblesPlugin.ImportWizardForm',
                         'Invalid OpenSong Bible'),
@@ -168,7 +168,7 @@
             license_version = unicode(self.field(u'license_version').toString())
             license_copyright = \
                 unicode(self.field(u'license_copyright').toString())
-            if license_version == u'':
+            if not license_version:
                 QtGui.QMessageBox.critical(self,
                     translate('BiblesPlugin.ImportWizardForm',
                     'Empty Version Name'),
@@ -176,7 +176,7 @@
                     'You need to specify a version name for your Bible.'))
                 self.VersionNameEdit.setFocus()
                 return False
-            elif license_copyright == u'':
+            elif not license_copyright:
                 QtGui.QMessageBox.critical(self,
                     translate('BiblesPlugin.ImportWizardForm',
                     'Empty Copyright'),
@@ -207,9 +207,11 @@
             The index of the combo box.
         """
         self.BibleComboBox.clear()
-        for bible in self.web_bible_list[index].keys():
-            self.BibleComboBox.addItem(unicode(
-                translate('BiblesPlugin.ImportWizardForm', bible)))
+        bibles = [unicode(translate('BiblesPlugin.ImportWizardForm', bible)) for
+            bible in self.web_bible_list[index].keys()]
+        bibles.sort()
+        for bible in bibles:
+            self.BibleComboBox.addItem(bible)
 
     def onOsisFileButtonClicked(self):
         """
@@ -317,7 +319,7 @@
         """
         Load the list of Crosswalk and BibleGateway bibles.
         """
-        #Load and store Crosswalk Bibles
+        # Load and store Crosswalk Bibles.
         filepath = AppLocation.get_directory(AppLocation.PluginsDir)
         filepath = os.path.join(filepath, u'bibles', u'resources')
         books_file = None
@@ -341,7 +343,7 @@
         finally:
             if books_file:
                 books_file.close()
-        #Load and store BibleGateway Bibles
+        # Load and store BibleGateway Bibles.
         books_file = None
         try:
             self.web_bible_list[WebDownload.BibleGateway] = {}
@@ -379,12 +381,18 @@
         Receiver.send_message(u'openlp_process_events')
 
     def preImport(self):
+        bible_type = self.field(u'source_format').toInt()[0]
         self.finishButton.setVisible(False)
         self.ImportProgressBar.setMinimum(0)
         self.ImportProgressBar.setMaximum(1188)
         self.ImportProgressBar.setValue(0)
-        self.ImportProgressLabel.setText(
-            translate('BiblesPlugin.ImportWizardForm', 'Starting import...'))
+        if bible_type == BibleFormat.WebDownload:
+            self.ImportProgressLabel.setText(translate(
+                'BiblesPlugin.ImportWizardForm',
+                'Starting Registering bible...'))
+        else:
+            self.ImportProgressLabel.setText(translate(
+                'BiblesPlugin.ImportWizardForm', 'Starting import...'))
         Receiver.send_message(u'openlp_process_events')
 
     def performImport(self):
@@ -395,26 +403,26 @@
             unicode(self.field(u'license_permissions').toString())
         importer = None
         if bible_type == BibleFormat.OSIS:
-            # Import an OSIS bible
+            # Import an OSIS bible.
             importer = self.manager.import_bible(BibleFormat.OSIS,
                 name=license_version,
                 filename=unicode(self.field(u'osis_location').toString())
             )
         elif bible_type == BibleFormat.CSV:
-            # Import a CSV bible
+            # Import a CSV bible.
             importer = self.manager.import_bible(BibleFormat.CSV,
                 name=license_version,
                 booksfile=unicode(self.field(u'csv_booksfile').toString()),
                 versefile=unicode(self.field(u'csv_versefile').toString())
             )
         elif bible_type == BibleFormat.OpenSong:
-            # Import an OpenSong bible
+            # Import an OpenSong bible.
             importer = self.manager.import_bible(BibleFormat.OpenSong,
                 name=license_version,
                 filename=unicode(self.field(u'opensong_file').toString())
             )
         elif bible_type == BibleFormat.WebDownload:
-            # Import a bible from the web
+            # Import a bible from the web.
             self.ImportProgressBar.setMaximum(1)
             download_location = self.field(u'web_location').toInt()[0]
             bible_version = unicode(self.BibleComboBox.currentText())
@@ -438,8 +446,14 @@
             self.manager.save_meta_data(license_version, license_version,
                 license_copyright, license_permissions)
             self.manager.reload_bibles()
-            self.ImportProgressLabel.setText(
-                translate('BiblesPlugin.ImportWizardForm', 'Finished import.'))
+            if bible_type == BibleFormat.WebDownload:
+                self.ImportProgressLabel.setText(
+                    translate('BiblesPlugin.ImportWizardForm', 'Registered '
+                    'bible. Please note, that verses will be downloaded on\n'
+                    'demand and thus an internet connection is required.'))
+            else:
+                self.ImportProgressLabel.setText(translate(
+                    'BiblesPlugin.ImportWizardForm', 'Finished import.'))
         else:
             self.ImportProgressLabel.setText(
                 translate('BiblesPlugin.ImportWizardForm',

=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py	2010-09-16 21:10:36 +0000
+++ openlp/plugins/bibles/lib/biblestab.py	2010-11-12 22:31:20 +0000
@@ -190,13 +190,13 @@
 
     def onNewChaptersCheckBoxChanged(self, check_state):
         self.show_new_chapters = False
-        # we have a set value convert to True/False
+        # We have a set value convert to True/False.
         if check_state == QtCore.Qt.Checked:
             self.show_new_chapters = True
 
     def onBibleDualCheckBox(self, check_state):
         self.dual_bibles = False
-        # we have a set value convert to True/False
+        # We have a set value convert to True/False.
         if check_state == QtCore.Qt.Checked:
             self.dual_bibles = True
 
@@ -234,16 +234,22 @@
 
     def updateThemeList(self, theme_list):
         """
-        Called from ThemeManager when the Themes have changed
+        Called from ThemeManager when the Themes have changed.
+
+        ``theme_list``
+            The list of available themes::
+
+                [u'Song Theme', u'Bible Theme']
         """
         self.BibleThemeComboBox.clear()
         self.BibleThemeComboBox.addItem(u'')
+        theme_list.sort()
         for theme in theme_list:
             self.BibleThemeComboBox.addItem(theme)
         index = self.BibleThemeComboBox.findText(
             unicode(self.bible_theme), QtCore.Qt.MatchExactly)
         if index == -1:
-            # Not Found
+            # Not Found.
             index = 0
             self.bible_theme = u''
         self.BibleThemeComboBox.setCurrentIndex(index)

=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py	2010-10-09 19:36:05 +0000
+++ openlp/plugins/bibles/lib/db.py	2010-11-12 22:31:20 +0000
@@ -44,24 +44,28 @@
     """
     pass
 
+
 class Testament(BaseModel):
     """
     Bible Testaments
     """
     pass
 
+
 class Book(BaseModel):
     """
     Song model
     """
     pass
 
+
 class Verse(BaseModel):
     """
     Topic model
     """
     pass
 
+
 def init_schema(url):
     """
     Setup a bible database connection and initialise the database schema.

=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2010-10-27 17:42:10 +0000
+++ openlp/plugins/bibles/lib/http.py	2010-11-12 22:31:20 +0000
@@ -364,12 +364,11 @@
         if self.proxy_server:
             self.create_meta(u'proxy server', self.proxy_server)
         if self.proxy_username:
-            # store the proxy userid
+            # Store the proxy userid.
             self.create_meta(u'proxy username', self.proxy_username)
         if self.proxy_password:
-            # store the proxy password
+            # Store the proxy password.
             self.create_meta(u'proxy password', self.proxy_password)
-        self.wizard.incrementProgressBar('Registered.')
         return True
 
     def get_verses(self, reference_list):
@@ -417,7 +416,7 @@
                     ## to request ac and get Acts back.
                     bookname = search_results.book
                     Receiver.send_message(u'openlp_process_events')
-                    # check to see if book/chapter exists
+                    # Check to see if book/chapter exists.
                     db_book = self.get_book(bookname)
                     self.create_chapter(db_book.id, search_results.chapter,
                         search_results.verselist)

=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2010-10-27 17:42:10 +0000
+++ openlp/plugins/bibles/lib/manager.py	2010-11-12 22:31:20 +0000
@@ -257,17 +257,34 @@
                 'Book Chapter:Verse-Chapter:Verse'))
             return None
 
-    def verse_search(self, bible, text):
+    def verse_search(self, bible, dual_bible, text):
         """
         Does a verse search for the given bible and text.
 
         ``bible``
             The bible to seach in (unicode).
 
+        ``dual_bible``
+            The dual bible (unicode). We do not search in this bible.
+
         ``text``
             The text to search for (unicode).
         """
-        log.debug(u'BibleManager.verse_search("%s", "%s")', bible,  text)
+        log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text)
+        # Check if the bible or dual_bible is a web bible.
+        webbible = self.db_cache[bible].get_object(BibleMeta,
+            u'download source')
+        dual_webbible = u''
+        if dual_bible:
+            dual_webbible = self.db_cache[dual_bible].get_object(BibleMeta,
+                u'download source')
+        if webbible or dual_webbible:
+            QtGui.QMessageBox.information(self.parent.mediaItem,
+                translate('BiblesPlugin.BibleManager',
+                'Web Bible cannot be used'),
+                translate('BiblesPlugin.BibleManager', 'Text Search is not '
+                'available with Web Bibles.'))
+            return None
         if text:
             return self.db_cache[bible].verse_search(text)
         else:
@@ -317,4 +334,3 @@
         """
         for bible in self.db_cache:
             self.db_cache[bible].finalise()
-

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2010-10-21 15:31:22 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2010-11-12 22:31:20 +0000
@@ -47,6 +47,7 @@
         self.parent().onListViewResize(event.size().width(),
             event.size().width())
 
+
 class BibleMediaItem(MediaManagerItem):
     """
     This is the custom media manager item for Bibles.
@@ -59,7 +60,7 @@
         self.IconPath = u'songs/song'
         self.ListViewWithDnD_class = BibleListView
         MediaManagerItem.__init__(self, parent, icon, title)
-        # place to store the search results for both bibles
+        # Place to store the search results for both bibles.
         self.search_results = {}
         self.dual_search_results = {}
         QtCore.QObject.connect(Receiver.get_receiver(),
@@ -83,7 +84,7 @@
             self.SearchTabWidget.sizePolicy().hasHeightForWidth())
         self.SearchTabWidget.setSizePolicy(sizePolicy)
         self.SearchTabWidget.setObjectName(u'SearchTabWidget')
-        # Add the Quick Search tab
+        # Add the Quick Search tab.
         self.QuickTab = QtGui.QWidget()
         self.QuickTab.setObjectName(u'QuickTab')
         self.QuickLayout = QtGui.QGridLayout(self.QuickTab)
@@ -99,14 +100,14 @@
             QtGui.QComboBox.AdjustToMinimumContentsLength)
         self.QuickVersionComboBox.setObjectName(u'VersionComboBox')
         self.QuickLayout.addWidget(self.QuickVersionComboBox, 0, 1, 1, 2)
-        self.QuickSecondVersionLabel = QtGui.QLabel(self.QuickTab)
-        self.QuickSecondVersionLabel.setObjectName(u'QuickSecondVersionLabel')
-        self.QuickLayout.addWidget(self.QuickSecondVersionLabel, 1, 0, 1, 1)
-        self.QuickSecondBibleComboBox = QtGui.QComboBox(self.QuickTab)
-        self.QuickSecondBibleComboBox.setSizeAdjustPolicy(
+        self.QuickDualVersionLabel = QtGui.QLabel(self.QuickTab)
+        self.QuickDualVersionLabel.setObjectName(u'QuickDualVersionLabel')
+        self.QuickLayout.addWidget(self.QuickDualVersionLabel, 1, 0, 1, 1)
+        self.QuickDualBibleComboBox = QtGui.QComboBox(self.QuickTab)
+        self.QuickDualBibleComboBox.setSizeAdjustPolicy(
             QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.QuickSecondBibleComboBox.setObjectName(u'SecondBible')
-        self.QuickLayout.addWidget(self.QuickSecondBibleComboBox, 1, 1, 1, 2)
+        self.QuickDualBibleComboBox.setObjectName(u'DualBible')
+        self.QuickLayout.addWidget(self.QuickDualBibleComboBox, 1, 1, 1, 2)
         self.QuickSearchLabel = QtGui.QLabel(self.QuickTab)
         self.QuickSearchLabel.setObjectName(u'QuickSearchLabel')
         self.QuickLayout.addWidget(self.QuickSearchLabel, 2, 0, 1, 1)
@@ -144,7 +145,7 @@
         QuickSpacerItem = QtGui.QSpacerItem(20, 35, QtGui.QSizePolicy.Minimum,
             QtGui.QSizePolicy.Expanding)
         self.QuickLayout.addItem(QuickSpacerItem, 6, 2, 1, 1)
-        # Add the Advanced Search tab
+        # Add the Advanced Search tab.
         self.AdvancedTab = QtGui.QWidget()
         self.AdvancedTab.setObjectName(u'AdvancedTab')
         self.AdvancedLayout = QtGui.QGridLayout(self.AdvancedTab)
@@ -160,16 +161,16 @@
             QtGui.QComboBox.AdjustToMinimumContentsLength)
         self.AdvancedVersionComboBox.setObjectName(u'AdvancedVersionComboBox')
         self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 1, 1, 2)
-        self.AdvancedSecondBibleLabel = QtGui.QLabel(self.AdvancedTab)
-        self.AdvancedSecondBibleLabel.setObjectName(u'AdvancedSecondBibleLabel')
-        self.AdvancedLayout.addWidget(self.AdvancedSecondBibleLabel, 1, 0, 1, 1)
-        self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab)
-        self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy(
+        self.AdvancedDualBibleLabel = QtGui.QLabel(self.AdvancedTab)
+        self.AdvancedDualBibleLabel.setObjectName(u'AdvancedDualBibleLabel')
+        self.AdvancedLayout.addWidget(self.AdvancedDualBibleLabel, 1, 0, 1, 1)
+        self.AdvancedDualBibleComboBox = QtGui.QComboBox(self.AdvancedTab)
+        self.AdvancedDualBibleComboBox.setSizeAdjustPolicy(
             QtGui.QComboBox.AdjustToMinimumContentsLength)
-        self.AdvancedSecondBibleComboBox.setObjectName(
-            u'AdvancedSecondBibleComboBox')
+        self.AdvancedDualBibleComboBox.setObjectName(
+            u'AdvancedDualBibleComboBox')
         self.AdvancedLayout.addWidget(
-            self.AdvancedSecondBibleComboBox, 1, 1, 1, 2)
+            self.AdvancedDualBibleComboBox, 1, 1, 1, 2)
         self.AdvancedBookLabel = QtGui.QLabel(self.AdvancedTab)
         self.AdvancedBookLabel.setObjectName(u'AdvancedBookLabel')
         self.AdvancedLayout.addWidget(self.AdvancedBookLabel, 2, 0, 1, 1)
@@ -226,7 +227,7 @@
         self.AdvancedLayout.addWidget(self.AdvancedMessage, 8, 0, 1, 3)
         self.SearchTabWidget.addTab(self.AdvancedTab,
             translate('BiblesPlugin.MediaItem', 'Advanced'))
-        # Add the search tab widget to the page layout
+        # Add the search tab widget to the page layout.
         self.pageLayout.addWidget(self.SearchTabWidget)
         # Combo Boxes
         QtCore.QObject.connect(self.AdvancedVersionComboBox,
@@ -272,21 +273,21 @@
         log.debug(u'configUpdated')
         if QtCore.QSettings().value(self.settingsSection + u'/dual bibles',
             QtCore.QVariant(True)).toBool():
-            self.AdvancedSecondBibleLabel.setVisible(True)
-            self.AdvancedSecondBibleComboBox.setVisible(True)
-            self.QuickSecondVersionLabel.setVisible(True)
-            self.QuickSecondBibleComboBox.setVisible(True)
+            self.AdvancedDualBibleLabel.setVisible(True)
+            self.AdvancedDualBibleComboBox.setVisible(True)
+            self.QuickDualVersionLabel.setVisible(True)
+            self.QuickDualBibleComboBox.setVisible(True)
         else:
-            self.AdvancedSecondBibleLabel.setVisible(False)
-            self.AdvancedSecondBibleComboBox.setVisible(False)
-            self.QuickSecondVersionLabel.setVisible(False)
-            self.QuickSecondBibleComboBox.setVisible(False)
+            self.AdvancedDualBibleLabel.setVisible(False)
+            self.AdvancedDualBibleComboBox.setVisible(False)
+            self.QuickDualVersionLabel.setVisible(False)
+            self.QuickDualBibleComboBox.setVisible(False)
 
     def retranslateUi(self):
         log.debug(u'retranslateUi')
         self.QuickVersionLabel.setText(
             translate('BiblesPlugin.MediaItem', 'Version:'))
-        self.QuickSecondVersionLabel.setText(
+        self.QuickDualVersionLabel.setText(
             translate('BiblesPlugin.MediaItem', 'Dual:'))
         self.QuickSearchLabel.setText(
             translate('BiblesPlugin.MediaItem', 'Search type:'))
@@ -298,7 +299,7 @@
             translate('BiblesPlugin.MediaItem', 'Results:'))
         self.AdvancedVersionLabel.setText(
             translate('BiblesPlugin.MediaItem', 'Version:'))
-        self.AdvancedSecondBibleLabel.setText(
+        self.AdvancedDualBibleLabel.setText(
             translate('BiblesPlugin.MediaItem', 'Dual:'))
         self.AdvancedBookLabel.setText(
             translate('BiblesPlugin.MediaItem', 'Book:'))
@@ -338,7 +339,7 @@
         self.QuickMessage.setText(text)
         self.AdvancedMessage.setText(text)
         Receiver.send_message(u'openlp_process_events')
-        # minor delay to get the events processed
+        # Minor delay to get the events processed.
         time.sleep(0.1)
 
     def onListViewResize(self, width, height):
@@ -363,26 +364,29 @@
         if not hasattr(self, u'import_wizard'):
             self.import_wizard = BibleImportForm(self, self.parent.manager,
                 self.parent)
-        self.import_wizard.exec_()
-        self.reloadBibles()
+        # If the import was not canceled then reload.
+        if self.import_wizard.exec_() == 1:
+            self.reloadBibles()
 
     def loadBibles(self):
         log.debug(u'Loading Bibles')
         self.QuickVersionComboBox.clear()
-        self.QuickSecondBibleComboBox.clear()
+        self.QuickDualBibleComboBox.clear()
         self.AdvancedVersionComboBox.clear()
-        self.AdvancedSecondBibleComboBox.clear()
-        self.QuickSecondBibleComboBox.addItem(u'')
-        self.AdvancedSecondBibleComboBox.addItem(u'')
+        self.AdvancedDualBibleComboBox.clear()
+        self.QuickDualBibleComboBox.addItem(u'')
+        self.AdvancedDualBibleComboBox.addItem(u'')
+        # Get all bibles and sort the list.
         bibles = self.parent.manager.get_bibles().keys()
-        # load bibles into the combo boxes
+        bibles.sort()
+        # Load the bibles into the combo boxes.
         first = True
         for bible in bibles:
             if bible:
                 self.QuickVersionComboBox.addItem(bible)
-                self.QuickSecondBibleComboBox.addItem(bible)
+                self.QuickDualBibleComboBox.addItem(bible)
                 self.AdvancedVersionComboBox.addItem(bible)
-                self.AdvancedSecondBibleComboBox.addItem(bible)
+                self.AdvancedDualBibleComboBox.addItem(bible)
                 if first:
                     first = False
                     self.initialiseBible(bible)
@@ -482,6 +486,17 @@
 
     def adjustComboBox(self, range_from, range_to, combo, restore=False):
         """
+        Adjusts the given como box to the given values.
+
+        ``range_from``
+            The first number of the range (int).
+
+        ``range_to``
+            The last number of the range (int).
+
+        ``combo``
+            The combo box itself (QComboBox).
+
         ``restore``
             If True, then the combo's currentText will be restored after
             adjusting (if possible).
@@ -490,16 +505,19 @@
         if restore:
             old_text = unicode(combo.currentText())
         combo.clear()
-        for i in range(int(range_from), int(range_to) + 1):
+        for i in range(range_from, range_to + 1):
             combo.addItem(unicode(i))
         if restore and combo.findText(old_text) != -1:
             combo.setCurrentIndex(combo.findText(old_text))
 
     def onAdvancedSearchButton(self):
+        """
+        Does an advanced search and saves the search results.
+        """
         log.debug(u'Advanced Search Button pressed')
         self.AdvancedSearchButton.setEnabled(False)
         bible = unicode(self.AdvancedVersionComboBox.currentText())
-        dual_bible = unicode(self.AdvancedSecondBibleComboBox.currentText())
+        dual_bible = unicode(self.AdvancedDualBibleComboBox.currentText())
         book = unicode(self.AdvancedBookComboBox.currentText())
         chapter_from = int(self.AdvancedFromChapter.currentText())
         chapter_to = int(self.AdvancedToChapter.currentText())
@@ -536,7 +554,7 @@
         log.debug(u'Quick Search Button pressed')
         self.QuickSearchButton.setEnabled(False)
         bible = unicode(self.QuickVersionComboBox.currentText())
-        dual_bible = unicode(self.QuickSecondBibleComboBox.currentText())
+        dual_bible = unicode(self.QuickDualBibleComboBox.currentText())
         text = unicode(self.QuickSearchEdit.text())
         if self.QuickSearchComboBox.currentIndex() == 0:
             # We are doing a 'Verse Search'.
@@ -545,9 +563,10 @@
                 self.dual_search_results = self.parent.manager.get_verses(
                     dual_bible, text)
         else:
-            # We are doing a ' Text Search'.
+            # We are doing a 'Text Search'.
             bibles = self.parent.manager.get_bibles()
-            self.search_results = self.parent.manager.verse_search(bible, text)
+            self.search_results = self.parent.manager.verse_search(bible,
+                dual_bible, text)
             if dual_bible and self.search_results:
                 text = []
                 for verse in self.search_results:
@@ -631,7 +650,7 @@
                     'dual_permissions': QtCore.QVariant(u''),
                     'dual_text': QtCore.QVariant(u'')
                 }
-                bible_text = u' %s %d:%d (%s)' % (verse.book.name,
+                bible_text = u'%s %d:%d (%s)' % (verse.book.name,
                     verse.chapter, verse.verse, version.value)
             bible_verse = QtGui.QListWidgetItem(bible_text)
             bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(vdict))
@@ -661,7 +680,7 @@
         if len(items) == 0:
             return False
         bible_text = u''
-        old_chapter = u''
+        old_chapter = -1
         raw_footer = []
         raw_slides = []
         raw_title = []
@@ -749,6 +768,12 @@
         This methode is called, when we have to change the title, because
         we are at the end of a verse range. E. g. if we want to add
         Genesis 1:1-6 as well as Daniel 2:14.
+
+        ``start_item``
+            The first item of a range.
+
+        ``old_item``
+            The last item of a range.
         """
         old_bitem = self.listView.item(old_item.row())
         old_chapter = int(self._decodeQtObject(old_bitem, 'chapter'))
@@ -785,9 +810,16 @@
     def checkTitle(self, item, old_item):
         """
         This methode checks if we are at the end of an verse range. If that is
-        the case, we return True, else False. E. g. if we added Genesis 1:1-6,
-        but the next verse is Daniel 2:14.
+        the case, we return True, otherwise False. E. g. if we added Genesis 1:1-6,
+        but the next verse is Daniel 2:14, we return True.
+
+        ``item``
+            The item we are dealing with at the moment.
+
+        ``old_item``
+            The item we were previously dealing with.
         """
+        # Get all the necessary meta data.
         bitem = self.listView.item(item.row())
         book = self._decodeQtObject(bitem, 'book')
         chapter = int(self._decodeQtObject(bitem, 'chapter'))
@@ -802,17 +834,38 @@
         old_dual_bible = self._decodeQtObject(old_bitem, 'dual_bible')
         if old_bible != bible or old_dual_bible != dual_bible or \
             old_book != book:
+            # The bible, dual bible or book has changed. 
             return True
         elif old_verse + 1 != verse and old_chapter == chapter:
+            # We are still in the same chapter, but a verse has been skipped.
             return True
         elif old_chapter + 1 == chapter and (verse != 1 or
             old_verse != self.parent.manager.get_verse_count(
             old_bible, old_book, old_chapter)):
+            # We are in the following chapter, but the last verse was not the
+            # last verse of the chapter or the current verse is not the
+            # first one of the chapter.
             return True
         else:
             return False
 
     def formatVerse(self, old_chapter, chapter, verse):
+        """
+        Formats and returns the text, each verse starts with, for the given
+        chapter and verse. The text is either surrounded by round, square,
+        curly brackets or no brackets at all. For example::
+
+            u'{su}1:1{/su}'
+
+        ``old_chapter``
+            The previous verse's chapter number (int).
+
+        ``chapter``
+            The chapter number (int).
+
+        ``verse``
+            The verse number (int).
+        """
         if not self.parent.settings_tab.show_new_chapters or \
             old_chapter != chapter:
             verse_text = u'%s:%s' % (chapter, verse)

=== modified file 'openlp/plugins/songs/forms/songmaintenanceform.py'
--- openlp/plugins/songs/forms/songmaintenanceform.py	2010-11-03 18:18:44 +0000
+++ openlp/plugins/songs/forms/songmaintenanceform.py	2010-11-12 22:31:20 +0000
@@ -405,7 +405,7 @@
     def mergeAuthors(self, old_author):
         """
         Merges two authors into one author.
-        
+
         ``old_author``
             The author which will be deleted afterwards.
         """
@@ -427,7 +427,7 @@
     def mergeTopics(self, old_topic):
         """
         Merges two topics into one topic.
-        
+
         ``old_topic``
             The topic which will be deleted afterwards.
         """
@@ -447,7 +447,7 @@
     def mergeBooks(self, old_book):
         """
         Merges two books into one book.
-        
+
         ``old_book``
             The book which will be deleted afterwards.
         """


Follow ups