Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py

changeset 446
69aac6eeba9b
parent 425
ca5e65413fc5
child 537
72b32daeb8d6
equal deleted inserted replaced
444:6f3b2099858e 446:69aac6eeba9b
132 @return generated code (string) 132 @return generated code (string)
133 """ 133 """
134 # calculate our indentation level and the indentation string 134 # calculate our indentation level and the indentation string
135 il = indLevel + 1 135 il = indLevel + 1
136 istring = il * indString 136 istring = il * indString
137 estring = os.linesep + indLevel * indString
137 138
138 # now generate the code 139 # now generate the code
139 code = 'QColorDialog.' 140 code = 'QColorDialog.'
140 if self.rColor.isChecked(): 141 if self.rColor.isChecked():
141 code += 'getColor(' 142 code += 'getColor('
150 code += '{0}self.trUtf8("{1}"),{2}'.format( 151 code += '{0}self.trUtf8("{1}"),{2}'.format(
151 istring, self.eTitle.text(), os.linesep) 152 istring, self.eTitle.text(), os.linesep)
152 code += \ 153 code += \
153 '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ 154 '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\
154 .format(istring) 155 .format(istring)
155 code += '){0}'.format(os.linesep) 156 code += '){0}'.format(estring)
156 elif self.rRGBA.isChecked(): 157 elif self.rRGBA.isChecked():
157 if self.rQt45.isChecked(): 158 if self.rQt45.isChecked():
158 code += 'getColor(' 159 code += 'getColor('
159 if not self.eRGB.text(): 160 if not self.eRGB.text():
160 code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format( 161 code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format(
166 code += '{0}self.trUtf8("{1}"),{2}'.format( 167 code += '{0}self.trUtf8("{1}"),{2}'.format(
167 istring, self.eTitle.text(), os.linesep) 168 istring, self.eTitle.text(), os.linesep)
168 code += \ 169 code += \
169 '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\ 170 '{0}QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel)'\
170 .format(istring) 171 .format(istring)
171 code += '){0}'.format(os.linesep) 172 code += '){0}'.format(estring)
172 else: 173 else:
173 code += 'getRgba(' 174 code += 'getRgba('
174 if not self.eRGB.text(): 175 if not self.eRGB.text():
175 code += 'qRgba({0:d}, {1:d}, {2:d}, {3:d})'.format( 176 code += 'qRgba({0:d}, {1:d}, {2:d}, {3:d})'.format(
176 self.sRed.value(), self.sGreen.value(), self.sBlue.value(), 177 self.sRed.value(), self.sGreen.value(), self.sBlue.value(),
177 self.sAlpha.value()) 178 self.sAlpha.value())
178 else: 179 else:
179 code += self.eRGB.text() 180 code += self.eRGB.text()
180 code += '){0}'.format(os.linesep) 181 code += '){0}'.format(estring)
181 182
182 return code 183 return code

eric ide

mercurial