Changeset 8f2548c in sasview


Ignore:
Timestamp:
Sep 20, 2017 4:19:54 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
adc49fc
Parents:
e694f0f
Message:

Fix fitting table behaviour for when the error column is added

Location:
src/sas/qtgui/Perspectives/Fitting
Files:
2 edited

Legend:

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

    r8a32a6ff r8f2548c  
    871871 
    872872        error_column = [] 
     873        self.lstParams.itemDelegate().addErrorColumn() 
    873874        self.iterateOverModel(createErrorColumn) 
    874875 
     
    12691270            return 
    12701271        parameter_name = str(self._model_model.data(name_index).toPyObject()) # sld, background etc. 
    1271         property_index = self._model_model.headerData(1, model_column).toInt()[0]-1 # Value, min, max, etc. 
    12721272 
    12731273        # Update the parameter value - note: this supports +/-inf as well 
     
    12751275 
    12761276        # Update the parameter value - note: this supports +/-inf as well 
    1277         if model_column == 0: 
     1277        param_column = self.lstParams.itemDelegate().param_value 
     1278        min_column = self.lstParams.itemDelegate().param_min 
     1279        max_column = self.lstParams.itemDelegate().param_max 
     1280        if model_column == param_column: 
    12781281            self.kernel_module.setParam(parameter_name, value) 
     1282        elif model_column == min_column: 
     1283            # min/max to be changed in self.kernel_module.details[parameter_name] = ['Ang', 0.0, inf] 
     1284            self.kernel_module.details[parameter_name][1] = value 
     1285        elif model_column == max_column: 
     1286            self.kernel_module.details[parameter_name][2] = value 
    12791287        else: 
    1280             # min/max to be changed in self.kernel_module.details[parameter_name] = ['Ang', 0.0, inf] 
    1281             self.kernel_module.details[parameter_name][property_index] = value 
     1288            # don't update the chart 
     1289            return 
    12821290 
    12831291        # TODO: magnetic params in self.kernel_module.details['M0:parameter_name'] = value 
  • src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py

    re43fc91 r8f2548c  
    88    Custom delegate for appearance and behavior control of the model view 
    99    """ 
    10     # Main parameter table view columns 
    11     PARAM_PROPERTY=0 
    12     PARAM_VALUE=1 
    13     PARAM_MIN=2 
    14     PARAM_MAX=3 
    15     PARAM_UNIT=4 
     10    def __init__(self, parent=None): 
     11        """ 
     12        Overwrite generic constructor to allow for some globals 
     13        """ 
     14        super(QtGui.QStyledItemDelegate, self).__init__() 
     15 
     16        # Main parameter table view columns 
     17        self.param_error=-1 
     18        self.param_property=0 
     19        self.param_value=1 
     20        self.param_min=2 
     21        self.param_max=2 
     22        self.param_unit=2 
     23 
     24    def editableParameters(self): 
     25        return [self.param_value, self.param_min, self.param_max] 
     26 
     27    def addErrorColumn(self): 
     28        """ 
     29        Modify local column pointers 
     30        Note: the reverse is never required! 
     31        """ 
     32        self.param_property=0 
     33        self.param_value=1 
     34        self.param_error=2 
     35        self.param_min=3 
     36        self.param_max=4 
     37        self.param_unit=5 
    1638 
    1739    def paint(self, painter, option, index): 
     
    1941        Overwrite generic painter for certain columns 
    2042        """ 
    21         if index.column() in (self.PARAM_UNIT, self.PARAM_MIN, self.PARAM_MAX): 
     43        if index.column() in self.editableParameters(): 
    2244            # Units - present in nice HTML 
    2345            options = QtGui.QStyleOptionViewItemV4(option) 
     
    5678        if not index.isValid(): 
    5779            return 0 
    58         if index.column() == self.PARAM_VALUE: #only in the value column 
     80        if index.column() == self.param_value: #only in the value column 
    5981            editor = QtGui.QLineEdit(widget) 
    6082            validator = QtGui.QDoubleValidator() 
    6183            editor.setValidator(validator) 
    6284            return editor 
    63         if index.column() in [self.PARAM_PROPERTY, self.PARAM_UNIT]: 
     85        if index.column() in [self.param_property, self.param_error]: 
    6486            # Set some columns uneditable 
    6587            return None 
     
    7193        Overwrite generic model update method for certain columns 
    7294        """ 
    73         if index.column() in (self.PARAM_MIN, self.PARAM_MAX): 
     95        if index.column() in (self.param_min, self.param_max): 
    7496            try: 
    7597                value_float = float(editor.text()) 
     
    86108    """ 
    87109    POLYDISPERSE_FUNCTIONS = ['rectangle', 'array', 'lognormal', 'gaussian', 'schulz'] 
    88     #POLYDISPERSE_FUNCTIONS = ['rectangle', 'lognormal', 'gaussian', 'schulz'] 
    89110 
    90111    combo_updated = QtCore.pyqtSignal(str, int) 
Note: See TracChangeset for help on using the changeset viewer.