Changeset 72f4834 in sasview for src/sas/qtgui/Perspectives/Fitting/FittingOptions.py
- Timestamp:
- Jun 16, 2017 4:22:23 AM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 85487ebd
- Parents:
- b0c5e8c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingOptions.py
rb0c5e8c r72f4834 19 19 # Set the default optimizer 20 20 fitters.FIT_DEFAULT_ID = 'lm' 21 21 22 22 23 class FittingOptions(QtGui.QDialog, Ui_FittingOptions): … … 66 67 self.assignValidators() 67 68 69 # Set defaults 68 70 self.current_fitter_id = fitters.FIT_DEFAULT_ID 71 72 # OK has to be initialized to True, after initial validator setup 73 self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True) 69 74 70 75 # Display HTML content … … 80 85 if type(f_type) == types.FunctionType: 81 86 validator = QtGui.QIntValidator() 87 validator.setBottom(0) 82 88 elif f_type == types.FloatType: 83 89 validator = QtGui.QDoubleValidator() 90 validator.setBottom(0) 84 91 else: 85 92 continue … … 88 95 if hasattr(line_edit, 'setValidator') and validator is not None: 89 96 line_edit.setValidator(validator) 97 line_edit.textChanged.connect(self.check_state) 98 line_edit.textChanged.emit(line_edit.text()) 99 100 def check_state(self, *args, **kwargs): 101 sender = self.sender() 102 validator = sender.validator() 103 state = validator.validate(sender.text(), 0)[0] 104 if state == QtGui.QValidator.Acceptable: 105 color = '' # default 106 self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True) 107 else: 108 color = '#fff79a' # yellow 109 self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False) 110 111 sender.setStyleSheet('QLineEdit { background-color: %s }' % color) 90 112 91 113 def onAlgorithmChange(self, index):
Note: See TracChangeset
for help on using the changeset viewer.