Changeset 72f4834 in sasview for src/sas/qtgui/Perspectives/Fitting
- Timestamp:
- Jun 16, 2017 4:22:23 AM (8 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
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 4 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): -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rb0c5e8c r72f4834 1363 1363 """ 1364 1364 datafile = QtGui.QFileDialog.getOpenFileName( 1365 self, "Choose a weight file", "", "All files (*.*)") 1366 if not datafile: 1365 self, "Choose a weight file", "", "All files (*.*)", 1366 None, QtGui.QFileDialog.DontUseNativeDialog) 1367 1368 if datafile is None: 1367 1369 logging.info("No weight data chosen.") 1368 1370 raise IOError 1371 1369 1372 values = [] 1370 1373 weights = [] -
src/sas/qtgui/Perspectives/Fitting/UI/FittingOptionsUI.ui
rb0c5e8c r72f4834 116 116 <item> 117 117 <property name="text"> 118 <string>ra dom</string>118 <string>random</string> 119 119 </property> 120 120 </item> -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingOptionsTest.py
rb0c5e8c r72f4834 61 61 self.assertIsInstance(self.widget.ftol_de.validator(), QtGui.QDoubleValidator) 62 62 self.assertIsInstance(self.widget.xtol_de.validator(), QtGui.QDoubleValidator) 63 64 # bottom value for floats and ints 65 self.assertEqual(self.widget.steps_de.validator().bottom(), 0) 66 self.assertEqual(self.widget.CR_de.validator().bottom(), 0) 67 68 # Behaviour on empty cell 69 self.widget.onAlgorithmChange(3) 70 self.widget.steps_de.setText("") 71 # This should disable the OK button 72 self.assertFalse(self.widget.buttonBox.button(QtGui.QDialogButtonBox.Ok).isEnabled()) 73 # Let's put some valid value in lineedit 74 self.widget.steps_de.setText("1") 75 # This should enable the OK button 76 self.assertTrue(self.widget.buttonBox.button(QtGui.QDialogButtonBox.Ok).isEnabled()) 63 77 64 78 def testOnAlgorithmChange(self):
Note: See TracChangeset
for help on using the changeset viewer.