Complete Alerts tab state saving , and reloading.

bzr-revno: 365
This commit is contained in:
Tim Bentley 2009-03-04 19:55:37 +00:00
parent 2ce0aafcc9
commit c451048355

View File

@ -107,7 +107,7 @@ class AlertsTab(SettingsTab):
self.LengthLayout.addWidget(self.LengthLabel) self.LengthLayout.addWidget(self.LengthLabel)
self.LengthSpinBox = QtGui.QSpinBox(self.LengthWidget) self.LengthSpinBox = QtGui.QSpinBox(self.LengthWidget)
self.LengthSpinBox.setMaximum(180) self.LengthSpinBox.setMaximum(180)
self.LengthSpinBox.setProperty(u'value', QtCore.QVariant(5)) #self.LengthSpinBox.setProperty(u'value', QtCore.QVariant(5))
self.LengthSpinBox.setObjectName(u'LengthSpinBox') self.LengthSpinBox.setObjectName(u'LengthSpinBox')
self.LengthLayout.addWidget(self.LengthSpinBox) self.LengthLayout.addWidget(self.LengthSpinBox)
self.LengthSpacer = QtGui.QSpacerItem(147, 20, self.LengthSpacer = QtGui.QSpacerItem(147, 20,
@ -155,6 +155,8 @@ class AlertsTab(SettingsTab):
QtCore.SIGNAL("pressed()"), self.onFontColourButtonclicked) QtCore.SIGNAL("pressed()"), self.onFontColourButtonclicked)
QtCore.QObject.connect(self.FontComboBox,\ QtCore.QObject.connect(self.FontComboBox,\
QtCore.SIGNAL("activated(int)"), self.onFontComboBoxclicked) QtCore.SIGNAL("activated(int)"), self.onFontComboBoxclicked)
QtCore.QObject.connect(self.LengthSpinBox,\
QtCore.SIGNAL("valueChanged(int)"), self.onLengthSpinBoxclicked)
def retranslateUi(self): def retranslateUi(self):
self.FontGroupBox.setTitle(translate(u'AlertsTab', u'Font')) self.FontGroupBox.setTitle(translate(u'AlertsTab', u'Font'))
@ -178,7 +180,12 @@ class AlertsTab(SettingsTab):
self.FontColourButton.setStyleSheet('background-color: %s' % self.font_color) self.FontColourButton.setStyleSheet('background-color: %s' % self.font_color)
self._update_display() self._update_display()
def onLengthSpinBoxclicked(self):
self.spin_length = self.LengthSpinBox.value()
def load(self): def load(self):
self.spin_length = self.config.get_config("spin length",u"5" )
self.LengthSpinBox.setValue(int(self.spin_length))
self.font_color = self.config.get_config("font color",u"#ffffff" ) self.font_color = self.config.get_config("font color",u"#ffffff" )
self.FontColourButton.setStyleSheet('background-color: %s' % self.font_color) self.FontColourButton.setStyleSheet('background-color: %s' % self.font_color)
self.bg_color = self.config.get_config("background color",u"#00007f" ) self.bg_color = self.config.get_config("background color",u"#00007f" )
@ -196,6 +203,8 @@ class AlertsTab(SettingsTab):
self.config.set_config("font color", str(self.font_color)) self.config.set_config("font color", str(self.font_color))
font = self.FontComboBox.currentFont().toString() font = self.FontComboBox.currentFont().toString()
self.config.set_config("text font", str(font)) self.config.set_config("text font", str(font))
self.config.set_config("spin length", str(self.spin_length))
def _update_display(self): def _update_display(self):
font =self.FontComboBox.currentFont() font =self.FontComboBox.currentFont()