More fixes

This commit is contained in:
Jonathan Corwin 2011-05-17 19:48:04 +01:00
parent 5fcb41bc9d
commit 7a857290a6
3 changed files with 17 additions and 20 deletions

View File

@ -265,7 +265,7 @@ class BibleManager(object):
if reflist:
return self.db_cache[bible].get_verses(reflist, show_error)
else:
if show_message:
if show_error:
Receiver.send_message(u'openlp_information_message', {
u'title': translate('BiblesPlugin.BibleManager',
'Scripture Reference Error'),

View File

@ -916,13 +916,9 @@ class BibleMediaItem(MediaManagerItem):
search_results = self.parent.manager.get_verses(bible, string, False)
results = []
if search_results:
versetext = u''
for verse in search_results:
if versetext:
versetext += u' '
versetext += verse.text
results.append([string, versetext])
return results
versetext = u' '.join([verse.text for verse in search_results])
return [[string, versetext]]
return []
def createItemFromId(self, item_id):
item = QtGui.QListWidgetItem()

View File

@ -123,7 +123,7 @@ except ImportError:
from PyQt4 import QtCore, QtNetwork
from openlp.core.lib import Receiver
from openlp.core.lib import Receiver, PluginStatus
from openlp.core.ui import HideMode
from openlp.core.utils import AppLocation
@ -456,8 +456,8 @@ class HttpConnection(object):
if action == u'search':
searches = []
for plugin in self.parent.parent.pluginManager.plugins:
media_item = plugin.mediaItem
if media_item and media_item.hasSearch:
if plugin.status == PluginStatus.Active and \
plugin.mediaItem and plugin.mediaItem.hasSearch:
searches.append(plugin.name)
return HttpResponse(
json.dumps({u'results': {u'items': searches}}),
@ -472,9 +472,11 @@ class HttpConnection(object):
"""
text = json.loads(self.url_params[u'data'][0])[u'request'][u'text']
plugin = self.parent.parent.pluginManager.get_plugin_by_name(type)
media_item = plugin.mediaItem
if media_item and media_item.hasSearch:
results = media_item.search(text)
if plugin.status == PluginStatus.Active and \
plugin.mediaItem and plugin.mediaItem.hasSearch:
results =plugin.mediaItem.search(text)
else:
results = []
return HttpResponse(
json.dumps({u'results': {u'items': results}}),
{u'Content-Type': u'application/json'})
@ -485,9 +487,8 @@ class HttpConnection(object):
"""
id = json.loads(self.url_params[u'data'][0])[u'request'][u'id']
plugin = self.parent.parent.pluginManager.get_plugin_by_name(type)
media_item = plugin.mediaItem
if media_item:
media_item.goLive(id)
if plugin.status == PluginStatus.Active and plugin.mediaItem:
plugin.mediaItem.goLive(id)
def send_response(self, response):
http = u'HTTP/1.1 %s\r\n' % response.code