From 283d85fbd9a9c18855599bd1303f83e964ef38dd Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 17 Mar 2012 10:23:52 +0000 Subject: [PATCH 1/7] Fix remote search to not use display errors on the main UI --- openlp/plugins/remotes/html/stage.css | 6 +++--- openlp/plugins/remotes/lib/httpserver.py | 4 +++- openlp/plugins/remotes/lib/remotetab.py | 10 +++++++++- openlp/plugins/remotes/remoteplugin.py | 16 +++++++++++++++- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/openlp/plugins/remotes/html/stage.css b/openlp/plugins/remotes/html/stage.css index f5a8453f4..9ae413ec1 100644 --- a/openlp/plugins/remotes/html/stage.css +++ b/openlp/plugins/remotes/html/stage.css @@ -3,8 +3,8 @@ * ------------------------------------------------------------------------- * * Copyright (c) 2008-2010 Raoul Snyman * * Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael * - * Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, * - * Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, * + * Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin K�hler, * + * Andreas Preikschat, Mattias P�ldaru, Christian Richter, Philip Ridout, * * Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode * * Woldsund * * ------------------------------------------------------------------------- * @@ -46,7 +46,7 @@ body { } #clock { - font-size: 40pt; + font-size: 30pt; color: yellow; text-align: right; } diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 8daa1c7b0..b9df5ebd3 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -427,7 +427,9 @@ class HttpConnection(object): Send an alert. """ text = json.loads(self.url_params[u'data'][0])[u'request'][u'text'] - Receiver.send_message(u'alerts_text', [text]) + plugin = self.parent.plugin.pluginManager.get_plugin_by_name("alerts") + if plugin.status == PluginStatus.Active: + Receiver.send_message(u'alerts_text', [text]) return HttpResponse(json.dumps({u'results': {u'success': True}}), {u'Content-Type': u'application/json'}) diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 70005226c..042e206fc 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -27,7 +27,7 @@ from PyQt4 import QtCore, QtGui, QtNetwork -from openlp.core.lib import SettingsTab, translate +from openlp.core.lib import SettingsTab, translate, Receiver ZERO_URL = u'0.0.0.0' @@ -160,12 +160,20 @@ class RemoteTab(SettingsTab): self.setUrls() def save(self): + changed = False + if QtCore.QSettings().value(self.settingsSection + u'/ip address', + QtCore.QVariant(ZERO_URL).toString() != self.addressEdit.text() or + QtCore.QSettings().value(self.settingsSection + u'/port', + QtCore.QVariant(4316).toInt()[0]) != self.portSpinBox.value()): + changed = True QtCore.QSettings().setValue(self.settingsSection + u'/port', QtCore.QVariant(self.portSpinBox.value())) QtCore.QSettings().setValue(self.settingsSection + u'/ip address', QtCore.QVariant(self.addressEdit.text())) QtCore.QSettings().setValue(self.settingsSection + u'/twelve hour', QtCore.QVariant(self.twelveHour)) + if changed: + Receiver.send_message(u'remote_config_updated') def onTwelveHourCheckBoxChanged(self, check_state): self.twelveHour = False diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index d51c3b147..dc180a827 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -27,7 +27,10 @@ import logging -from openlp.core.lib import Plugin, StringContent, translate, build_icon +from PyQt4 import QtCore + +from openlp.core.lib import Plugin, StringContent, translate, build_icon,\ + Receiver from openlp.plugins.remotes.lib import RemoteTab, HttpServer log = logging.getLogger(__name__) @@ -45,6 +48,9 @@ class RemotesPlugin(Plugin): self.icon = build_icon(self.icon_path) self.weight = -1 self.server = None + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'remote_config_updated'), + self.config_updated) def initialise(self): """ @@ -86,3 +92,11 @@ class RemotesPlugin(Plugin): self.textStrings[StringContent.VisibleName] = { u'title': translate('RemotePlugin', 'Remote', 'container title') } + + def config_updated(self): + """ + Called when Config is changed to restart the server on new address or + port + """ + self.finalise() + self.initialise() From d00840d1e0b783221c315e40c56d2ab74b5744b8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 17 Mar 2012 10:40:06 +0000 Subject: [PATCH 2/7] Make plugin config updates generic Fix up some copyright issues missed --- openlp/core/lib/eventreceiver.py | 7 ++++--- openlp/core/lib/plugin.py | 9 +++++++++ openlp/plugins/remotes/html/index.html | 12 ++++++------ openlp/plugins/remotes/html/openlp.css | 12 ++++++------ openlp/plugins/remotes/html/openlp.js | 12 ++++++------ openlp/plugins/remotes/html/stage.css | 12 ++++++------ openlp/plugins/remotes/html/stage.html | 12 ++++++------ openlp/plugins/remotes/html/stage.js | 12 ++++++------ openlp/plugins/remotes/remoteplugin.py | 11 +++-------- 9 files changed, 52 insertions(+), 47 deletions(-) diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 35459e9dd..0b6451ea2 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -213,9 +213,10 @@ class EventReceiver(QtCore.QObject): ``{plugin}_add_service_item`` Ask the plugin to push the selected items to the service item. - ``{plugin}_service_load`` - Ask the plugin to process an individual service item after it has been - loaded. + + ``{plugin}_config_updated`` + The Plugn's config has changed so lets do some processing. + ``alerts_text`` Displays an alert message. diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index f3bfb68c6..b56cf0328 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -173,6 +173,9 @@ class Plugin(QtCore.QObject): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_add_service_item' % self.name), self.processAddServiceEvent) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'%s_config_updated' % self.name), + self.configUpdated) def checkPreConditions(self): """ @@ -395,3 +398,9 @@ class Plugin(QtCore.QObject): Add html code to htmlbuilder. """ return u'' + + def configUpdatedl(self): + """ + The plugin's config has changed + """ + pass diff --git a/openlp/plugins/remotes/html/index.html b/openlp/plugins/remotes/html/index.html index 7a2da3bea..fd1b37472 100644 --- a/openlp/plugins/remotes/html/index.html +++ b/openlp/plugins/remotes/html/index.html @@ -4,12 +4,12 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, # -# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, # -# Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode # -# Woldsund # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # --------------------------------------------------------------------------- # # This program is free software; you can redistribute it and/or modify it # # under the terms of the GNU General Public License as published by the Free # diff --git a/openlp/plugins/remotes/html/openlp.css b/openlp/plugins/remotes/html/openlp.css index af52d69c3..126c0e0b4 100644 --- a/openlp/plugins/remotes/html/openlp.css +++ b/openlp/plugins/remotes/html/openlp.css @@ -1,12 +1,12 @@ /***************************************************************************** * OpenLP - Open Source Lyrics Projection * * ------------------------------------------------------------------------- * - * Copyright (c) 2008-2010 Raoul Snyman * - * Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael * - * Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, * - * Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, * - * Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode * - * Woldsund * + * Copyright (c) 2008-2012 Raoul Snyman * + * Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan * + * Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, * + * Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias * + * Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, * + * Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund * * ------------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * diff --git a/openlp/plugins/remotes/html/openlp.js b/openlp/plugins/remotes/html/openlp.js index 56c0c5859..0c15d9c07 100644 --- a/openlp/plugins/remotes/html/openlp.js +++ b/openlp/plugins/remotes/html/openlp.js @@ -1,12 +1,12 @@ /***************************************************************************** * OpenLP - Open Source Lyrics Projection * * ------------------------------------------------------------------------- * - * Copyright (c) 2008-2010 Raoul Snyman * - * Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael * - * Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, * - * Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, * - * Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode * - * Woldsund * + * Copyright (c) 2008-2012 Raoul Snyman * + * Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan * + * Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, * + * Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias * + * Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, * + * Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund * * ------------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * diff --git a/openlp/plugins/remotes/html/stage.css b/openlp/plugins/remotes/html/stage.css index 9ae413ec1..cce015092 100644 --- a/openlp/plugins/remotes/html/stage.css +++ b/openlp/plugins/remotes/html/stage.css @@ -1,12 +1,12 @@ /***************************************************************************** * OpenLP - Open Source Lyrics Projection * * ------------------------------------------------------------------------- * - * Copyright (c) 2008-2010 Raoul Snyman * - * Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael * - * Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin K�hler, * - * Andreas Preikschat, Mattias P�ldaru, Christian Richter, Philip Ridout, * - * Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode * - * Woldsund * + * Copyright (c) 2008-2012 Raoul Snyman * + * Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan * + * Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, * + * Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias * + * Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, * + * Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund * * ------------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * diff --git a/openlp/plugins/remotes/html/stage.html b/openlp/plugins/remotes/html/stage.html index c5d0872d0..067a8e485 100644 --- a/openlp/plugins/remotes/html/stage.html +++ b/openlp/plugins/remotes/html/stage.html @@ -4,12 +4,12 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, # -# Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, # -# Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode # -# Woldsund # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # # --------------------------------------------------------------------------- # # This program is free software; you can redistribute it and/or modify it # # under the terms of the GNU General Public License as published by the Free # diff --git a/openlp/plugins/remotes/html/stage.js b/openlp/plugins/remotes/html/stage.js index 925a850a4..4dbde34c1 100644 --- a/openlp/plugins/remotes/html/stage.js +++ b/openlp/plugins/remotes/html/stage.js @@ -1,12 +1,12 @@ /***************************************************************************** * OpenLP - Open Source Lyrics Projection * * ------------------------------------------------------------------------- * - * Copyright (c) 2008-2010 Raoul Snyman * - * Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael * - * Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, * - * Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, * - * Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode * - * Woldsund * + * Copyright (c) 2008-2012 Raoul Snyman * + * Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan * + * Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, * + * Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias * + * Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, * + * Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund * * ------------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index dc180a827..fe4c2091b 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -27,10 +27,7 @@ import logging -from PyQt4 import QtCore - -from openlp.core.lib import Plugin, StringContent, translate, build_icon,\ - Receiver +from openlp.core.lib import Plugin, StringContent, translate, build_icon from openlp.plugins.remotes.lib import RemoteTab, HttpServer log = logging.getLogger(__name__) @@ -48,9 +45,7 @@ class RemotesPlugin(Plugin): self.icon = build_icon(self.icon_path) self.weight = -1 self.server = None - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'remote_config_updated'), - self.config_updated) + def initialise(self): """ @@ -93,7 +88,7 @@ class RemotesPlugin(Plugin): u'title': translate('RemotePlugin', 'Remote', 'container title') } - def config_updated(self): + def configUpdated(self): """ Called when Config is changed to restart the server on new address or port From 9cdec0e3d31a0e2c8e5aba79adc75e2143aa9599 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 17 Mar 2012 10:46:08 +0000 Subject: [PATCH 3/7] Minor fixes --- openlp/core/lib/eventreceiver.py | 6 ++++-- openlp/core/lib/plugin.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 0b6451ea2..4252d5adf 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -213,10 +213,12 @@ class EventReceiver(QtCore.QObject): ``{plugin}_add_service_item`` Ask the plugin to push the selected items to the service item. + ``{plugin}_service_load`` + Ask the plugin to process an individual service item after it has been + loaded. ``{plugin}_config_updated`` - The Plugn's config has changed so lets do some processing. - + The config has changed so tell the plugin about it. ``alerts_text`` Displays an alert message. diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index b56cf0328..f704bd9cd 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -399,7 +399,7 @@ class Plugin(QtCore.QObject): """ return u'' - def configUpdatedl(self): + def configUpdated(self): """ The plugin's config has changed """ From 83629a1b227a2632bdd03831caab38b6fe66ad3b Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 17 Mar 2012 10:51:04 +0000 Subject: [PATCH 4/7] Get it working this time --- openlp/core/lib/plugin.py | 1 + openlp/plugins/remotes/lib/remotetab.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index f704bd9cd..774dca579 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -176,6 +176,7 @@ class Plugin(QtCore.QObject): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_config_updated' % self.name), self.configUpdated) + print u'%s_config_updated' % self.name def checkPreConditions(self): """ diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 042e206fc..e4f258cd3 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -173,7 +173,7 @@ class RemoteTab(SettingsTab): QtCore.QSettings().setValue(self.settingsSection + u'/twelve hour', QtCore.QVariant(self.twelveHour)) if changed: - Receiver.send_message(u'remote_config_updated') + Receiver.send_message(u'remotes_config_updated') def onTwelveHourCheckBoxChanged(self, check_state): self.twelveHour = False From bc4cc7adb9e8ee9aad423906378f36febc7319e4 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 17 Mar 2012 10:54:33 +0000 Subject: [PATCH 5/7] Remove print --- openlp/core/lib/plugin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 774dca579..f704bd9cd 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -176,7 +176,6 @@ class Plugin(QtCore.QObject): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_config_updated' % self.name), self.configUpdated) - print u'%s_config_updated' % self.name def checkPreConditions(self): """ From a22907d6396e2e28750a71f8e2dcb2fa7512945e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 18 Mar 2012 08:06:13 +0000 Subject: [PATCH 6/7] Remove blank line --- openlp/plugins/remotes/html/index.html | 1 + openlp/plugins/remotes/remoteplugin.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/remotes/html/index.html b/openlp/plugins/remotes/html/index.html index fd1b37472..3c06389b4 100644 --- a/openlp/plugins/remotes/html/index.html +++ b/openlp/plugins/remotes/html/index.html @@ -25,6 +25,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### --> + diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index fe4c2091b..0b1200481 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -46,7 +46,6 @@ class RemotesPlugin(Plugin): self.weight = -1 self.server = None - def initialise(self): """ Initialise the remotes plugin, and start the http server From f5a5c641b1208741b8cdb35fe73a4900a35f6a00 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 18 Mar 2012 08:14:51 +0000 Subject: [PATCH 7/7] Remove extra blank line --- openlp/plugins/remotes/html/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/plugins/remotes/html/index.html b/openlp/plugins/remotes/html/index.html index 3c06389b4..fd1b37472 100644 --- a/openlp/plugins/remotes/html/index.html +++ b/openlp/plugins/remotes/html/index.html @@ -25,7 +25,6 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### --> -