diff --git a/openlp/plugins/alerts/forms/alertdialog.py b/openlp/plugins/alerts/forms/alertdialog.py index eead213fa..e4fd29a39 100644 --- a/openlp/plugins/alerts/forms/alertdialog.py +++ b/openlp/plugins/alerts/forms/alertdialog.py @@ -35,6 +35,9 @@ from openlp.core.lib.ui import create_button, create_button_box class Ui_AlertDialog(object): + """ + Alert UI Class + """ def setupUi(self, alert_dialog): """ Setup the Alert UI dialog diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py index 4e3bedcd5..f5e5ee31a 100644 --- a/openlp/plugins/alerts/forms/alertform.py +++ b/openlp/plugins/alerts/forms/alertform.py @@ -29,7 +29,7 @@ from PyQt4 import QtGui, QtCore -from openlp.core.common import translate +from openlp.core.common import Registry, translate from openlp.plugins.alerts.lib.db import AlertItem from .alertdialog import Ui_AlertDialog @@ -46,8 +46,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): self.manager = plugin.manager self.plugin = plugin self.item_id = None - # TODO: Use Registry() - super(AlertForm, self).__init__(self.plugin.main_window) + super(AlertForm, self).__init__( Registry().get('main_window')) self.setupUi(self) self.display_button.clicked.connect(self.on_display_clicked) self.display_close_button.clicked.connect(self.on_display_close_clicked) diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index b1d453fb2..4b0832537 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -31,25 +31,17 @@ The :mod:`~openlp.plugins.alerts.lib.alertsmanager` module contains the part of displaying of alerts. """ -import logging - from PyQt4 import QtCore -from openlp.core.common import Registry, translate +from openlp.core.common import OpenLPMixin, RegistryMixin, Registry, translate -log = logging.getLogger(__name__) - - -class AlertsManager(QtCore.QObject): +class AlertsManager(OpenLPMixin, RegistryMixin, QtCore.QObject): """ AlertsManager manages the settings of Alerts. """ - log.info('Alert Manager loaded') - def __init__(self, parent): super(AlertsManager, self).__init__(parent) - Registry().register('alerts_manager', self) self.timer_id = 0 self.alert_list = [] Registry().register_function('live_display_active', self.generate_alert) @@ -71,7 +63,7 @@ class AlertsManager(QtCore.QObject): :param text: The text to display """ - log.debug('display alert called %s' % text) + self.log_debug('display alert called %s' % text) if text: self.alert_list.append(text) if self.timer_id != 0: @@ -85,7 +77,6 @@ class AlertsManager(QtCore.QObject): """ Format and request the Alert and start the timer. """ - log.debug('Generate Alert called') if not self.alert_list: return text = self.alert_list.pop(0) @@ -101,10 +92,9 @@ class AlertsManager(QtCore.QObject): :param event: the QT event that has been triggered. """ - log.debug('timer event') if event.timerId() == self.timer_id: - alertTab = self.parent().settings_tab - self.live_controller.display.alert('', alertTab.location) + alert_tab = self.parent().settings_tab + self.live_controller.display.alert('', alert_tab.location) self.killTimer(self.timer_id) self.timer_id = 0 self.generate_alert()