Bible search fix:

* Add feedback
* cater for partial file-based bibles
* Prevent an uncaught exception
This commit is contained in:
Jon Tibble 2010-06-16 02:48:52 +01:00
parent 5e0ab4a7f6
commit 04f2a9797b
1 changed files with 18 additions and 10 deletions

View File

@ -29,8 +29,9 @@ import chardet
import re
from sqlalchemy import or_
from PyQt4 import QtCore
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
from openlp.plugins.bibles.lib.models import *
log = logging.getLogger(__name__)
@ -312,6 +313,14 @@ class BibleDB(QtCore.QObject):
.order_by(Verse.verse)\
.all()
verse_list.extend(verses)
else:
log.debug(u'OpenLP failed to find book %s', book)
QtGui.QMessageBox.information(self.bible_plugin.media_item,
translate(u'BibleDB', u'Book not found'),
translate(u'BibleDB', u'The book you requested could not '
u'be found in this bible. Please check your spelling '
u'and that this is a complete bible not just one '
u'testament.'))
return verse_list
def verse_search(self, text):
@ -383,4 +392,3 @@ class BibleDB(QtCore.QObject):
log.debug(u'...............................Verses ')
verses = self.session.query(Verse).all()
log.debug(verses)