Tue, 09 Oct 2012 19:28:59 +0200
Removed obsolete functionality from Color Dialog Wizard and corrected an issue.
--- a/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py Tue Oct 09 19:23:24 2012 +0200 +++ b/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py Tue Oct 09 19:28:59 2012 +0200 @@ -9,8 +9,8 @@ import os -from PyQt4.QtCore import qVersion, pyqtSlot -from PyQt4.QtGui import QColor, QColorDialog, QDialog, qRgba, QDialogButtonBox +from PyQt4.QtCore import pyqtSlot +from PyQt4.QtGui import QColor, QColorDialog, QDialog, QDialogButtonBox from E5Gui import E5MessageBox @@ -35,11 +35,6 @@ self.bTest = \ self.buttonBox.addButton(self.trUtf8("Test"), QDialogButtonBox.ActionRole) - - if qVersion() < "4.5.0": - self.rQt40.setChecked(True) - else: - self.rQt45.setChecked(True) def on_buttonBox_clicked(self, button): """ @@ -65,11 +60,9 @@ else: coStr = "QColor({0})".format(coStr) try: - if self.rQt45.isChecked(): - exec('QColorDialog.getColor({0}, None, "{1}")'.format( - coStr, self.eTitle.text())) - else: - exec('QColorDialog.getColor({0})'.format(coStr)) + exec('from PyQt4.QtCore import Qt;' + ' QColorDialog.getColor({0}, None, "{1}")'.format( + coStr, self.eTitle.text())) except: E5MessageBox.critical(self, self.trUtf8("QColorDialog Wizard Error"), @@ -77,16 +70,11 @@ .format(coStr)) elif self.rRGBA.isChecked(): - if self.rQt45.isChecked(): - QColorDialog.getColor( - QColor(self.sRed.value(), self.sGreen.value(), - self.sBlue.value(), self.sAlpha.value()), - None, self.eTitle.text(), - QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)) - else: - rgba = qRgba(self.sRed.value(), self.sGreen.value(), - self.sBlue.value(), self.sAlpha.value()) - QColorDialog.getRgba(rgba) + QColorDialog.getColor( + QColor(self.sRed.value(), self.sGreen.value(), + self.sBlue.value(), self.sAlpha.value()), + None, self.eTitle.text(), + QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)) def on_eRGB_textChanged(self, text): """ @@ -118,14 +106,6 @@ else: self.bTest.setEnabled(False) - def on_rQt45_toggled(self, on): - """ - Private slot to handle the toggled signal of the rQt45 radio button. - - @param on toggle state (boolean) (ignored) - """ - self.titleGroup.setEnabled(on) - def getCode(self, indLevel, indString): """ Public method to get the source code. @@ -149,38 +129,27 @@ code += 'QColor("{0}")'.format(col) else: code += 'QColor({0})'.format(col) - if self.rQt45.isChecked(): - code += ', None,{0}'.format(os.linesep) - code += '{0}self.trUtf8("{1}"),{2}'.format( - istring, self.eTitle.text(), os.linesep) - code += \ - '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ - .format(istring) + code += ', None,{0}'.format(os.linesep) + code += '{0}self.trUtf8("{1}"),{2}'.format( + istring, self.eTitle.text(), os.linesep) + code += \ + '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ + .format(istring) code += '){0}'.format(estring) elif self.rRGBA.isChecked(): - if self.rQt45.isChecked(): - code += 'getColor(' - if not self.eRGB.text(): - code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format( - self.sRed.value(), self.sGreen.value(), self.sBlue.value(), - self.sAlpha.value(), os.linesep) - else: - code += '{0},{1}'.format(self.eRGB.text(), os.linesep) - code += '{0}None,{1}'.format(istring, os.linesep) - code += '{0}self.trUtf8("{1}"),{2}'.format( - istring, self.eTitle.text(), os.linesep) - code += \ - '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ - .format(istring) - code += '){0}'.format(estring) + code += 'getColor(' + if not self.eRGB.text(): + code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format( + self.sRed.value(), self.sGreen.value(), self.sBlue.value(), + self.sAlpha.value(), os.linesep) else: - code += 'getRgba(' - if not self.eRGB.text(): - code += 'qRgba({0:d}, {1:d}, {2:d}, {3:d})'.format( - self.sRed.value(), self.sGreen.value(), self.sBlue.value(), - self.sAlpha.value()) - else: - code += self.eRGB.text() - code += '){0}'.format(estring) + code += '{0},{1}'.format(self.eRGB.text(), os.linesep) + code += '{0}None,{1}'.format(istring, os.linesep) + code += '{0}self.trUtf8("{1}"),{2}'.format( + istring, self.eTitle.text(), os.linesep) + code += \ + '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ + .format(istring) + code += '){0}'.format(estring) return code
--- a/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.ui Tue Oct 09 19:23:24 2012 +0200 +++ b/Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.ui Tue Oct 09 19:28:59 2012 +0200 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>367</width> - <height>469</height> + <width>381</width> + <height>338</height> </rect> </property> <property name="windowTitle"> @@ -18,57 +18,6 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QGroupBox" name="qtGroup"> - <property name="title"> - <string>Qt Version</string> - </property> - <layout class="QHBoxLayout" name="_2"> - <item> - <widget class="QRadioButton" name="rQt40"> - <property name="focusPolicy"> - <enum>Qt::TabFocus</enum> - </property> - <property name="toolTip"> - <string>Select to generate code for Qt 4.0.0 but less than Qt 4.5.0</string> - </property> - <property name="text"> - <string>Qt 4.0</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="rQt45"> - <property name="focusPolicy"> - <enum>Qt::TabFocus</enum> - </property> - <property name="toolTip"> - <string>Select to generate code for Qt 4.5.0 or newer</string> - </property> - <property name="text"> - <string>Qt 4.5</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>161</width> - <height>21</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="groupBox"> <property name="title"> <string>Type</string> @@ -367,8 +316,6 @@ <layoutdefault spacing="6" margin="11"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> <tabstops> - <tabstop>rQt40</tabstop> - <tabstop>rQt45</tabstop> <tabstop>rColor</tabstop> <tabstop>rRGBA</tabstop> <tabstop>eTitle</tabstop>