122 estring = os.linesep + indLevel * indString |
122 estring = os.linesep + indLevel * indString |
123 |
123 |
124 # now generate the code |
124 # now generate the code |
125 code = 'QColorDialog.' |
125 code = 'QColorDialog.' |
126 if self.rColor.isChecked(): |
126 if self.rColor.isChecked(): |
127 code += 'getColor(' |
127 code += 'getColor({0}'.format(os.linesep) |
128 if self.eColor.currentText(): |
128 if self.eColor.currentText(): |
129 col = self.eColor.currentText() |
129 col = self.eColor.currentText() |
130 if col.startswith('#'): |
130 if col.startswith('#'): |
131 code += 'QColor("{0}")'.format(col) |
131 code += '{0}QColor("{1}"),{2}'.format( |
|
132 istring, col, os.linesep) |
132 else: |
133 else: |
133 code += 'QColor({0})'.format(col) |
134 code += '{0}QColor({1}),{2}'.format( |
134 code += ', None,{0}'.format(os.linesep) |
135 istring, col, os.linesep) |
|
136 else: |
|
137 code += '{0}QColor(Qt.white),{1}'.format(istring, os.linesep) |
|
138 code += '{0}None,{1}'.format(istring, os.linesep) |
135 code += '{0}self.trUtf8("{1}"),{2}'.format( |
139 code += '{0}self.trUtf8("{1}"),{2}'.format( |
136 istring, self.eTitle.text(), os.linesep) |
140 istring, self.eTitle.text(), os.linesep) |
137 code += '{0}QColorDialog.ColorDialogOptions(' \ |
141 code += '{0}QColorDialog.ColorDialogOptions(' \ |
138 'QColorDialog.ShowAlphaChannel)'.format(istring) |
142 'QColorDialog.ShowAlphaChannel)'.format(istring) |
139 code += '){0}'.format(estring) |
143 code += '){0}'.format(estring) |
140 elif self.rRGBA.isChecked(): |
144 elif self.rRGBA.isChecked(): |
141 code += 'getColor(' |
145 code += 'getColor({0}'.format(os.linesep) |
142 if not self.eRGB.text(): |
146 if not self.eRGB.text(): |
143 code += 'QColor({0:d}, {1:d}, {2:d}, {3:d}),{4}'.format( |
147 code += '{0}QColor({1:d}, {2:d}, {3:d}, {4:d}),{5}'.format( |
144 self.sRed.value(), self.sGreen.value(), self.sBlue.value(), |
148 istring, self.sRed.value(), self.sGreen.value(), |
145 self.sAlpha.value(), os.linesep) |
149 self.sBlue.value(), self.sAlpha.value(), os.linesep) |
146 else: |
150 else: |
147 code += '{0},{1}'.format(self.eRGB.text(), os.linesep) |
151 code += '{0}{1},{2}'.format( |
|
152 istring, self.eRGB.text(), os.linesep) |
148 code += '{0}None,{1}'.format(istring, os.linesep) |
153 code += '{0}None,{1}'.format(istring, os.linesep) |
149 code += '{0}self.trUtf8("{1}"),{2}'.format( |
154 code += '{0}self.trUtf8("{1}"),{2}'.format( |
150 istring, self.eTitle.text(), os.linesep) |
155 istring, self.eTitle.text(), os.linesep) |
151 code += '{0}QColorDialog.ColorDialogOptions(' \ |
156 code += '{0}QColorDialog.ColorDialogOptions(' \ |
152 'QColorDialog.ShowAlphaChannel)'.format(istring) |
157 'QColorDialog.ShowAlphaChannel)'.format(istring) |