Ignore:
Timestamp:
Jan 18, 2018 9:44:26 AM (6 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:
ba01ad1
Parents:
2d466e4
Message:

Complex constraint widget updating the main constraint widget and fitting tabs

File:
1 edited

Legend:

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

    r2d466e4 rc5a2722f  
    601601        Return list of all parameters for the current model 
    602602        """ 
    603         #params = [] 
    604         #for row in range(self._model_model.rowCount()): 
    605         #    params.append(self._model_model.item(row).text()) 
    606         #return params 
    607603        return [self._model_model.item(row).text() for row in range(self._model_model.rowCount())] 
    608604 
     
    625621            self._model_model.item(row, column).setEditable(fields_enabled) 
    626622        self._model_model.blockSignals(False) 
     623 
     624    def addConstraintToRow(self, constraint=None, row=0): 
     625        """ 
     626        Adds the constraint object to requested row 
     627        """ 
     628        # Create a new item and add the Constraint object as a child 
     629        assert(isinstance(constraint, Constraint)) 
     630        assert(0<=row<=self._model_model.rowCount()) 
     631 
     632        item = QtGui.QStandardItem() 
     633        item.setData(constraint) 
     634        self._model_model.item(row, 1).setChild(0, item) 
     635        # Set min/max to the value constrained 
     636        self.constraintAddedSignal.emit([row]) 
     637        # Show visual hints for the constraint 
     638        font = QtGui.QFont() 
     639        font.setItalic(True) 
     640        brush = QtGui.QBrush(QtGui.QColor('blue')) 
     641        self.modifyViewOnRow(row, font=font, brush=brush) 
     642        self.communicate.statusBarUpdateSignal.emit('Constraint added') 
    627643 
    628644    def addSimpleConstraint(self): 
     
    759775            if func == value: 
    760776                return "" 
     777 
    761778            return model_name + "." 
    762779        params = [(self._model_model.item(s, 0).text(), 
    763                     preamble(s) +self._model_model.item(s, 1).child(0).data().func) 
     780                    #preamble(s) +self._model_model.item(s, 1).child(0).data().func) 
     781                    self._model_model.item(s, 1).child(0).data().func) 
    764782                    for s in range(param_number) if self.rowHasConstraint(s)] 
    765783        return params 
Note: See TracChangeset for help on using the changeset viewer.