Changeset 98b13f72 in sasview


Ignore:
Timestamp:
Apr 21, 2017 9:38:11 AM (8 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:
180bd54
Parents:
e1e3e09
Message:

More smearing functionality

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

Legend:

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

    re1e3e09 r98b13f72  
    197197        self.chkMagnetism.setEnabled(True) 
    198198 
    199         # Weighting and smearing controls 
     199        # Weighting controls 
    200200        if self.is2D: 
    201             #self.slit_smearer.Disable() 
    202             #self.pinhole_smearer.Enable(True) 
    203             #self.default_mask = copy.deepcopy(self.data.mask) 
    204201            if self.logic.data.err_data is None or\ 
    205202                    numpy.all(err == 1 for err in self.logic.data.err_data) or \ 
     
    211208                self.rbWeighting2.setChecked(True) 
    212209        else: 
    213             #self.slit_smearer.Enable(True) 
    214             #self.pinhole_smearer.Enable(True) 
    215210            if self.logic.data.dy is None or\ 
    216211                    numpy.all(self.logic.data.dy == 1) or\ 
     
    305300        self.cbCategory.currentIndexChanged.connect(self.onSelectCategory) 
    306301        self.cbModel.currentIndexChanged.connect(self.onSelectModel) 
    307         #self.cbSmearing.currentIndexChanged.connect(self.onSelectSmearing) 
    308302        # Checkboxes 
    309303        self.chk2DView.toggled.connect(self.toggle2D) 
     
    320314        self.txtMinRange.editingFinished.connect(self.onMinRange) 
    321315        self.txtMaxRange.editingFinished.connect(self.onMaxRange) 
    322         #self.txtSmearUp.editingFinished.connect(self.onSmearUp) 
    323         #self.txtSmearDown.editingFinished.connect(self.onSmearDown) 
    324316        # Button groups 
    325317        self.weightingGroup.buttonClicked.connect(self.onWeightingChoice) 
     
    399391        # Populate the models combobox 
    400392        self.cbModel.addItems(sorted([model for (model, _) in model_list])) 
    401  
    402     def onSelectSmearing(self): 
    403         """ 
    404         Select Smearing type from list 
    405         """ 
    406         pass 
    407  
    408     def onSmearUp(self): 
    409         """ 
    410         Update state based on entered smear value 
    411         """ 
    412         pass 
    413  
    414     def onSmearDown(self): 
    415         """ 
    416         Update state based on entered smear value 
    417         """ 
    418         pass 
    419393 
    420394    def onWeightingChoice(self, button): 
     
    476450        # Potential weights added 
    477451        self.addWeightingToData(data) 
     452 
     453        # Potential smearing added 
     454        smearing, accuracy, smearing_min, smearing_max = self.smearing_widget.state() 
    478455 
    479456        # These should be updating somehow? 
  • src/sas/qtgui/Perspectives/Fitting/SmearingWidget.py

    re1e3e09 r98b13f72  
    1212 
    1313class DataWidgetMapper(QtGui.QDataWidgetMapper): 
     14    """ 
     15    Custom version of the standard QDataWidgetMapper allowing for proper 
     16    response to index change in comboboxes 
     17    """ 
    1418    def addMapping(self, widget, section, propertyName=None): 
    1519        if propertyName is None: 
     
    3640 
    3741        self.setupUi(self) 
     42 
     43        # Have we loaded data yet? If so, what kind 
     44        self.is_data = None 
     45        # Local model for holding data 
     46        self.model = None 
     47        # Mapper for model update 
     48        self.mapper = None 
     49 
     50        # Let only floats in the line edits 
     51        self.txtSmearDown.setValidator(QtGui.QDoubleValidator()) 
     52        self.txtSmearUp.setValidator(QtGui.QDoubleValidator()) 
     53 
     54        # Attach slots 
    3855        self.cbSmearing.currentIndexChanged.connect(self.onIndexChange) 
    3956        self.cbSmearing.setCurrentIndex(0) 
    40         self.is_data = None 
    41         self.model = None 
    42         self.mapper = None 
    4357 
    4458        self.initModel() 
     
    5266        for model_item in xrange(len(MODEL)): 
    5367            self.model.setItem(model_item, QtGui.QStandardItem()) 
    54  
     68        # Attach slot 
    5569        self.model.dataChanged.connect(self.onModelChange) 
    56  
    57         ##self.modelReset() 
    5870 
    5971    def initMapper(self): 
     
    6173        Initialize model item <-> UI element mapping 
    6274        """ 
    63         #self.mapper = QtGui.QDataWidgetMapper(self) 
    6475        self.mapper = DataWidgetMapper(self) 
    6576 
     
    107118    def onModelChange(self, top, bottom): 
    108119        """ 
     120        Respond to model change by updating 
    109121        """ 
    110         print "MODEL CHANGED: ", top, bottom 
     122        print "MODEL CHANGED for property: %s. The value is now: %s" % \ 
     123            (MODEL[top.row()], str(self.model.item(top.row()).text())) 
    111124        pass 
    112125 
     
    150163        Returns current state of controls 
    151164        """ 
    152          
     165        # or model-held values 
     166        smearing = str(self.model.item(MODEL.index('SMEARING')).text()) 
     167        accuracy = str(self.model.item(MODEL.index('ACCURACY')).text()) 
     168        d_down = float(self.model.item(MODEL.index('PINHOLE_MIN')).text()) 
     169        d_up = float(self.model.item(MODEL.index('PINHOLE_MAX')).text()) 
     170 
     171        return (smearing, accuracy, d_down, d_up) 
Note: See TracChangeset for help on using the changeset viewer.