forked from openlp/openlp
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.
This commit is contained in:
parent
e87bb1114a
commit
8067f669b1
@ -381,6 +381,7 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'BibleDB.get_verses("%s")', reference_list)
|
log.debug(u'BibleDB.get_verses("%s")', reference_list)
|
||||||
verse_list = []
|
verse_list = []
|
||||||
|
book_error = False
|
||||||
for book_id, chapter, start_verse, end_verse in reference_list:
|
for book_id, chapter, start_verse, end_verse in reference_list:
|
||||||
db_book = self.get_book_by_book_ref_id(book_id)
|
db_book = self.get_book_by_book_ref_id(book_id)
|
||||||
if db_book:
|
if db_book:
|
||||||
@ -398,12 +399,13 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
verse_list.extend(verses)
|
verse_list.extend(verses)
|
||||||
else:
|
else:
|
||||||
log.debug(u'OpenLP failed to find book with id "%s"', book_id)
|
log.debug(u'OpenLP failed to find book with id "%s"', book_id)
|
||||||
if show_error:
|
book_error = True
|
||||||
critical_error_message_box(
|
if book_error and show_error:
|
||||||
translate('BiblesPlugin', 'No Book Found'),
|
critical_error_message_box(
|
||||||
translate('BiblesPlugin', 'No matching book '
|
translate('BiblesPlugin', 'No Book Found'),
|
||||||
'could be found in this Bible. Check that you '
|
translate('BiblesPlugin', 'No matching book '
|
||||||
'have spelled the name of the book correctly.'))
|
'could be found in this Bible. Check that you '
|
||||||
|
'have spelled the name of the book correctly.'))
|
||||||
return verse_list
|
return verse_list
|
||||||
|
|
||||||
def verse_search(self, text):
|
def verse_search(self, text):
|
||||||
|
@ -675,9 +675,31 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
second_bible, text)
|
second_bible, text)
|
||||||
if second_bible and self.search_results:
|
if second_bible and self.search_results:
|
||||||
text = []
|
text = []
|
||||||
|
new_search_results = []
|
||||||
|
count = 0
|
||||||
|
passage_not_found = False
|
||||||
for verse in self.search_results:
|
for verse in self.search_results:
|
||||||
text.append((verse.book.name, verse.chapter, verse.verse,
|
db_book = bibles[second_bible].get_book_by_book_ref_id(
|
||||||
verse.verse))
|
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 = \
|
self.second_search_results = \
|
||||||
bibles[second_bible].get_verses(text)
|
bibles[second_bible].get_verses(text)
|
||||||
if not self.quickLockButton.isChecked():
|
if not self.quickLockButton.isChecked():
|
||||||
|
Loading…
Reference in New Issue
Block a user