Changes in / [aae5f4c:f41024f] in sasview


Ignore:
Location:
src/sas/qtgui/Perspectives/Fitting
Files:
3 edited

Legend:

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

    rf7d14a1 re00b76e  
    644644            return 
    645645 
    646         property_index = self._magnet_model.headerData(1, model_column).toInt()[0]-1 # Value, min, max, etc. 
     646        property_index = self._magnet_model.headerData(0, 1, model_column).toInt()[0]-1 # Value, min, max, etc. 
    647647 
    648648        # Update the parameter value - note: this supports +/-inf as well 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    rf7d14a1 r9ea43c82  
    100100        delegate = fittingWindow.lstPoly.itemDelegate() 
    101101        self.assertEqual(len(delegate.POLYDISPERSE_FUNCTIONS), 5) 
    102         self.assertEqual(delegate.editableParameters(), [2, 3, 4, 5]) 
     102        self.assertEqual(delegate.editableParameters(), [1, 2, 3, 4, 5]) 
    103103        self.assertEqual(delegate.poly_function, 6) 
     104        self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal) 
     105 
     106    def testSelectMagnetism(self): 
     107        """ 
     108        Test if models have been loaded properly 
     109        """ 
     110        fittingWindow =  self.widget 
     111 
     112        self.assertIsInstance(fittingWindow.lstMagnetic.itemDelegate(), QtGui.QStyledItemDelegate) 
     113        #Test loading from json categories 
     114        fittingWindow.SASModelToQModel("cylinder") 
     115        mag_index = fittingWindow.lstMagnetic.model().index(0,0) 
     116        self.assertEqual(str(mag_index.data().toString()), "up:frac_i") 
     117        mag_index = fittingWindow.lstMagnetic.model().index(1,0) 
     118        self.assertEqual(str(mag_index.data().toString()), "up:frac_f") 
     119        mag_index = fittingWindow.lstMagnetic.model().index(2,0) 
     120        self.assertEqual(str(mag_index.data().toString()), "up:angle") 
     121        mag_index = fittingWindow.lstMagnetic.model().index(3,0) 
     122        self.assertEqual(str(mag_index.data().toString()), "M0:sld") 
     123        mag_index = fittingWindow.lstMagnetic.model().index(4,0) 
     124        self.assertEqual(str(mag_index.data().toString()), "mtheta:sld") 
     125        mag_index = fittingWindow.lstMagnetic.model().index(5,0) 
     126        self.assertEqual(str(mag_index.data().toString()), "mphi:sld") 
     127        mag_index = fittingWindow.lstMagnetic.model().index(6,0) 
     128        self.assertEqual(str(mag_index.data().toString()), "M0:sld_solvent") 
     129        mag_index = fittingWindow.lstMagnetic.model().index(7,0) 
     130        self.assertEqual(str(mag_index.data().toString()), "mtheta:sld_solvent") 
     131        mag_index = fittingWindow.lstMagnetic.model().index(8,0) 
     132        self.assertEqual(str(mag_index.data().toString()), "mphi:sld_solvent") 
     133 
     134        # test the delegate a bit 
     135        delegate = fittingWindow.lstMagnetic.itemDelegate() 
     136        self.assertEqual(delegate.editableParameters(), [1, 2, 3]) 
    104137        self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal) 
    105138 
  • src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py

    r7ffa5ee9 r02f1d12  
    219219 
    220220    def editableParameters(self): 
    221         return [self.mag_min, self.mag_max] 
     221        return [self.mag_value, self.mag_min, self.mag_max] 
    222222 
    223223    def addErrorColumn(self): 
Note: See TracChangeset for help on using the changeset viewer.