- Timestamp:
- Sep 19, 2018 9:35:51 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 9d23e4c
- Parents:
- d1e4689
- git-author:
- Piotr Rozyczko <piotrrozyczko@…> (09/19/18 09:32:51)
- git-committer:
- Piotr Rozyczko <piotrrozyczko@…> (09/19/18 09:35:51)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingOptions.py
rff3b293 r8873ab7 64 64 default_index = self.cbAlgorithm.findText(default_name) 65 65 self.cbAlgorithm.setCurrentIndex(default_index) 66 # previous algorithm choice 67 self.previous_index = default_index 66 68 67 69 # Assign appropriate validators … … 121 123 122 124 # Convert the name into widget instance 123 widget_to_activate = eval(widget_name) 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 124 140 index_for_this_id = self.stackedWidget.indexOf(widget_to_activate) 125 141 … … 133 149 # OK has to be reinitialized to True 134 150 self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 151 152 # keep reference 153 self.previous_index = index 135 154 136 155 def onApply(self): … … 143 162 # e.g. 'samples' for 'dream' is 'self.samples_dream' 144 163 widget_name = 'self.'+option+'_'+self.current_fitter_id 145 line_edit = eval(widget_name) 164 try: 165 line_edit = eval(widget_name) 166 except AttributeError: 167 # Skip bumps monitors 168 continue 146 169 if line_edit is None or not isinstance(line_edit, QtWidgets.QLineEdit): 147 170 continue … … 165 188 return 166 189 try: 167 new_value = widget.currentText() if isinstance(widget, QtWidgets.QComboBox) \ 168 else float(widget.text()) 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()) 169 199 self.config.values[self.current_fitter_id][option] = new_value 170 200 except ValueError:
Note: See TracChangeset
for help on using the changeset viewer.