Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3005
3953ddfb991d
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
33 @param parent parent widget (QWidget) 33 @param parent parent widget (QWidget)
34 """ 34 """
35 super(ColorDialogWizardDialog, self).__init__(parent) 35 super(ColorDialogWizardDialog, self).__init__(parent)
36 self.setupUi(self) 36 self.setupUi(self)
37 37
38 self.bTest = \ 38 self.bTest = self.buttonBox.addButton(
39 self.buttonBox.addButton(self.trUtf8("Test"), QDialogButtonBox.ActionRole) 39 self.trUtf8("Test"), QDialogButtonBox.ActionRole)
40 40
41 def on_buttonBox_clicked(self, button): 41 def on_buttonBox_clicked(self, button):
42 """ 42 """
43 Private slot called by a button of the button box clicked. 43 Private slot called by a button of the button box clicked.
44 44
66 ' QColorDialog.getColor({0}, None, "{1}")'.format( 66 ' QColorDialog.getColor({0}, None, "{1}")'.format(
67 coStr, self.eTitle.text())) 67 coStr, self.eTitle.text()))
68 except: 68 except:
69 E5MessageBox.critical(self, 69 E5MessageBox.critical(self,
70 self.trUtf8("QColorDialog Wizard Error"), 70 self.trUtf8("QColorDialog Wizard Error"),
71 self.trUtf8("""<p>The colour <b>{0}</b> is not valid.</p>""") 71 self.trUtf8(
72 """<p>The colour <b>{0}</b> is not valid.</p>""")
72 .format(coStr)) 73 .format(coStr))
73 74
74 elif self.rRGBA.isChecked(): 75 elif self.rRGBA.isChecked():
75 QColorDialog.getColor( 76 QColorDialog.getColor(
76 QColor(self.sRed.value(), self.sGreen.value(), 77 QColor(self.sRed.value(), self.sGreen.value(),
132 else: 133 else:
133 code += 'QColor({0})'.format(col) 134 code += 'QColor({0})'.format(col)
134 code += ', None,{0}'.format(os.linesep) 135 code += ', None,{0}'.format(os.linesep)
135 code += '{0}self.trUtf8("{1}"),{2}'.format( 136 code += '{0}self.trUtf8("{1}"),{2}'.format(
136 istring, self.eTitle.text(), os.linesep) 137 istring, self.eTitle.text(), os.linesep)
137 code += \ 138 code += '{0}QColorDialog.ColorDialogOptions(' \
138 '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ 139 'QColorDialog.ShowAlphaChannel)'.format(istring)
139 .format(istring)
140 code += '){0}'.format(estring) 140 code += '){0}'.format(estring)
141 elif self.rRGBA.isChecked(): 141 elif self.rRGBA.isChecked():
142 code += 'getColor(' 142 code += 'getColor('
143 if not self.eRGB.text(): 143 if not self.eRGB.text():
144 code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format( 144 code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format(
147 else: 147 else:
148 code += '{0},{1}'.format(self.eRGB.text(), os.linesep) 148 code += '{0},{1}'.format(self.eRGB.text(), os.linesep)
149 code += '{0}None,{1}'.format(istring, os.linesep) 149 code += '{0}None,{1}'.format(istring, os.linesep)
150 code += '{0}self.trUtf8("{1}"),{2}'.format( 150 code += '{0}self.trUtf8("{1}"),{2}'.format(
151 istring, self.eTitle.text(), os.linesep) 151 istring, self.eTitle.text(), os.linesep)
152 code += \ 152 code += '{0}QColorDialog.ColorDialogOptions(' \
153 '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ 153 'QColorDialog.ShowAlphaChannel)'.format(istring)
154 .format(istring)
155 code += '){0}'.format(estring) 154 code += '){0}'.format(estring)
156 155
157 return code 156 return code

eric ide

mercurial