From 0bd821aaa584969551e0523227682861110c8f87 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 26 Jul 2011 17:44:24 +0200 Subject: [PATCH 1/3] docstrings clean ups --- openlp/plugins/remotes/lib/httpserver.py | 32 +++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 836b3d0ae..f5054fadd 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -150,9 +150,7 @@ class HttpResponse(object): class HttpServer(object): """ - Ability to control OpenLP via a webbrowser - e.g. http://localhost:4316/send/slidecontroller_live_next - http://localhost:4316/send/alerts_text?q=your%20alert%20text + Ability to control OpenLP via a webbrowser. """ def __init__(self, plugin): """ @@ -230,6 +228,7 @@ class HttpServer(object): log.debug(u'close http server') self.server.close() + class HttpConnection(object): """ A single connection, this handles communication between the server @@ -287,9 +286,12 @@ class HttpConnection(object): """ self.template_vars = { 'app_title': translate('RemotePlugin.Mobile', 'OpenLP 2.0 Remote'), - 'stage_title': translate('RemotePlugin.Mobile', 'OpenLP 2.0 Stage View'), - 'service_manager': translate('RemotePlugin.Mobile', 'Service Manager'), - 'slide_controller': translate('RemotePlugin.Mobile', 'Slide Controller'), + 'stage_title': translate('RemotePlugin.Mobile', + 'OpenLP 2.0 Stage View'), + 'service_manager': translate('RemotePlugin.Mobile', + 'Service Manager'), + 'slide_controller': translate('RemotePlugin.Mobile', + 'Slide Controller'), 'alerts': translate('RemotePlugin.Mobile', 'Alerts'), 'search': translate('RemotePlugin.Mobile', 'Search'), 'back': translate('RemotePlugin.Mobile', 'Back'), @@ -301,7 +303,8 @@ class HttpConnection(object): 'text': translate('RemotePlugin.Mobile', 'Text'), 'show_alert': translate('RemotePlugin.Mobile', 'Show Alert'), 'go_live': translate('RemotePlugin.Mobile', 'Go Live'), - 'add_to_service': translate('RemotePlugin.Mobile', 'Add To Service'), + 'add_to_service': translate('RemotePlugin.Mobile', + 'Add To Service'), 'no_results': translate('RemotePlugin.Mobile', 'No Results'), 'options': translate('RemotePlugin.Mobile', 'Options') } @@ -397,7 +400,7 @@ class HttpConnection(object): if self.parent.current_item else u'' } return HttpResponse(json.dumps({u'results': result}), - {u'Content-Type': u'application/json'}) + {u'Content-Type': u'application/json'}) def display(self, action): """ @@ -483,10 +486,11 @@ class HttpConnection(object): def pluginInfo(self, action): """ - Return plugin related information, based on the action + Return plugin related information, based on the action. - ``action`` - The action to perform - if 'search' return a list of plugin names which support search + ``action`` + The action to perform. If *search* return a list of plugin names + which support search. """ if action == u'search': searches = [] @@ -501,10 +505,10 @@ class HttpConnection(object): def search(self, type): """ - Return a list of items that match the search text + Return a list of items that match the search text. ``type`` - The plugin name to search in. + The plugin name to search in. """ text = json.loads(self.url_params[u'data'][0])[u'request'][u'text'] plugin = self.parent.plugin.pluginManager.get_plugin_by_name(type) @@ -528,7 +532,7 @@ class HttpConnection(object): def add_to_service(self, type): """ - Add item of type ``type`` to the end of the service + Add item of type ``type`` to the end of the service. """ id = json.loads(self.url_params[u'data'][0])[u'request'][u'id'] plugin = self.parent.plugin.pluginManager.get_plugin_by_name(type) From 6aec735be4c6375b9bfa6e25e79749e67e1bcc8b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 27 Jul 2011 19:05:43 +0200 Subject: [PATCH 2/3] corrections --- openlp/plugins/remotes/lib/httpserver.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index f5054fadd..c9cba12cf 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -150,11 +150,11 @@ class HttpResponse(object): class HttpServer(object): """ - Ability to control OpenLP via a webbrowser. + Ability to control OpenLP via a web browser. """ def __init__(self, plugin): """ - Initialise the httpserver, and start the server + Initialise the httpserver, and start the server. """ log.debug(u'Initialise httpserver') self.plugin = plugin @@ -168,9 +168,9 @@ class HttpServer(object): def start_tcp(self): """ - Start the http server, use the port in the settings default to 4316 + Start the http server, use the port in the settings default to 4316. Listen out for slide and song changes so they can be broadcast to - clients. Listen out for socket connections + clients. Listen out for socket connections. """ log.debug(u'Start TCP server') port = QtCore.QSettings().value( @@ -193,20 +193,20 @@ class HttpServer(object): def slide_change(self, row): """ - Slide change listener. Store the item and tell the clients + Slide change listener. Store the item and tell the clients. """ self.current_slide = row def item_change(self, items): """ - Item (song) change listener. Store the slide and tell the clients + Item (song) change listener. Store the slide and tell the clients. """ self.current_item = items[0] def new_connection(self): """ A new http connection has been made. Create a client object to handle - communication + communication. """ log.debug(u'new http connection') socket = self.server.nextPendingConnection() @@ -223,7 +223,7 @@ class HttpServer(object): def close(self): """ - Close down the http server + Close down the http server. """ log.debug(u'close http server') self.server.close() @@ -232,7 +232,7 @@ class HttpServer(object): class HttpConnection(object): """ A single connection, this handles communication between the server - and the client + and the client. """ def __init__(self, parent, socket): """ From 746001c485d9358dceff0dc4cb4042d29c2dfcbf Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 27 Jul 2011 20:12:54 +0200 Subject: [PATCH 3/3] corrections --- openlp/plugins/remotes/lib/httpserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index c9cba12cf..1545986f0 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -304,7 +304,7 @@ class HttpConnection(object): 'show_alert': translate('RemotePlugin.Mobile', 'Show Alert'), 'go_live': translate('RemotePlugin.Mobile', 'Go Live'), 'add_to_service': translate('RemotePlugin.Mobile', - 'Add To Service'), + 'Add to Service'), 'no_results': translate('RemotePlugin.Mobile', 'No Results'), 'options': translate('RemotePlugin.Mobile', 'Options') }