Armin Köhler has proposed merging lp:~orangeshirt/openlp/bugfixes into lp:openlp.
Requested reviews: OpenLP Core (openlp-core) Related bugs: Bug #788762 in OpenLP: ""No Book Found" opens too often" https://bugs.launchpad.net/openlp/+bug/788762 For more details, see: https://code.launchpad.net/~orangeshirt/openlp/bugfixes/+merge/63194 Fix Bug 788762 - error " No matching book" is now only shown once. If a Second Bible is choosen Text Search Results contains now only passages which are in both bibles. -- https://code.launchpad.net/~orangeshirt/openlp/bugfixes/+merge/63194 Your team OpenLP Core is requested to review the proposed merge of lp:~orangeshirt/openlp/bugfixes into lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/db.py' --- openlp/plugins/bibles/lib/db.py 2011-05-27 09:23:46 +0000 +++ openlp/plugins/bibles/lib/db.py 2011-06-02 06:03:30 +0000 @@ -381,6 +381,7 @@ """ log.debug(u'BibleDB.get_verses("%s")', reference_list) verse_list = [] + book_error = False for book_id, chapter, start_verse, end_verse in reference_list: db_book = self.get_book_by_book_ref_id(book_id) if db_book: @@ -398,12 +399,13 @@ verse_list.extend(verses) else: log.debug(u'OpenLP failed to find book with id "%s"', book_id) - if show_error: - critical_error_message_box( - translate('BiblesPlugin', 'No Book Found'), - translate('BiblesPlugin', 'No matching book ' - 'could be found in this Bible. Check that you ' - 'have spelled the name of the book correctly.')) + book_error = True + if book_error and show_error: + critical_error_message_box( + translate('BiblesPlugin', 'No Book Found'), + translate('BiblesPlugin', 'No matching book ' + 'could be found in this Bible. Check that you ' + 'have spelled the name of the book correctly.')) return verse_list def verse_search(self, text): === modified file 'openlp/plugins/bibles/lib/mediaitem.py' --- openlp/plugins/bibles/lib/mediaitem.py 2011-05-30 20:00:36 +0000 +++ openlp/plugins/bibles/lib/mediaitem.py 2011-06-02 06:03:30 +0000 @@ -675,9 +675,31 @@ second_bible, text) if second_bible and self.search_results: text = [] + new_search_results = [] + count = 0 + passage_not_found = False for verse in self.search_results: - text.append((verse.book.name, verse.chapter, verse.verse, - verse.verse)) + db_book = bibles[second_bible].get_book_by_book_ref_id( + verse.book.book_reference_id) + if not db_book: + log.debug(u'Passage "%s %d:%d" not found in Second ' + u'Bible' % (verse.book.name, verse.chapter, + verse.verse)) + passage_not_found = True + count += 1 + continue + new_search_results.append(verse) + text.append((verse.book.book_reference_id, verse.chapter, + verse.verse, verse.verse)) + if passage_not_found: + QtGui.QMessageBox.information(self, + translate('BiblePlugin.MediaItem', 'Information'), + unicode(translate('BiblePlugin.MediaItem', + 'The Second Bible not contains as much books as the ' + 'First Bible. Only search results which are found in ' + 'both Bibles are shown.\n%d results dropped.')) % count, + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) + self.search_results = new_search_results self.second_search_results = \ bibles[second_bible].get_verses(text) if not self.quickLockButton.isChecked():
_______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp