Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py

changeset 3125
385a62b53725
parent 3124
a01e410893ac
child 3142
55030c09e142
child 3154
8578850cdc6a
equal deleted inserted replaced
3124:a01e410893ac 3125:385a62b53725
123 istring = il * indString 123 istring = il * indString
124 estring = os.linesep + indLevel * indString 124 estring = os.linesep + indLevel * indString
125 125
126 # now generate the code 126 # now generate the code
127 # TODO: support entering 'parent' 127 # TODO: support entering 'parent'
128 if self.parentSelf.isChecked():
129 parent = "self"
130 elif self.parentNone.isChecked():
131 parent = "None"
132 elif self.parentOther.isChecked():
133 parent = self.parentEdit.text()
134 if parent == "":
135 parent = "None"
136
128 resvar = self.eResultVar.text() 137 resvar = self.eResultVar.text()
129 if not resvar: 138 if not resvar:
130 resvar = "result" 139 resvar = "result"
131 code = '{0}, ok = QInputDialog.'.format(resvar) 140 code = '{0}, ok = QInputDialog.'.format(resvar)
132 if self.rText.isChecked(): 141 if self.rText.isChecked():
133 code += 'getText({0}{1}'.format(os.linesep, istring) 142 code += 'getText({0}{1}'.format(os.linesep, istring)
134 code += 'None,{0}{1}'.format(os.linesep, istring) 143 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
135 code += 'self.trUtf8("{0}"),{1}{2}'.format( 144 code += 'self.trUtf8("{0}"),{1}{2}'.format(
136 self.eCaption.text(), os.linesep, istring) 145 self.eCaption.text(), os.linesep, istring)
137 code += 'self.trUtf8("{0}"),{1}{2}'.format( 146 code += 'self.trUtf8("{0}"),{1}{2}'.format(
138 self.eLabel.text(), os.linesep, istring) 147 self.eLabel.text(), os.linesep, istring)
139 if self.rEchoNormal.isChecked(): 148 if self.rEchoNormal.isChecked():
146 code += ',{0}{1}self.trUtf8("{2}")'.format( 155 code += ',{0}{1}self.trUtf8("{2}")'.format(
147 os.linesep, istring, self.eTextDefault.text()) 156 os.linesep, istring, self.eTextDefault.text())
148 code += '){0}'.format(estring) 157 code += '){0}'.format(estring)
149 elif self.rInteger.isChecked(): 158 elif self.rInteger.isChecked():
150 code += 'getInt({0}{1}'.format(os.linesep, istring) 159 code += 'getInt({0}{1}'.format(os.linesep, istring)
151 code += 'None,{0}{1}'.format(os.linesep, istring) 160 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
152 code += 'self.trUtf8("{0}"),{1}{2}'.format( 161 code += 'self.trUtf8("{0}"),{1}{2}'.format(
153 self.eCaption.text(), os.linesep, istring) 162 self.eCaption.text(), os.linesep, istring)
154 code += 'self.trUtf8("{0}"),{1}{2}'.format( 163 code += 'self.trUtf8("{0}"),{1}{2}'.format(
155 self.eLabel.text(), os.linesep, istring) 164 self.eLabel.text(), os.linesep, istring)
156 code += '{0:d}, {1:d}, {2:d}, {3:d}){4}'.format( 165 code += '{0:d}, {1:d}, {2:d}, {3:d}){4}'.format(
168 try: 177 try:
169 doubleTo = float(self.eDoubleTo.text()) 178 doubleTo = float(self.eDoubleTo.text())
170 except ValueError: 179 except ValueError:
171 doubleTo = 2147483647 180 doubleTo = 2147483647
172 code += 'getDouble({0}{1}'.format(os.linesep, istring) 181 code += 'getDouble({0}{1}'.format(os.linesep, istring)
173 code += 'None,{0}{1}'.format(os.linesep, istring) 182 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
174 code += 'self.trUtf8("{0}"),{1}{2}'.format( 183 code += 'self.trUtf8("{0}"),{1}{2}'.format(
175 self.eCaption.text(), os.linesep, istring) 184 self.eCaption.text(), os.linesep, istring)
176 code += 'self.trUtf8("{0}"),{1}{2}'.format( 185 code += 'self.trUtf8("{0}"),{1}{2}'.format(
177 self.eLabel.text(), os.linesep, istring) 186 self.eLabel.text(), os.linesep, istring)
178 code += '{0}, {1}, {2}, {3:d}){4}'.format( 187 code += '{0}, {1}, {2}, {3:d}){4}'.format(
179 doubleDefault, doubleFrom, doubleTo, 188 doubleDefault, doubleFrom, doubleTo,
180 self.sDoubleDecimals.value(), estring) 189 self.sDoubleDecimals.value(), estring)
181 elif self.rItem.isChecked(): 190 elif self.rItem.isChecked():
182 code += 'getItem({0}{1}'.format(os.linesep, istring) 191 code += 'getItem({0}{1}'.format(os.linesep, istring)
183 code += 'None,{0}{1}'.format(os.linesep, istring) 192 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
184 code += 'self.trUtf8("{0}"),{1}{2}'.format( 193 code += 'self.trUtf8("{0}"),{1}{2}'.format(
185 self.eCaption.text(), os.linesep, istring) 194 self.eCaption.text(), os.linesep, istring)
186 code += 'self.trUtf8("{0}"),{1}{2}'.format( 195 code += 'self.trUtf8("{0}"),{1}{2}'.format(
187 self.eLabel.text(), os.linesep, istring) 196 self.eLabel.text(), os.linesep, istring)
188 code += '{0},{1}{2}'.format( 197 code += '{0},{1}{2}'.format(

eric ide

mercurial