Plugins/WizardPlugins/InputDialogWizard/InputDialogWizardDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3366
6084bb3c3911
child 3591
2f2a4a76dd22
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
41 QDoubleValidator(-2147483647, 2147483647, 99, self.eDoubleFrom)) 41 QDoubleValidator(-2147483647, 2147483647, 99, self.eDoubleFrom))
42 self.eDoubleTo.setValidator( 42 self.eDoubleTo.setValidator(
43 QDoubleValidator(-2147483647, 2147483647, 99, self.eDoubleTo)) 43 QDoubleValidator(-2147483647, 2147483647, 99, self.eDoubleTo))
44 44
45 self.bTest = self.buttonBox.addButton( 45 self.bTest = self.buttonBox.addButton(
46 self.trUtf8("Test"), QDialogButtonBox.ActionRole) 46 self.tr("Test"), QDialogButtonBox.ActionRole)
47
48 msh = self.minimumSizeHint()
49 self.resize(max(self.width(), msh.width()), msh.height())
47 50
48 @pyqtSlot(bool) 51 @pyqtSlot(bool)
49 def on_rItem_toggled(self, checked): 52 def on_rItem_toggled(self, checked):
50 """ 53 """
51 Private slot to perform actions dependant on the item type selection. 54 Private slot to perform actions dependant on the item type selection.
140 resvar = "result" 143 resvar = "result"
141 code = '{0}, ok = QInputDialog.'.format(resvar) 144 code = '{0}, ok = QInputDialog.'.format(resvar)
142 if self.rText.isChecked(): 145 if self.rText.isChecked():
143 code += 'getText({0}{1}'.format(os.linesep, istring) 146 code += 'getText({0}{1}'.format(os.linesep, istring)
144 code += '{0},{1}{2}'.format(parent, os.linesep, istring) 147 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
145 code += 'self.trUtf8("{0}"),{1}{2}'.format( 148 code += 'self.tr("{0}"),{1}{2}'.format(
146 self.eCaption.text(), os.linesep, istring) 149 self.eCaption.text(), os.linesep, istring)
147 code += 'self.trUtf8("{0}"),{1}{2}'.format( 150 code += 'self.tr("{0}"),{1}{2}'.format(
148 self.eLabel.text(), os.linesep, istring) 151 self.eLabel.text(), os.linesep, istring)
149 if self.rEchoNormal.isChecked(): 152 if self.rEchoNormal.isChecked():
150 code += 'QLineEdit.Normal' 153 code += 'QLineEdit.Normal'
151 elif self.rEchoNoEcho.isChecked(): 154 elif self.rEchoNoEcho.isChecked():
152 code += 'QLineEdit.NoEcho' 155 code += 'QLineEdit.NoEcho'
153 else: 156 else:
154 code += 'QLineEdit.Password' 157 code += 'QLineEdit.Password'
155 if self.eTextDefault.text(): 158 if self.eTextDefault.text():
156 code += ',{0}{1}self.trUtf8("{2}")'.format( 159 code += ',{0}{1}self.tr("{2}")'.format(
157 os.linesep, istring, self.eTextDefault.text()) 160 os.linesep, istring, self.eTextDefault.text())
158 code += '){0}'.format(estring) 161 code += '){0}'.format(estring)
159 elif self.rInteger.isChecked(): 162 elif self.rInteger.isChecked():
160 code += 'getInt({0}{1}'.format(os.linesep, istring) 163 code += 'getInt({0}{1}'.format(os.linesep, istring)
161 code += '{0},{1}{2}'.format(parent, os.linesep, istring) 164 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
162 code += 'self.trUtf8("{0}"),{1}{2}'.format( 165 code += 'self.tr("{0}"),{1}{2}'.format(
163 self.eCaption.text(), os.linesep, istring) 166 self.eCaption.text(), os.linesep, istring)
164 code += 'self.trUtf8("{0}"),{1}{2}'.format( 167 code += 'self.tr("{0}"),{1}{2}'.format(
165 self.eLabel.text(), os.linesep, istring) 168 self.eLabel.text(), os.linesep, istring)
166 code += '{0:d}, {1:d}, {2:d}, {3:d}){4}'.format( 169 code += '{0:d}, {1:d}, {2:d}, {3:d}){4}'.format(
167 self.sIntDefault.value(), self.sIntFrom.value(), 170 self.sIntDefault.value(), self.sIntFrom.value(),
168 self.sIntTo.value(), self.sIntStep.value(), estring) 171 self.sIntTo.value(), self.sIntStep.value(), estring)
169 elif self.rDouble.isChecked(): 172 elif self.rDouble.isChecked():
179 doubleTo = float(self.eDoubleTo.text()) 182 doubleTo = float(self.eDoubleTo.text())
180 except ValueError: 183 except ValueError:
181 doubleTo = 2147483647 184 doubleTo = 2147483647
182 code += 'getDouble({0}{1}'.format(os.linesep, istring) 185 code += 'getDouble({0}{1}'.format(os.linesep, istring)
183 code += '{0},{1}{2}'.format(parent, os.linesep, istring) 186 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
184 code += 'self.trUtf8("{0}"),{1}{2}'.format( 187 code += 'self.tr("{0}"),{1}{2}'.format(
185 self.eCaption.text(), os.linesep, istring) 188 self.eCaption.text(), os.linesep, istring)
186 code += 'self.trUtf8("{0}"),{1}{2}'.format( 189 code += 'self.tr("{0}"),{1}{2}'.format(
187 self.eLabel.text(), os.linesep, istring) 190 self.eLabel.text(), os.linesep, istring)
188 code += '{0}, {1}, {2}, {3:d}){4}'.format( 191 code += '{0}, {1}, {2}, {3:d}){4}'.format(
189 doubleDefault, doubleFrom, doubleTo, 192 doubleDefault, doubleFrom, doubleTo,
190 self.sDoubleDecimals.value(), estring) 193 self.sDoubleDecimals.value(), estring)
191 elif self.rItem.isChecked(): 194 elif self.rItem.isChecked():
192 code += 'getItem({0}{1}'.format(os.linesep, istring) 195 code += 'getItem({0}{1}'.format(os.linesep, istring)
193 code += '{0},{1}{2}'.format(parent, os.linesep, istring) 196 code += '{0},{1}{2}'.format(parent, os.linesep, istring)
194 code += 'self.trUtf8("{0}"),{1}{2}'.format( 197 code += 'self.tr("{0}"),{1}{2}'.format(
195 self.eCaption.text(), os.linesep, istring) 198 self.eCaption.text(), os.linesep, istring)
196 code += 'self.trUtf8("{0}"),{1}{2}'.format( 199 code += 'self.tr("{0}"),{1}{2}'.format(
197 self.eLabel.text(), os.linesep, istring) 200 self.eLabel.text(), os.linesep, istring)
198 code += '{0},{1}{2}'.format( 201 code += '{0},{1}{2}'.format(
199 self.eVariable.text(), os.linesep, istring) 202 self.eVariable.text(), os.linesep, istring)
200 code += '{0:d}, {1}){2}'.format( 203 code += '{0:d}, {1}){2}'.format(
201 self.sCurrentItem.value(), self.cEditable.isChecked(), estring) 204 self.sCurrentItem.value(), self.cEditable.isChecked(), estring)

eric ide

mercurial