Plugins/WizardPlugins/ColorDialogWizard/ColorDialogWizardDialog.py

changeset 3125
385a62b53725
parent 3124
a01e410893ac
child 3142
55030c09e142
child 3160
209a07d7e401
equal deleted inserted replaced
3124:a01e410893ac 3125:385a62b53725
120 il = indLevel + 1 120 il = indLevel + 1
121 istring = il * indString 121 istring = il * indString
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 # TODO: support entering 'parent' 125 if self.parentSelf.isChecked():
126 parent = "self"
127 elif self.parentNone.isChecked():
128 parent = "None"
129 elif self.parentOther.isChecked():
130 parent = self.parentEdit.text()
131 if parent == "":
132 parent = "None"
133
126 resvar = self.eResultVar.text() 134 resvar = self.eResultVar.text()
127 if not resvar: 135 if not resvar:
128 resvar = "color" 136 resvar = "color"
129 code = '{0} = QColorDialog.'.format(resvar) 137 code = '{0} = QColorDialog.'.format(resvar)
130 if self.rColor.isChecked(): 138 if self.rColor.isChecked():
137 else: 145 else:
138 code += '{0}QColor({1}),{2}'.format( 146 code += '{0}QColor({1}),{2}'.format(
139 istring, col, os.linesep) 147 istring, col, os.linesep)
140 else: 148 else:
141 code += '{0}QColor(Qt.white),{1}'.format(istring, os.linesep) 149 code += '{0}QColor(Qt.white),{1}'.format(istring, os.linesep)
142 code += '{0}None,{1}'.format(istring, os.linesep) 150 code += '{0}{1},{2}'.format(istring, parent, os.linesep)
143 code += '{0}self.trUtf8("{1}"),{2}'.format( 151 code += '{0}self.trUtf8("{1}"),{2}'.format(
144 istring, self.eTitle.text(), os.linesep) 152 istring, self.eTitle.text(), os.linesep)
145 code += '{0}QColorDialog.ColorDialogOptions(' \ 153 code += '{0}QColorDialog.ColorDialogOptions(' \
146 'QColorDialog.ShowAlphaChannel)'.format(istring) 154 'QColorDialog.ShowAlphaChannel)'.format(istring)
147 code += '){0}'.format(estring) 155 code += '){0}'.format(estring)
152 istring, self.sRed.value(), self.sGreen.value(), 160 istring, self.sRed.value(), self.sGreen.value(),
153 self.sBlue.value(), self.sAlpha.value(), os.linesep) 161 self.sBlue.value(), self.sAlpha.value(), os.linesep)
154 else: 162 else:
155 code += '{0}{1},{2}'.format( 163 code += '{0}{1},{2}'.format(
156 istring, self.eRGB.text(), os.linesep) 164 istring, self.eRGB.text(), os.linesep)
157 code += '{0}None,{1}'.format(istring, os.linesep) 165 code += '{0}{1},{2}'.format(istring, parent, os.linesep)
158 code += '{0}self.trUtf8("{1}"),{2}'.format( 166 code += '{0}self.trUtf8("{1}"),{2}'.format(
159 istring, self.eTitle.text(), os.linesep) 167 istring, self.eTitle.text(), os.linesep)
160 code += '{0}QColorDialog.ColorDialogOptions(' \ 168 code += '{0}QColorDialog.ColorDialogOptions(' \
161 'QColorDialog.ShowAlphaChannel)'.format(istring) 169 'QColorDialog.ShowAlphaChannel)'.format(istring)
162 code += '){0}'.format(estring) 170 code += '){0}'.format(estring)

eric ide

mercurial