diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 9e99e2303..c7ab8dd77 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -270,7 +270,6 @@ class ServiceManagerDialog(object): Registry().register_function(u'config_screen_changed', self.regenerate_service_Items) Registry().register_function(u'theme_update_global', self.theme_change) Registry().register_function(u'mediaitem_suffix_reset', self.reset_supported_suffixes) - Registry().register_function(u'servicemanager_set_item', self.on_set_item) def drag_enter_event(self, event): """ @@ -313,6 +312,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): self.layout.setSpacing(0) self.layout.setMargin(0) self.setup_ui(self) + # Need to use event as called across threads and UI is updated + print self + QtCore.QObject.connect(self, QtCore.SIGNAL(u'servicemanager_set_item'), self.on_set_item) def set_modified(self, modified=True): """ @@ -1008,6 +1010,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): """ Called by a signal to select a specific item. """ + print "hello", message self.set_item(int(message)) def set_item(self, index): diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 0c22a6353..3b2824fda 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -99,7 +99,7 @@ class SlideController(DisplayController): u'delay_spin_box' ] self.audio_list = [ - u'audio_pause_item', + u'audioPauseItem', u'audio_time_label' ] self.wide_menu = [ diff --git a/openlp/plugins/remotes/html/openlp.js b/openlp/plugins/remotes/html/openlp.js index 7c5c19e32..3cbe65366 100644 --- a/openlp/plugins/remotes/html/openlp.js +++ b/openlp/plugins/remotes/html/openlp.js @@ -147,7 +147,7 @@ window.OpenLP = { }, pollServer: function () { $.getJSON( - "/api/poll", + "/stage/api/poll", function (data, status) { var prevItem = OpenLP.currentItem; OpenLP.currentSlide = data.results.slide; @@ -359,5 +359,5 @@ $.ajaxSetup({cache: false}); $("#search").live("pageinit", function (event) { OpenLP.getSearchablePlugins(); }); -setInterval("OpenLP.pollServer();", 5000); +setInterval("OpenLP.pollServer();", 500); OpenLP.pollServer(); diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 308533b9d..a594c1bca 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -199,7 +199,7 @@ class HttpConnection(object): def __init__(self, parent): """ - Initialise the http connection. Listen out for socket signals. + Initialise the CherryPy Server """ self.parent = parent self.routes = [ @@ -229,6 +229,9 @@ class HttpConnection(object): """ url = urlparse.urlparse(cherrypy.url()) self.url_params = urlparse.parse_qs(url.query) + self.request_data = None + if isinstance(kwargs, dict): + self.request_data = kwargs.get(u'data', None) # Loop through the routes we set up earlier and execute them return self._process_http_request(args, kwargs) @@ -255,7 +258,7 @@ class HttpConnection(object): Common function to process HTTP requests where secure or insecure """ url = urlparse.urlparse(cherrypy.url()) - self.url_params = urlparse.parse_qs(url.query) + self.url_params = kwargs response = None for route, func in self.routes: match = re.match(route, url.path) @@ -478,13 +481,15 @@ class HttpConnection(object): cherrypy.response.headers['Content-Type'] = u'application/json' return json.dumps({u'results': {u'items': self._get_service_items()}}) event += u'_item' - if self.url_params and self.url_params.get(u'data'): + if self.request_data: try: - data = json.loads(self.url_params[u'data'][0]) - except KeyError, ValueError: + data = json.loads(self.request_data)[u'request'][u'id'] + except KeyError: return self._http_bad_request() - Registry().execute(event, data[u'request'][u'id']) + print "A", event , data + self.service_manager.emit(QtCore.SIGNAL(event, data)) else: + print "B", event Registry().execute(event) cherrypy.response.headers['Content-Type'] = u'application/json' return json.dumps({u'results': {u'success': True}})