Fix QColorDialog usage

This commit is contained in:
Jon Tibble 2010-06-14 14:23:19 +01:00
parent 0558900951
commit a4f0df76cc
2 changed files with 60 additions and 44 deletions

View File

@ -239,9 +239,10 @@ 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()
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()
@ -332,10 +333,12 @@ 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()
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_color), self)
if new_color.isValid():
self.theme.font_footer_color = new_color.name()
self.FontFooterColorPushButton.setStyleSheet(
'background-color: %s' % unicode(self.theme.font_footer_color))
u'background-color: %s' % unicode(self.theme.font_footer_color))
self.previewTheme()
def onFontFooterSizeSpinBoxChanged(self):
@ -431,23 +434,28 @@ 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_color), 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))
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_color), 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()
#
@ -472,10 +480,12 @@ 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))
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_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):
@ -495,10 +505,12 @@ 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))
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_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):

View File

@ -214,8 +214,10 @@ 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()
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_color), self)
if new_color.isValid():
self.bg_color = new_color.name()
self.BackgroundColorButton.setStyleSheet(
u'background-color: %s' % self.bg_color)
self.updateDisplay()
@ -227,8 +229,10 @@ class AlertsTab(SettingsTab):
self.location = location
def onFontColorButtonClicked(self):
self.font_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.font_color), self).name()
new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.theme.background_color), self)
if new_color.isValid():
self.font_color = new_color.name()
self.FontColorButton.setStyleSheet(
u'background-color: %s' % self.font_color)
self.updateDisplay()