Fix remote search to not use display errors on the main UI

This commit is contained in:
Tim Bentley 2012-03-17 10:23:52 +00:00
parent f3b487cc15
commit 283d85fbd9
4 changed files with 30 additions and 6 deletions

View File

@ -3,8 +3,8 @@
* ------------------------------------------------------------------------- * * ------------------------------------------------------------------------- *
* Copyright (c) 2008-2010 Raoul Snyman * * Copyright (c) 2008-2010 Raoul Snyman *
* Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael * * Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael *
* Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, * * Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin K<EFBFBD>hler, *
* Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, * * Andreas Preikschat, Mattias P<EFBFBD>ldaru, Christian Richter, Philip Ridout, *
* Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode * * Jeffrey Smith, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode *
* Woldsund * * Woldsund *
* ------------------------------------------------------------------------- * * ------------------------------------------------------------------------- *
@ -46,7 +46,7 @@ body {
} }
#clock { #clock {
font-size: 40pt; font-size: 30pt;
color: yellow; color: yellow;
text-align: right; text-align: right;
} }

View File

@ -427,7 +427,9 @@ class HttpConnection(object):
Send an alert. Send an alert.
""" """
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']
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}}), return HttpResponse(json.dumps({u'results': {u'success': True}}),
{u'Content-Type': u'application/json'}) {u'Content-Type': u'application/json'})

View File

@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui, QtNetwork 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' ZERO_URL = u'0.0.0.0'
@ -160,12 +160,20 @@ class RemoteTab(SettingsTab):
self.setUrls() self.setUrls()
def save(self): 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.QSettings().setValue(self.settingsSection + u'/port',
QtCore.QVariant(self.portSpinBox.value())) QtCore.QVariant(self.portSpinBox.value()))
QtCore.QSettings().setValue(self.settingsSection + u'/ip address', QtCore.QSettings().setValue(self.settingsSection + u'/ip address',
QtCore.QVariant(self.addressEdit.text())) QtCore.QVariant(self.addressEdit.text()))
QtCore.QSettings().setValue(self.settingsSection + u'/twelve hour', QtCore.QSettings().setValue(self.settingsSection + u'/twelve hour',
QtCore.QVariant(self.twelveHour)) QtCore.QVariant(self.twelveHour))
if changed:
Receiver.send_message(u'remote_config_updated')
def onTwelveHourCheckBoxChanged(self, check_state): def onTwelveHourCheckBoxChanged(self, check_state):
self.twelveHour = False self.twelveHour = False

View File

@ -27,7 +27,10 @@
import logging 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 from openlp.plugins.remotes.lib import RemoteTab, HttpServer
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -45,6 +48,9 @@ class RemotesPlugin(Plugin):
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
self.weight = -1 self.weight = -1
self.server = None self.server = None
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'remote_config_updated'),
self.config_updated)
def initialise(self): def initialise(self):
""" """
@ -86,3 +92,11 @@ class RemotesPlugin(Plugin):
self.textStrings[StringContent.VisibleName] = { self.textStrings[StringContent.VisibleName] = {
u'title': translate('RemotePlugin', 'Remote', 'container title') 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()