Changes in src/sas/qtgui/Perspectives/Fitting/FittingOptions.py [8873ab7:ff3b293] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingOptions.py
r8873ab7 rff3b293 64 64 default_index = self.cbAlgorithm.findText(default_name) 65 65 self.cbAlgorithm.setCurrentIndex(default_index) 66 # previous algorithm choice67 self.previous_index = default_index68 66 69 67 # Assign appropriate validators … … 123 121 124 122 # Convert the name into widget instance 125 try: 126 widget_to_activate = eval(widget_name) 127 except AttributeError: 128 # We don't yet have this optimizer. 129 # Show message 130 msg = "This algorithm has not yet been implemented in SasView.\n" 131 msg += "Please choose a different algorithm" 132 QtWidgets.QMessageBox.warning(self, 133 'Warning', 134 msg, 135 QtWidgets.QMessageBox.Ok) 136 # Move the index to previous position 137 self.cbAlgorithm.setCurrentIndex(self.previous_index) 138 return 139 123 widget_to_activate = eval(widget_name) 140 124 index_for_this_id = self.stackedWidget.indexOf(widget_to_activate) 141 125 … … 149 133 # OK has to be reinitialized to True 150 134 self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 151 152 # keep reference153 self.previous_index = index154 135 155 136 def onApply(self): … … 162 143 # e.g. 'samples' for 'dream' is 'self.samples_dream' 163 144 widget_name = 'self.'+option+'_'+self.current_fitter_id 164 try: 165 line_edit = eval(widget_name) 166 except AttributeError: 167 # Skip bumps monitors 168 continue 145 line_edit = eval(widget_name) 169 146 if line_edit is None or not isinstance(line_edit, QtWidgets.QLineEdit): 170 147 continue … … 188 165 return 189 166 try: 190 if isinstance(widget, QtWidgets.QComboBox): 191 new_value = widget.currentText() 192 else: 193 try: 194 new_value = int(widget.text()) 195 except ValueError: 196 new_value = float(widget.text()) 197 #new_value = widget.currentText() if isinstance(widget, QtWidgets.QComboBox) \ 198 # else float(widget.text()) 167 new_value = widget.currentText() if isinstance(widget, QtWidgets.QComboBox) \ 168 else float(widget.text()) 199 169 self.config.values[self.current_fitter_id][option] = new_value 200 170 except ValueError:
Note: See TracChangeset
for help on using the changeset viewer.