Fix QColorDialog usage

bzr-revno: 845
This commit is contained in:
Jon Tibble 2010-06-14 17:35:50 +01:00
commit 0ddb856a69
2 changed files with 60 additions and 44 deletions

View File

@ -239,12 +239,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.previewTheme()
def onFontMainColorPushButtonClicked(self):
self.theme.font_main_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.font_main_color), self).name()
self.FontMainColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.font_main_color))
self.previewTheme()
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.font_main_color), self)
if new_color.isValid():
self.theme.font_main_color = new_color.name()
self.FontMainColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.font_main_color))
self.previewTheme()
def onFontMainSizeSpinBoxChanged(self):
if self.theme.font_main_proportion != self.FontMainSizeSpinBox.value():
@ -332,11 +333,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.previewTheme()
def onFontFooterColorPushButtonClicked(self):
self.theme.font_footer_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.font_footer_color), self).name()
self.FontFooterColorPushButton.setStyleSheet(
'background-color: %s' % unicode(self.theme.font_footer_color))
self.previewTheme()
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.font_footer_color), self)
if new_color.isValid():
self.theme.font_footer_color = new_color.name()
self.FontFooterColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.font_footer_color))
self.previewTheme()
def onFontFooterSizeSpinBoxChanged(self):
if self.theme.font_footer_proportion != \
@ -431,24 +434,29 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onColor1PushButtonClicked(self):
if self.theme.background_type == u'solid':
self.theme.background_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_color), self).name()
self.Color1PushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.background_color))
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_color), self)
if new_color.isValid():
self.theme.background_color = new_color.name()
self.Color1PushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.background_color))
else:
self.theme.background_startColor = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_startColor), self).name()
self.Color1PushButton.setStyleSheet(
u'background-color: %s' % \
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_startColor), self)
if new_color.isValid():
self.theme.background_startColor = new_color.name()
self.Color1PushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.background_startColor))
self.previewTheme()
def onColor2PushButtonClicked(self):
self.theme.background_endColor = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_endColor), self).name()
self.Color2PushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.background_endColor))
self.previewTheme()
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_endColor), self)
if new_color.isValid():
self.theme.background_endColor = new_color.name()
self.Color2PushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.background_endColor))
self.previewTheme()
#
#Other Tab
@ -472,11 +480,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.previewTheme()
def onOutlineColorPushButtonClicked(self):
self.theme.display_outline_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.display_outline_color), self).name()
self.OutlineColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.display_outline_color))
self.previewTheme()
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.display_outline_color), self)
if new_color.isValid():
self.theme.display_outline_color = new_color.name()
self.OutlineColorPushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.display_outline_color))
self.previewTheme()
def onShadowCheckBoxChanged(self, value):
if value == 2: # checked
@ -495,11 +505,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.previewTheme()
def onShadowColorPushButtonClicked(self):
self.theme.display_shadow_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.display_shadow_color), self).name()
self.ShadowColorPushButton.setStyleSheet(
u'background-color: %s' % unicode(self.theme.display_shadow_color))
self.previewTheme()
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.display_shadow_color), self)
if new_color.isValid():
self.theme.display_shadow_color = new_color.name()
self.ShadowColorPushButton.setStyleSheet(u'background-color: %s' %
unicode(self.theme.display_shadow_color))
self.previewTheme()
def onHorizontalComboBoxSelected(self, currentIndex):
self.theme.display_horizontalAlign = currentIndex

View File

@ -214,11 +214,13 @@ class AlertsTab(SettingsTab):
translate(u'AlertsPlugin.AlertsTab', u'Bottom'))
def onBackgroundColorButtonClicked(self):
self.bg_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.bg_color), self).name()
self.BackgroundColorButton.setStyleSheet(
u'background-color: %s' % self.bg_color)
self.updateDisplay()
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.bg_color), self)
if new_color.isValid():
self.bg_color = new_color.name()
self.BackgroundColorButton.setStyleSheet(
u'background-color: %s' % self.bg_color)
self.updateDisplay()
def onFontComboBoxClicked(self):
self.updateDisplay()
@ -227,11 +229,13 @@ class AlertsTab(SettingsTab):
self.location = location
def onFontColorButtonClicked(self):
self.font_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.font_color), self).name()
self.FontColorButton.setStyleSheet(
u'background-color: %s' % self.font_color)
self.updateDisplay()
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.font_color), self)
if new_color.isValid():
self.font_color = new_color.name()
self.FontColorButton.setStyleSheet(
u'background-color: %s' % self.font_color)
self.updateDisplay()
def onTimeoutSpinBoxChanged(self):
self.timeout = self.TimeoutSpinBox.value()