forked from openlp/openlp
changed methods (call the db methods instead of the manager's methods)
This commit is contained in:
parent
fa68d0d9ff
commit
f515dc60d0
@ -181,10 +181,10 @@ class BibleManager(object):
|
||||
|
||||
def get_bibles(self):
|
||||
"""
|
||||
Returns a list of the names of available Bibles.
|
||||
Returns a dict with all available Bibles.
|
||||
"""
|
||||
log.debug(u'get_bibles')
|
||||
return self.db_cache.keys()
|
||||
return self.db_cache
|
||||
|
||||
def get_books(self, bible):
|
||||
"""
|
||||
@ -238,10 +238,6 @@ class BibleManager(object):
|
||||
- Genesis 1:1-10,2:1-10
|
||||
"""
|
||||
log.debug(u'BibleManager.get_verses("%s", "%s")', bible, versetext)
|
||||
# if type(versetext) is list:
|
||||
# reflist = versetext
|
||||
# else:
|
||||
# reflist = parse_reference(versetext)
|
||||
reflist = parse_reference(versetext)
|
||||
if reflist:
|
||||
return self.db_cache[bible].get_verses(reflist)
|
||||
@ -261,26 +257,26 @@ 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 can seperate them by a'
|
||||
# ' comma to search for one of them.'))
|
||||
# return None
|
||||
|
||||
def save_meta_data(self, bible, version, copyright, permissions):
|
||||
"""
|
||||
|
@ -32,6 +32,7 @@ from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import MediaManagerItem, Receiver, BaseListWithDnD, \
|
||||
ItemCapabilities, translate
|
||||
from openlp.plugins.bibles.forms import ImportWizardForm
|
||||
from openlp.plugins.bibles.lib.db import BibleDB
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -374,7 +375,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.AdvancedSecondBibleComboBox.clear()
|
||||
self.QuickSecondBibleComboBox.addItem(u'')
|
||||
self.AdvancedSecondBibleComboBox.addItem(u'')
|
||||
bibles = self.parent.manager.get_bibles()
|
||||
bibles = self.parent.manager.get_bibles().keys()
|
||||
# load bibles into the combo boxes
|
||||
first = True
|
||||
for bible in bibles:
|
||||
@ -544,19 +545,14 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.dual_search_results = self.parent.manager.get_verses(
|
||||
dual_bible, text)
|
||||
else: # Text Search
|
||||
self.search_results = self.parent.manager.verse_search(bible, text)
|
||||
bibles = self.parent.manager.get_bibles()
|
||||
self.search_results = bibles[bible].verse_search(text)
|
||||
if dual_bible and self.search_results:
|
||||
# text = []
|
||||
# for verse in self.search_results:
|
||||
# text.append((verse.book.name, verse.chapter, verse.verse,
|
||||
# verse.verse))
|
||||
# self.dual_search_results = self.parent.manager.get_verses(
|
||||
# dual_bible, text)
|
||||
for count, verse in enumerate(self.search_results):
|
||||
text = u'%s %s:%s' % (verse.book.name, verse.chapter,
|
||||
verse.verse)
|
||||
self.dual_search_results[count] = self.parent.manager.\
|
||||
get_verses(dual_bible, text, text)[0]
|
||||
text = []
|
||||
for verse in self.search_results:
|
||||
text.append((verse.book.name, verse.chapter, verse.verse,
|
||||
verse.verse))
|
||||
self.dual_search_results = bibles[dual_bible].get_verses(text)
|
||||
if self.ClearQuickSearchComboBox.currentIndex() == 0:
|
||||
self.listView.clear()
|
||||
if self.listView.count() != 0 and self.search_results:
|
||||
|
Loading…
Reference in New Issue
Block a user