Do some rewirering of alerts.

This commit is contained in:
Tomas Groth 2018-11-08 22:06:35 +01:00
parent 3fbfd7592b
commit 79fba1b4c9
3 changed files with 25 additions and 4 deletions

View File

@ -367,6 +367,20 @@ var Display = {
Display._slides['0'] = 0; Display._slides['0'] = 0;
Display.reinit(); 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. * Add a slides. If the slide exists but the HTML is different, update the slide.
* @param {string} verse - The verse number, e.g. "v1" * @param {string} verse - The verse number, e.g. "v1"

View File

@ -387,3 +387,9 @@ class DisplayWindow(QtWidgets.QWidget):
""" """
self.scale = scale self.scale = scale
self.run_javascript('Display.setScale({scale});'.format(scale=scale * 100)) 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))

View File

@ -29,6 +29,7 @@ from openlp.core.common.i18n import translate
from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.mixins import LogMixin, RegistryProperties
from openlp.core.common.registry import Registry, RegistryBase from openlp.core.common.registry import Registry, RegistryBase
from openlp.core.common.settings import Settings from openlp.core.common.settings import Settings
from openlp.core.display.screens import ScreenList
class AlertsManager(QtCore.QObject, RegistryBase, LogMixin, RegistryProperties): 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. 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')): not Settings().value('core/display on monitor')):
return return
text = self.alert_list.pop(0) text = self.alert_list.pop(0)
alert_tab = self.parent().settings_tab 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. # Check to see if we have a timer running.
if self.timer_id == 0: #if self.timer_id == 0:
self.timer_id = self.startTimer(int(alert_tab.timeout) * 1000) # self.timer_id = self.startTimer(int(alert_tab.timeout) * 1000)
def timerEvent(self, event): def timerEvent(self, event):
""" """