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: if reflist:
return self.db_cache[bible].get_verses(reflist, show_error) return self.db_cache[bible].get_verses(reflist, show_error)
else: else:
if show_message: if show_error:
Receiver.send_message(u'openlp_information_message', { Receiver.send_message(u'openlp_information_message', {
u'title': translate('BiblesPlugin.BibleManager', u'title': translate('BiblesPlugin.BibleManager',
'Scripture Reference Error'), 'Scripture Reference Error'),

View File

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

View File

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