forked from openlp/openlp
tweaks
This commit is contained in:
parent
59b387b9d0
commit
2e2efab2d4
@ -369,19 +369,19 @@ class BibleDB(QtCore.QObject, Manager):
|
||||
values.
|
||||
"""
|
||||
log.debug(u'BibleDB.verse_search("%s")', text)
|
||||
verses = self.session.query(Verse)
|
||||
if text.find(u',') > -1:
|
||||
or_clause = []
|
||||
keywords = [u'%%%s%%' % keyword.strip()
|
||||
for keyword in text.split(u',')]
|
||||
for keyword in keywords:
|
||||
or_clause.append(Verse.text.like(keyword))
|
||||
verses = verses.filter(or_(*or_clause))
|
||||
verses = self.session.query(Verse).filter(or_(*or_clause))
|
||||
else:
|
||||
keywords = [u'%%%s%%' % keyword.strip()
|
||||
for keyword in text.split(u' ')]
|
||||
for keyword in keywords:
|
||||
verses = verses.filter(Verse.text.like(keyword))
|
||||
verses = self.session.query(Verse)\
|
||||
.filter(Verse.text.like(keyword))
|
||||
verses = verses.all()
|
||||
return verses
|
||||
|
||||
|
@ -257,27 +257,27 @@ class BibleManager(object):
|
||||
'Book Chapter:Verse-Chapter:Verse'))
|
||||
return None
|
||||
|
||||
# def verse_search(self, bible, text):
|
||||
# """
|
||||
# ``bible``
|
||||
# The bible to seach in.
|
||||
#
|
||||
# ``text``
|
||||
# The text to search for.
|
||||
# """
|
||||
# log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text)
|
||||
# if text:
|
||||
# return self.db_cache[bible].verse_search(text)
|
||||
# else:
|
||||
# QtGui.QMessageBox.information(self.parent.mediaItem,
|
||||
# translate('BiblesPlugin.BibleManager',
|
||||
# 'Scripture Reference Error'),
|
||||
# translate('BiblesPlugin.BibleManager', 'You did not enter a '
|
||||
# 'search keyword.\nYou can seperate different keywords by a space'
|
||||
# ' to search for all of your keywords and can seperate them by a'
|
||||
# ' comma to search for one of them.'))
|
||||
# return None
|
||||
|
||||
def verse_search(self, bible, text):
|
||||
"""
|
||||
``bible``
|
||||
The bible to seach in.
|
||||
|
||||
``text``
|
||||
The text to search for.
|
||||
"""
|
||||
log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text)
|
||||
if text:
|
||||
return self.db_cache[bible].verse_search(text)
|
||||
else:
|
||||
QtGui.QMessageBox.information(self.parent.mediaItem,
|
||||
translate('BiblesPlugin.BibleManager',
|
||||
'Scripture Reference Error'),
|
||||
translate('BiblesPlugin.BibleManager', 'You did not enter a '
|
||||
'search keyword.\nYou can seperate different keywords by a '
|
||||
'space to search for all of your keywords and you can seperate '
|
||||
'them by a comma to search for one of them.'))
|
||||
return None
|
||||
|
||||
def save_meta_data(self, bible, version, copyright, permissions):
|
||||
"""
|
||||
Saves the bibles meta data.
|
||||
|
@ -546,7 +546,8 @@ class BibleMediaItem(MediaManagerItem):
|
||||
dual_bible, text)
|
||||
else: # Text Search
|
||||
bibles = self.parent.manager.get_bibles()
|
||||
self.search_results = bibles[bible].verse_search(text)
|
||||
#self.search_results = bibles[bible].verse_search(text)
|
||||
self.search_results = self.parent.manager.verse_search(bible, text)
|
||||
if dual_bible and self.search_results:
|
||||
text = []
|
||||
for verse in self.search_results:
|
||||
|
Loading…
Reference in New Issue
Block a user