Changeset ec4a143 in sasview


Ignore:
Timestamp:
Oct 29, 2018 4:59:44 AM (2 weeks ago)
Author:
piotr
Branches:
ESS_GUI, ESS_GUI_project_save
Children:
7fb68060
Parents:
722b7d6
Message:

Allow magnetism for models with magnetic parameters defined. SASVIEW-1199

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

Legend:

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

    r75906a1 rec4a143  
    10101010        Checks if the current model has magnetic scattering implemented 
    10111011        """ 
    1012         current_model = self.cbModel.currentText() 
    1013         return self.is2D and current_model in self.MAGNETIC_MODELS 
     1012        has_params = False 
     1013        if self.kernel_module: 
     1014            has_mag_params = len(self.kernel_module.magnetic_params) > 0 
     1015        return self.is2D and has_mag_params 
    10141016 
    10151017    def onSelectModel(self): 
     
    10251027        if not model: 
    10261028            return 
    1027         self.chkMagnetism.setEnabled(self.canHaveMagnetism()) 
    1028         self.tabFitting.setTabEnabled(TAB_MAGNETISM, self.chkMagnetism.isChecked() and self.canHaveMagnetism()) 
    10291029 
    10301030        # Reset parameters to fit 
     
    11641164        self.SASModelToQModel(model, structure_factor) 
    11651165 
     1166        # Enable magnetism checkbox for selected models 
     1167        self.chkMagnetism.setEnabled(self.canHaveMagnetism()) 
     1168        self.tabFitting.setTabEnabled(TAB_MAGNETISM, self.chkMagnetism.isChecked() and self.canHaveMagnetism()) 
     1169 
     1170        # Update column widths 
    11661171        for column, width in self.lstParamHeaderSizes.items(): 
    11671172            self.lstParams.setColumnWidth(column, width) 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    rd2007a8 rec4a143  
    177177 
    178178        # test the model combo content 
    179         self.assertEqual(self.widget.cbModel.count(), 29) 
     179        self.assertEqual(self.widget.cbModel.count(), 28) 
    180180 
    181181        # Try to change back to default 
     
    183183 
    184184        # Observe no such luck 
    185         self.assertEqual(self.widget.cbCategory.currentIndex(), 7) 
     185        self.assertEqual(self.widget.cbCategory.currentIndex(), 6) 
    186186        self.assertEqual(self.widget.cbModel.count(), 29) 
    187187 
     
    215215        #  
    216216        # Now change the model 
    217         self.widget.cbModel.setCurrentIndex(3) 
     217        self.widget.cbModel.setCurrentIndex(2) 
    218218        self.assertEqual(self.widget.cbModel.currentText(),'dab') 
    219219 
Note: See TracChangeset for help on using the changeset viewer.