fix up alert changing triggers

This commit is contained in:
Tim Bentley 2011-10-11 20:54:18 +01:00
parent 9176911810
commit e87b4658d8
3 changed files with 27 additions and 2 deletions

View File

@ -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):
"""

View File

@ -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)

View File

@ -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