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):
|
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')
|
log.debug(u'get_bibles')
|
||||||
return self.db_cache.keys()
|
return self.db_cache
|
||||||
|
|
||||||
def get_books(self, bible):
|
def get_books(self, bible):
|
||||||
"""
|
"""
|
||||||
@ -238,10 +238,6 @@ class BibleManager(object):
|
|||||||
- Genesis 1:1-10,2:1-10
|
- Genesis 1:1-10,2:1-10
|
||||||
"""
|
"""
|
||||||
log.debug(u'BibleManager.get_verses("%s", "%s")', bible, versetext)
|
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)
|
reflist = parse_reference(versetext)
|
||||||
if reflist:
|
if reflist:
|
||||||
return self.db_cache[bible].get_verses(reflist)
|
return self.db_cache[bible].get_verses(reflist)
|
||||||
@ -261,26 +257,26 @@ class BibleManager(object):
|
|||||||
'Book Chapter:Verse-Chapter:Verse'))
|
'Book Chapter:Verse-Chapter:Verse'))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def verse_search(self, bible, text):
|
# def verse_search(self, bible, text):
|
||||||
"""
|
# """
|
||||||
``bible``
|
# ``bible``
|
||||||
The bible to seach in.
|
# The bible to seach in.
|
||||||
|
#
|
||||||
``text``
|
# ``text``
|
||||||
The text to search for.
|
# The text to search for.
|
||||||
"""
|
# """
|
||||||
log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text)
|
# log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text)
|
||||||
if text:
|
# if text:
|
||||||
return self.db_cache[bible].verse_search(text)
|
# return self.db_cache[bible].verse_search(text)
|
||||||
else:
|
# else:
|
||||||
QtGui.QMessageBox.information(self.parent.mediaItem,
|
# QtGui.QMessageBox.information(self.parent.mediaItem,
|
||||||
translate('BiblesPlugin.BibleManager',
|
# translate('BiblesPlugin.BibleManager',
|
||||||
'Scripture Reference Error'),
|
# 'Scripture Reference Error'),
|
||||||
translate('BiblesPlugin.BibleManager', 'You did not enter a '
|
# translate('BiblesPlugin.BibleManager', 'You did not enter a '
|
||||||
'search keyword.\nYou can seperate different keywords by a space'
|
# 'search keyword.\nYou can seperate different keywords by a space'
|
||||||
' to search for all of your keywords and can seperate them by a'
|
# ' to search for all of your keywords and can seperate them by a'
|
||||||
' comma to search for one of them.'))
|
# ' comma to search for one of them.'))
|
||||||
return None
|
# return None
|
||||||
|
|
||||||
def save_meta_data(self, bible, version, copyright, permissions):
|
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, \
|
from openlp.core.lib import MediaManagerItem, Receiver, BaseListWithDnD, \
|
||||||
ItemCapabilities, translate
|
ItemCapabilities, translate
|
||||||
from openlp.plugins.bibles.forms import ImportWizardForm
|
from openlp.plugins.bibles.forms import ImportWizardForm
|
||||||
|
from openlp.plugins.bibles.lib.db import BibleDB
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -374,7 +375,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.AdvancedSecondBibleComboBox.clear()
|
self.AdvancedSecondBibleComboBox.clear()
|
||||||
self.QuickSecondBibleComboBox.addItem(u'')
|
self.QuickSecondBibleComboBox.addItem(u'')
|
||||||
self.AdvancedSecondBibleComboBox.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
|
# load bibles into the combo boxes
|
||||||
first = True
|
first = True
|
||||||
for bible in bibles:
|
for bible in bibles:
|
||||||
@ -544,19 +545,14 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.dual_search_results = self.parent.manager.get_verses(
|
self.dual_search_results = self.parent.manager.get_verses(
|
||||||
dual_bible, text)
|
dual_bible, text)
|
||||||
else: # Text Search
|
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:
|
if dual_bible and self.search_results:
|
||||||
# text = []
|
text = []
|
||||||
# for verse in self.search_results:
|
for verse in self.search_results:
|
||||||
# text.append((verse.book.name, verse.chapter, verse.verse,
|
text.append((verse.book.name, verse.chapter, verse.verse,
|
||||||
# verse.verse))
|
verse.verse))
|
||||||
# self.dual_search_results = self.parent.manager.get_verses(
|
self.dual_search_results = bibles[dual_bible].get_verses(text)
|
||||||
# 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]
|
|
||||||
if self.ClearQuickSearchComboBox.currentIndex() == 0:
|
if self.ClearQuickSearchComboBox.currentIndex() == 0:
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
if self.listView.count() != 0 and self.search_results:
|
if self.listView.count() != 0 and self.search_results:
|
||||||
|
Loading…
Reference in New Issue
Block a user