Ignore:
File:
1 edited

Legend:

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

    rbb477f5 rf3cc979  
    12191219        if model_column in [delegate.poly_pd, delegate.poly_error, delegate.poly_min, delegate.poly_max]: 
    12201220            row = self.getRowFromName(parameter_name) 
    1221             param_item = self._model_model.item(row) 
     1221            param_item = self._model_model.item(row).child(0).child(0, model_column) 
     1222            if param_item is None: 
     1223                return 
    12221224            self._model_model.blockSignals(True) 
    1223             param_item.child(0).child(0, model_column).setText(item.text()) 
     1225            param_item.setText(item.text()) 
    12241226            self._model_model.blockSignals(False) 
    12251227 
     
    27962798 
    27972799        func = QtWidgets.QComboBox() 
    2798         # Available range of shells displayed in the combobox 
    2799         func.addItems([str(i) for i in range(param_length+1)]) 
    2800  
    2801         # Respond to index change 
    2802         func.currentIndexChanged.connect(self.modifyShellsInList) 
    28032800 
    28042801        # cell 2: combobox 
    28052802        item2 = QtGui.QStandardItem() 
    2806         self._model_model.appendRow([item1, item2]) 
     2803 
     2804        # cell 3: min value 
     2805        item3 = QtGui.QStandardItem() 
     2806 
     2807        # cell 4: max value 
     2808        item4 = QtGui.QStandardItem() 
     2809 
     2810        self._model_model.appendRow([item1, item2, item3, item4]) 
    28072811 
    28082812        # Beautify the row:  span columns 2-4 
     
    28232827            logger.error("Could not find %s in kernel parameters.", param_name) 
    28242828        default_shell_count = shell_par.default 
     2829        shell_min = 0 
     2830        shell_max = 0 
     2831        try: 
     2832            shell_min = int(shell_par.limits[0]) 
     2833            shell_max = int(shell_par.limits[1]) 
     2834        except IndexError as ex: 
     2835            # no info about limits 
     2836            pass 
     2837        item3.setText(str(shell_min)) 
     2838        item4.setText(str(shell_max)) 
     2839 
     2840        # Respond to index change 
     2841        func.currentTextChanged.connect(self.modifyShellsInList) 
     2842 
     2843        # Available range of shells displayed in the combobox 
     2844        func.addItems([str(i) for i in range(shell_min, shell_max+1)]) 
    28252845 
    28262846        # Add default number of shells to the model 
    2827         func.setCurrentIndex(default_shell_count) 
    2828  
    2829     def modifyShellsInList(self, index): 
     2847        func.setCurrentText(str(default_shell_count)) 
     2848 
     2849    def modifyShellsInList(self, text): 
    28302850        """ 
    28312851        Add/remove additional multishell parameters 
     
    28342854        first_row = self._n_shells_row + 1 
    28352855        remove_rows = self._num_shell_params 
     2856        try: 
     2857            index = int(text) 
     2858        except ValueError: 
     2859            # bad text on the control! 
     2860            index = 0 
     2861            logger.error("Multiplicity incorrect! Setting to 0") 
    28362862 
    28372863        if remove_rows > 1: 
     
    28482874        self.current_shell_displayed = index 
    28492875 
    2850         # Change 'n' in the parameter model, thereby updating the underlying model 
     2876        # Param values for existing shells were reset to default; force all changes into kernel module 
     2877        for row in new_rows: 
     2878            par = row[0].text() 
     2879            val = GuiUtils.toDouble(row[1].text()) 
     2880            self.kernel_module.setParam(par, val) 
     2881 
     2882        # Change 'n' in the parameter model; also causes recalculation 
    28512883        self._model_model.item(self._n_shells_row, 1).setText(str(index)) 
    28522884 
Note: See TracChangeset for help on using the changeset viewer.