~tomasgroth/openlp/portable-path

« back to all changes in this revision

Viewing changes to openlp/plugins/alerts/lib/alertsmanager.py

  • Committer: Tomas Groth
  • Date: 2019-04-30 19:02:42 UTC
  • mfrom: (2829.2.32 openlp)
  • Revision ID: tomasgroth@yahoo.dk-20190430190242-6zwjk8724tyux70m
trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2018 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2019 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
29
29
from openlp.core.common.mixins import LogMixin, RegistryProperties
30
30
from openlp.core.common.registry import Registry, RegistryBase
31
31
from openlp.core.common.settings import Settings
 
32
from openlp.core.display.screens import ScreenList
32
33
 
33
34
 
34
35
class AlertsManager(QtCore.QObject, RegistryBase, LogMixin, RegistryProperties):
38
39
    alerts_text = QtCore.pyqtSignal(list)
39
40
 
40
41
    def __init__(self, parent):
41
 
        super(AlertsManager, self).__init__(parent)
 
42
        super(AlertsManager, self).__init__()
42
43
        self.timer_id = 0
43
44
        self.alert_list = []
44
45
        Registry().register_function('live_display_active', self.generate_alert)
78
79
        """
79
80
        Format and request the Alert and start the timer.
80
81
        """
81
 
        if not self.alert_list or (self.live_controller.display.screens.display_count == 1 and
 
82
        if not self.alert_list or (len(ScreenList()) == 1 and
82
83
                                   not Settings().value('core/display on monitor')):
83
84
            return
84
85
        text = self.alert_list.pop(0)
85
86
        alert_tab = self.parent().settings_tab
86
 
        self.live_controller.display.alert(text, alert_tab.location)
87
 
        # Check to see if we have a timer running.
88
 
        if self.timer_id == 0:
89
 
            self.timer_id = self.startTimer(int(alert_tab.timeout) * 1000)
 
87
        self.live_controller.displays[0].alert(text, alert_tab.location)
90
88
 
91
89
    def timerEvent(self, event):
92
90
        """