diff --git a/openlp/core/display/html/display.js b/openlp/core/display/html/display.js index 43d270963..af7f08453 100644 --- a/openlp/core/display/html/display.js +++ b/openlp/core/display/html/display.js @@ -367,6 +367,20 @@ var Display = { Display._slides['0'] = 0; Display.reinit(); }, + /** + * Display an alert + * @param {string} text - The alert text + * @param {int} location - The location of the text (top, middle or bottom) + */ + alert: function (text, location) { + console.debug(" alert text: " + text, ", location: " + location); + /* + * The implementation should show an alert. + * It should be able to handle receiving a new alert before a previous one is "finished", basically queueing it. + */ + return; +}, + /** * Add a slides. If the slide exists but the HTML is different, update the slide. * @param {string} verse - The verse number, e.g. "v1" diff --git a/openlp/core/display/window.py b/openlp/core/display/window.py index a34a378c5..72649ac39 100644 --- a/openlp/core/display/window.py +++ b/openlp/core/display/window.py @@ -387,3 +387,9 @@ class DisplayWindow(QtWidgets.QWidget): """ self.scale = scale self.run_javascript('Display.setScale({scale});'.format(scale=scale * 100)) + + def alert(self, text, location): + """ + Set an alert + """ + self.run_javascript('Display.alert({text}, {location});'.format(text=text, location=location)) diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index 4d843c5c7..0fca8bdd6 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -29,6 +29,7 @@ from openlp.core.common.i18n import translate from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.registry import Registry, RegistryBase from openlp.core.common.settings import Settings +from openlp.core.display.screens import ScreenList class AlertsManager(QtCore.QObject, RegistryBase, LogMixin, RegistryProperties): @@ -78,15 +79,15 @@ class AlertsManager(QtCore.QObject, RegistryBase, LogMixin, RegistryProperties): """ Format and request the Alert and start the timer. """ - if not self.alert_list or (self.live_controller.display.screens.display_count == 1 and + if not self.alert_list or (len(ScreenList()) == 1 and not Settings().value('core/display on monitor')): return text = self.alert_list.pop(0) alert_tab = self.parent().settings_tab - self.live_controller.display.alert(text, alert_tab.location) + self.live_controller.displays[0].alert(text, alert_tab.location) # Check to see if we have a timer running. - if self.timer_id == 0: - self.timer_id = self.startTimer(int(alert_tab.timeout) * 1000) + #if self.timer_id == 0: + # self.timer_id = self.startTimer(int(alert_tab.timeout) * 1000) def timerEvent(self, event): """