Add Fontsize and location to alerts settings

This commit is contained in:
Tim Bentley 2010-02-09 14:56:31 +00:00
parent 643801ae05
commit 73d6a24792
2 changed files with 13 additions and 7 deletions

View File

@ -126,6 +126,8 @@ class AlertsTab(SettingsTab):
self.LocationLabel.setObjectName(u'LocationLabel') self.LocationLabel.setObjectName(u'LocationLabel')
self.LocationLayout.addWidget(self.LocationLabel) self.LocationLayout.addWidget(self.LocationLabel)
self.LocationComboBox = QtGui.QComboBox(self.LocationWidget) self.LocationComboBox = QtGui.QComboBox(self.LocationWidget)
self.LocationComboBox.addItem(QtCore.QString())
self.LocationComboBox.addItem(QtCore.QString())
self.LocationComboBox.setObjectName(u'LocationComboBox') self.LocationComboBox.setObjectName(u'LocationComboBox')
self.LocationLayout.addWidget(self.LocationComboBox) self.LocationLayout.addWidget(self.LocationComboBox)
self.LocationSpacer = QtGui.QSpacerItem(147, 20, self.LocationSpacer = QtGui.QSpacerItem(147, 20,
@ -178,6 +180,8 @@ class AlertsTab(SettingsTab):
QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked) QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
QtCore.QObject.connect(self.TimeoutSpinBox, QtCore.QObject.connect(self.TimeoutSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged) QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
QtCore.QObject.connect(self.FontSizeSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), self.onFontSizeSpinBoxChanged)
def retranslateUi(self): def retranslateUi(self):
self.FontGroupBox.setTitle(self.trUtf8('Font')) self.FontGroupBox.setTitle(self.trUtf8('Font'))
@ -190,9 +194,9 @@ class AlertsTab(SettingsTab):
self.TimeoutSpinBox.setSuffix(self.trUtf8('s')) self.TimeoutSpinBox.setSuffix(self.trUtf8('s'))
self.LocationLabel.setText(self.trUtf8('Location:')) self.LocationLabel.setText(self.trUtf8('Location:'))
self.PreviewGroupBox.setTitle(self.trUtf8('Preview')) self.PreviewGroupBox.setTitle(self.trUtf8('Preview'))
self.FontPreview.setText(self.trUtf8('openlp.org 2.0 rocks!')) self.FontPreview.setText(self.trUtf8('openlp.org'))
self.LocationComboBox.addItem(self.trUtf8('Top')) self.LocationComboBox.setItemText(0, self.trUtf8('Top'))
self.LocationComboBox.addItem(self.trUtf8('Bottom')) self.LocationComboBox.setItemText(1, self.trUtf8('Bottom'))
def onBackgroundColorButtonClicked(self): def onBackgroundColorButtonClicked(self):
self.bg_color = QtGui.QColorDialog.getColor( self.bg_color = QtGui.QColorDialog.getColor(
@ -214,6 +218,10 @@ class AlertsTab(SettingsTab):
def onTimeoutSpinBoxChanged(self): def onTimeoutSpinBoxChanged(self):
self.timeout = self.TimeoutSpinBox.value() self.timeout = self.TimeoutSpinBox.value()
def onFontSizeSpinBoxChanged(self):
self.font_size = self.FontSizeSpinBox.value()
self.updateDisplay()
def load(self): def load(self):
self.timeout = int(self.config.get_config(u'timeout', 5)) self.timeout = int(self.config.get_config(u'timeout', 5))
self.font_color = unicode( self.font_color = unicode(
@ -243,13 +251,13 @@ class AlertsTab(SettingsTab):
self.config.set_config(u'font size', unicode(self.font_size)) self.config.set_config(u'font size', unicode(self.font_size))
self.config.set_config(u'font face', unicode(self.font_face)) self.config.set_config(u'font face', unicode(self.font_face))
self.config.set_config(u'timeout', unicode(self.timeout)) self.config.set_config(u'timeout', unicode(self.timeout))
self.config.set_config(u'location', unicode(self.FontComboBox.currentIndex())) self.config.set_config(u'location', unicode(self.LocationComboBox.currentIndex()))
def updateDisplay(self): def updateDisplay(self):
font = QtGui.QFont() font = QtGui.QFont()
font.setFamily(self.FontComboBox.currentFont().family()) font.setFamily(self.FontComboBox.currentFont().family())
font.setBold(True) font.setBold(True)
font.setPointSize(16) font.setPointSize(self.font_size)
self.FontPreview.setFont(font) self.FontPreview.setFont(font)
self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' % \ self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' % \
(self.bg_color, self.font_color)) (self.bg_color, self.font_color))

View File

@ -67,5 +67,3 @@ class Ui_AuditDetailDialog(object):
self.DateRangeGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Select Date Range", None, QtGui.QApplication.UnicodeUTF8)) self.DateRangeGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Select Date Range", None, QtGui.QApplication.UnicodeUTF8))
self.ToLabel.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8)) self.ToLabel.setText(QtGui.QApplication.translate("AuditDetailDialog", "to", None, QtGui.QApplication.UnicodeUTF8))
self.FileGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Report Location", None, QtGui.QApplication.UnicodeUTF8)) self.FileGroupBox.setTitle(QtGui.QApplication.translate("AuditDetailDialog", "Report Location", None, QtGui.QApplication.UnicodeUTF8))
import openlp-2_rc