Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py

changeset 3005
3953ddfb991d
parent 2302
f29e9405c851
child 3020
542e97d4ecb3
child 3057
10516539f238
equal deleted inserted replaced
3004:c4bf32c791d0 3005:3953ddfb991d
31 @param parent parent widget (QWidget) 31 @param parent parent widget (QWidget)
32 """ 32 """
33 super().__init__(parent) 33 super().__init__(parent)
34 self.setupUi(self) 34 self.setupUi(self)
35 35
36 self.bTest = \ 36 self.bTest = self.buttonBox.addButton(
37 self.buttonBox.addButton(self.trUtf8("Test"), QDialogButtonBox.ActionRole) 37 self.trUtf8("Test"), QDialogButtonBox.ActionRole)
38 38
39 def on_buttonBox_clicked(self, button): 39 def on_buttonBox_clicked(self, button):
40 """ 40 """
41 Private slot called by a button of the button box clicked. 41 Private slot called by a button of the button box clicked.
42 42
64 ' QColorDialog.getColor({0}, None, "{1}")'.format( 64 ' QColorDialog.getColor({0}, None, "{1}")'.format(
65 coStr, self.eTitle.text())) 65 coStr, self.eTitle.text()))
66 except: 66 except:
67 E5MessageBox.critical(self, 67 E5MessageBox.critical(self,
68 self.trUtf8("QColorDialog Wizard Error"), 68 self.trUtf8("QColorDialog Wizard Error"),
69 self.trUtf8("""<p>The colour <b>{0}</b> is not valid.</p>""") 69 self.trUtf8(
70 """<p>The colour <b>{0}</b> is not valid.</p>""")
70 .format(coStr)) 71 .format(coStr))
71 72
72 elif self.rRGBA.isChecked(): 73 elif self.rRGBA.isChecked():
73 QColorDialog.getColor( 74 QColorDialog.getColor(
74 QColor(self.sRed.value(), self.sGreen.value(), 75 QColor(self.sRed.value(), self.sGreen.value(),
130 else: 131 else:
131 code += 'QColor({0})'.format(col) 132 code += 'QColor({0})'.format(col)
132 code += ', None,{0}'.format(os.linesep) 133 code += ', None,{0}'.format(os.linesep)
133 code += '{0}self.trUtf8("{1}"),{2}'.format( 134 code += '{0}self.trUtf8("{1}"),{2}'.format(
134 istring, self.eTitle.text(), os.linesep) 135 istring, self.eTitle.text(), os.linesep)
135 code += \ 136 code += '{0}QColorDialog.ColorDialogOptions(' \
136 '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ 137 'QColorDialog.ShowAlphaChannel)'.format(istring)
137 .format(istring)
138 code += '){0}'.format(estring) 138 code += '){0}'.format(estring)
139 elif self.rRGBA.isChecked(): 139 elif self.rRGBA.isChecked():
140 code += 'getColor(' 140 code += 'getColor('
141 if not self.eRGB.text(): 141 if not self.eRGB.text():
142 code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format( 142 code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format(
145 else: 145 else:
146 code += '{0},{1}'.format(self.eRGB.text(), os.linesep) 146 code += '{0},{1}'.format(self.eRGB.text(), os.linesep)
147 code += '{0}None,{1}'.format(istring, os.linesep) 147 code += '{0}None,{1}'.format(istring, os.linesep)
148 code += '{0}self.trUtf8("{1}"),{2}'.format( 148 code += '{0}self.trUtf8("{1}"),{2}'.format(
149 istring, self.eTitle.text(), os.linesep) 149 istring, self.eTitle.text(), os.linesep)
150 code += \ 150 code += '{0}QColorDialog.ColorDialogOptions(' \
151 '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ 151 'QColorDialog.ShowAlphaChannel)'.format(istring)
152 .format(istring)
153 code += '){0}'.format(estring) 152 code += '){0}'.format(estring)
154 153
155 return code 154 return code

eric ide

mercurial