Changeset ea1753f in sasview


Ignore:
Timestamp:
Mar 28, 2019 7:48:07 AM (6 years ago)
Author:
ibressler
Branches:
ESS_GUI_bumps_abstraction
Children:
af893db
Parents:
740a738
Message:

FittingOptions?.updateConfigFromWidget()

  • analog to updateWidgetFromConfig()
File:
1 edited

Legend:

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

    r740a738 rea1753f  
    364364 
    365365        # update config values from widgets before any notification is sent 
    366         for param in fm.params.values(): 
    367             widget = self.paramWidget(fm, param.shortName) 
    368             if widget is None: 
    369                 continue 
    370             try: 
    371                 if isinstance(widget, QtWidgets.QComboBox): 
    372                     new_value = widget.currentText() 
    373                 else: 
    374                     try: 
    375                         new_value = int(widget.text()) 
    376                     except ValueError: 
    377                         new_value = float(widget.text()) 
    378                 fm.params[param.shortName].value = new_value 
    379             except ValueError: 
    380                 # Don't update bumps if widget has bad data 
    381                 self.reject 
     366        try: 
     367            self.updateConfigFromWidget(fm) 
     368        except ValueError: 
     369            # Don't update bumps if widget has bad data 
     370            self.reject 
    382371 
    383372        fm.storeConfig() # write the current settings to bumps module 
     
    423412                eval(widget_name).setText(str(param.value)) 
    424413 
     414    def updateConfigFromWidget(self, fittingMethod): 
     415        # update config values from widgets before any notification is sent 
     416        for param in fittingMethod.params.values(): 
     417            widget = self.paramWidget(fittingMethod, param.shortName) 
     418            if widget is None: 
     419                continue 
     420            new_value = None 
     421            if isinstance(widget, QtWidgets.QComboBox): 
     422                new_value = widget.currentText() 
     423            else: 
     424                try: 
     425                    new_value = int(widget.text()) 
     426                except ValueError: 
     427                    new_value = float(widget.text()) 
     428            if new_value is not None: 
     429                fittingMethod.params[param.shortName].value = new_value 
Note: See TracChangeset for help on using the changeset viewer.