Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/FittingOptions.py

    r8873ab7 rff3b293  
    6464        default_index = self.cbAlgorithm.findText(default_name) 
    6565        self.cbAlgorithm.setCurrentIndex(default_index) 
    66         # previous algorithm choice 
    67         self.previous_index = default_index 
    6866 
    6967        # Assign appropriate validators 
     
    123121 
    124122        # 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) 
    140124        index_for_this_id = self.stackedWidget.indexOf(widget_to_activate) 
    141125 
     
    149133        # OK has to be reinitialized to True 
    150134        self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 
    151  
    152         # keep reference 
    153         self.previous_index = index 
    154135 
    155136    def onApply(self): 
     
    162143            # e.g. 'samples' for 'dream' is 'self.samples_dream' 
    163144            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) 
    169146            if line_edit is None or not isinstance(line_edit, QtWidgets.QLineEdit): 
    170147                continue 
     
    188165                return 
    189166            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()) 
    199169                self.config.values[self.current_fitter_id][option] = new_value 
    200170            except ValueError: 
Note: See TracChangeset for help on using the changeset viewer.