From e87b4658d89c14ff965ead26a64b0bd1d64d86d8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 11 Oct 2011 20:54:18 +0100 Subject: [PATCH] fix up alert changing triggers --- openlp/core/ui/maindisplay.py | 15 +++++++++++++++ openlp/core/ui/settingsform.py | 2 +- openlp/plugins/alerts/lib/alertstab.py | 12 +++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 0cf47ae5e..f3aed92cb 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -58,6 +58,7 @@ class MainDisplay(QtGui.QGraphicsView): self.screens = ScreenList.get_instance() self.plugins = PluginManager.get_instance().plugins self.alertTab = None + self.rebuildCSS = False self.hideMode = None self.videoHide = False self.override = {} @@ -81,6 +82,20 @@ class MainDisplay(QtGui.QGraphicsView): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_phonon_creation'), self.createMediaObject) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'alertTab_updated'), self.alertTabChanged) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'config_updated'), self.configChanged) + + def alertTabChanged(self): + print "alert" + self.rebuildCSS = True + + def configChanged(self): + print "config" + if self.rebuildCSS: + print "Need to rebuild" + self.rebuildCSS = False def retranslateUi(self): """ diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 49d27a466..37da93b5b 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -58,7 +58,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): # load all the settings self.settingListWidget.clear() for tabIndex in range(0, self.stackedLayout.count() + 1): - # take at 0 and the rest shuffell up. + # take at 0 and the rest shuffle up. self.stackedLayout.takeAt(0) self.insertTab(self.generalTab, 0, PluginStatus.Active) self.insertTab(self.themesTab, 1, PluginStatus.Active) diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 15577fd0e..a6ed18fd1 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -27,7 +27,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, translate +from openlp.core.lib import SettingsTab, translate, Receiver from openlp.core.lib.ui import UiStrings, create_valign_combo class AlertsTab(SettingsTab): @@ -140,6 +140,7 @@ class AlertsTab(SettingsTab): def onTimeoutSpinBoxChanged(self): self.timeout = self.timeoutSpinBox.value() + self.changed = True def onFontSizeSpinBoxChanged(self): self.font_size = self.fontSizeSpinBox.value() @@ -171,10 +172,15 @@ class AlertsTab(SettingsTab): font.setFamily(self.font_face) self.fontComboBox.setCurrentFont(font) self.updateDisplay() + self.changed = False def save(self): settings = QtCore.QSettings() settings.beginGroup(self.settingsSection) + # Check value has changed as no event handles this field + if settings.value(u'location', QtCore.QVariant(1)).toInt()[0] != \ + self.verticalComboBox.currentIndex(): + self.changed = True settings.setValue(u'background color', QtCore.QVariant(self.bg_color)) settings.setValue(u'font color', QtCore.QVariant(self.font_color)) settings.setValue(u'font size', QtCore.QVariant(self.font_size)) @@ -184,6 +190,9 @@ class AlertsTab(SettingsTab): self.location = self.verticalComboBox.currentIndex() settings.setValue(u'location', QtCore.QVariant(self.location)) settings.endGroup() + if self.changed: + Receiver.send_message(u'alertTab_updated') + self.changed = False def updateDisplay(self): font = QtGui.QFont() @@ -193,4 +202,5 @@ class AlertsTab(SettingsTab): self.fontPreview.setFont(font) self.fontPreview.setStyleSheet(u'background-color: %s; color: %s' % (self.bg_color, self.font_color)) + self.changed = True