forked from openlp/openlp
Remote custom search. Revert a few remote web changes
This commit is contained in:
parent
357d34a4d8
commit
3f21b3e2ca
@ -102,6 +102,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.remoteTriggered = None
|
||||
self.singleServiceItem = True
|
||||
self.quickPreviewAllowed = False
|
||||
self.hasSearch = False
|
||||
self.pageLayout = QtGui.QVBoxLayout(self)
|
||||
self.pageLayout.setSpacing(0)
|
||||
self.pageLayout.setMargin(0)
|
||||
@ -586,12 +587,6 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||
return item_id
|
||||
|
||||
def hasSearch(self):
|
||||
"""
|
||||
Returns whether this plugin supports the search method
|
||||
"""
|
||||
return False
|
||||
|
||||
def search(self, string):
|
||||
"""
|
||||
Performs a plugin specific search for items containing ``string``
|
||||
|
@ -61,6 +61,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
# Place to store the search results for both bibles.
|
||||
self.settings = self.parent.settings_tab
|
||||
self.quickPreviewAllowed = True
|
||||
self.hasSearch = True
|
||||
self.search_results = {}
|
||||
self.second_search_results = {}
|
||||
check_search_result(self.listView, self.search_results)
|
||||
@ -878,12 +879,6 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.settingsSection + u'/verse layout style',
|
||||
QtCore.QVariant(self.settings.layout_style))
|
||||
|
||||
def hasSearch(self):
|
||||
"""
|
||||
Returns whether this plugin supports the search method
|
||||
"""
|
||||
return True
|
||||
|
||||
def search(self, string):
|
||||
"""
|
||||
Search for some Bible verses (by reference).
|
||||
|
@ -27,6 +27,7 @@
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from sqlalchemy.sql import or_, func
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||
check_item_selected
|
||||
@ -47,6 +48,7 @@ class CustomMediaItem(MediaManagerItem):
|
||||
MediaManagerItem.__init__(self, parent, self, icon)
|
||||
self.singleServiceItem = False
|
||||
self.quickPreviewAllowed = True
|
||||
self.hasSearch = True
|
||||
# Holds information about whether the edit is remotly triggered and
|
||||
# which Custom is required.
|
||||
self.remoteCustom = -1
|
||||
@ -161,4 +163,16 @@ class CustomMediaItem(MediaManagerItem):
|
||||
else:
|
||||
raw_footer.append(u'')
|
||||
service_item.raw_footer = raw_footer
|
||||
return True
|
||||
return True
|
||||
|
||||
def search(self, string):
|
||||
search_results = self.manager.get_all_objects(CustomSlide,
|
||||
or_(func.lower(CustomSlide.title).like(u'%' +
|
||||
string.lower() + u'%'),
|
||||
func.lower(CustomSlide.text).like(u'%' +
|
||||
string.lower() + u'%')),
|
||||
order_by_ref=CustomSlide.title)
|
||||
results = []
|
||||
for custom in search_results:
|
||||
results.append([custom.id, custom.title])
|
||||
return results
|
||||
|
@ -52,20 +52,16 @@
|
||||
<a href="#" data-rel="back" data-icon="arrow-l">Back</a>
|
||||
<h1>Service Manager</h1>
|
||||
<a href="#" id="service-refresh" data-role="button" data-icon="refresh">Refresh</a>
|
||||
</div>
|
||||
</div>
|
||||
<div data-role="content">
|
||||
<div class="ui-grid-c">
|
||||
<div class="ui-block-a"><a href="#" id="service-blank" data-role="button" data-icon="blank">Blank</a></div>
|
||||
<div class="ui-block-b"><a href="#" id="service-unblank" data-role="button" data-icon="unblank">Unblank</a></div>
|
||||
<div class="ui-block-c"><a href="#" id="service-previous" data-role="button" data-icon="arrow-l">Previous</a></div>
|
||||
<div class="ui-block-d"><a href="#" id="service-next" data-role="button" data-icon="arrow-r" data-iconpos="right">Next</a></div>
|
||||
</div>
|
||||
<ul data-role="listview" data-inset="true">
|
||||
</ul>
|
||||
</div>
|
||||
<div data-role="footer" data-theme="b" class="ui-bar">
|
||||
<a href="#" id="service-previousslide" data-role="button" data-icon="arrow-l">Previous Slide</a>
|
||||
<a href="#" class="ui-btn-right" id="service-nextslide" data-role="button" data-icon="arrow-r" data-iconpos="right">Next Slide</a>
|
||||
<a href="#" id="service-blank" data-role="button" data-icon="blank">Blank</a>
|
||||
<a href="#" id="service-unblank" data-role="button" data-icon="unblank">Show</a>
|
||||
<a href="#" id="service-previous" data-role="button" data-icon="arrow-l">Prev</a>
|
||||
<a href="#" id="service-next" data-role="button" data-icon="arrow-r" data-iconpos="right">Next</a>
|
||||
</div>
|
||||
</div>
|
||||
<div data-role="page" id="slide-controller">
|
||||
@ -75,18 +71,14 @@
|
||||
<a href="#" id="controller-refresh" data-role="button" data-icon="refresh">Refresh</a>
|
||||
</div>
|
||||
<div data-role="content">
|
||||
<div class="ui-grid-c">
|
||||
<div class="ui-block-a"><a href="#" id="controller-blank" data-role="button" data-icon="blank">Blank</a></div>
|
||||
<div class="ui-block-d"><a href="#" id="controller-unblank" data-role="button" data-icon="unblank">Unblank</a></div>
|
||||
<div class="ui-block-c"><a href="#" id="controller-previous" data-role="button" data-icon="arrow-l">Previous</a></div>
|
||||
<div class="ui-block-d"><a href="#" id="controller-next" data-role="button" data-icon="arrow-r" data-iconpos="right">Next</a></div>
|
||||
</div>
|
||||
<ul data-role="listview" data-inset="true">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div data-role="footer" data-theme="b" class="ui-bar">
|
||||
<a href="#" id="controller-prevsong" data-role="button" data-icon="arrow-l">Previous Song</a>
|
||||
<a href="#" class="ui-btn-right" id="controller-nextsong" data-role="button" data-icon="arrow-r" data-iconpos="right">Next Song</a>
|
||||
<a href="#" id="controller-blank" data-role="button" data-icon="blank">Blank</a>
|
||||
<a href="#" id="controller-unblank" data-role="button" data-icon="unblank">Show</a>
|
||||
<a href="#" id="controller-previous" data-role="button" data-icon="arrow-l">Prev</a>
|
||||
<a href="#" id="controller-next" data-role="button" data-icon="arrow-r" data-iconpos="right">Next</a>
|
||||
</div>
|
||||
</div>
|
||||
<div data-role="page" id="alerts">
|
||||
@ -113,7 +105,7 @@
|
||||
<select name="search-plugin" id="search-plugin" data-native-menu="false"></select>
|
||||
</div>
|
||||
<div data-role="fieldcontain">
|
||||
<label for="search-text">For:</label>
|
||||
<label for="search-text">Text:</label>
|
||||
<input type="search" name="search-text" id="search-text" value="" />
|
||||
</div>
|
||||
<a href="#" id="search-submit" data-role="button">Search</a>
|
||||
|
@ -247,8 +247,6 @@ $("#service-next").live("click", OpenLP.nextItem);
|
||||
$("#service-previous").live("click", OpenLP.previousItem);
|
||||
$("#service-blank").live("click", OpenLP.blankDisplay);
|
||||
$("#service-unblank").live("click", OpenLP.unblankDisplay);
|
||||
$("#service-nextslide").live("click", OpenLP.nextSlide);
|
||||
$("#service-previousslide").live("click", OpenLP.previousSlide);
|
||||
// Slide Controller
|
||||
$("#slide-controller").live("pagebeforeshow", OpenLP.loadController);
|
||||
$("#controller-refresh").live("click", OpenLP.loadController);
|
||||
@ -256,8 +254,6 @@ $("#controller-next").live("click", OpenLP.nextSlide);
|
||||
$("#controller-previous").live("click", OpenLP.previousSlide);
|
||||
$("#controller-blank").live("click", OpenLP.blankDisplay);
|
||||
$("#controller-unblank").live("click", OpenLP.unblankDisplay);
|
||||
$("#controller-nextsong").live("click", OpenLP.nextItem);
|
||||
$("#controller-previoussong").live("click", OpenLP.previousItem);
|
||||
// Alerts
|
||||
$("#alert-submit").live("click", OpenLP.showAlert);
|
||||
// Search
|
||||
|
@ -457,7 +457,7 @@ class HttpConnection(object):
|
||||
searches = []
|
||||
for plugin in self.parent.parent.pluginManager.plugins:
|
||||
media_item = plugin.mediaItem
|
||||
if media_item and media_item.hasSearch():
|
||||
if media_item and media_item.hasSearch:
|
||||
searches.append(plugin.name)
|
||||
return HttpResponse(
|
||||
json.dumps({u'results': {u'items': searches}}),
|
||||
@ -473,7 +473,7 @@ 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():
|
||||
if media_item and media_item.hasSearch:
|
||||
results = media_item.search(text)
|
||||
return HttpResponse(
|
||||
json.dumps({u'results': {u'items': results}}),
|
||||
|
@ -74,6 +74,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
self.editItem = None
|
||||
self.whitespace = re.compile(r'\W+', re.UNICODE)
|
||||
self.quickPreviewAllowed = True
|
||||
self.hasSearch = True
|
||||
|
||||
def addEndHeaderBar(self):
|
||||
self.addToolbarSeparator()
|
||||
@ -480,12 +481,6 @@ class SongMediaItem(MediaManagerItem):
|
||||
return locale.strcoll(unicode(song_1.title.lower()),
|
||||
unicode(song_2.title.lower()))
|
||||
|
||||
def hasSearch(self):
|
||||
"""
|
||||
Returns whether this plugin supports the search method
|
||||
"""
|
||||
return True
|
||||
|
||||
def search(self, string):
|
||||
"""
|
||||
Search for some songs
|
||||
|
Loading…
Reference in New Issue
Block a user