Changeset 8222f171 in sasview for src/sas/qtgui/Perspectives/Fitting


Ignore:
Timestamp:
Sep 5, 2017 4:18:07 AM (7 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:
9909967
Parents:
4d1eff2
Message:

SASVIEW-625: code review fixes. Corrected handling for cancelling the file open dialog, updated test cases.

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

Legend:

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

    • Property mode changed from 100755 to 100644
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    re43fc91 r8222f171  
    3939from sas.qtgui.Perspectives.Fitting.ViewDelegate import PolyViewDelegate 
    4040from sas.qtgui.Perspectives.Fitting.ViewDelegate import MagnetismViewDelegate 
     41 
    4142 
    4243TAB_MAGNETISM = 4 
     
    181182        self.page_stack = [] 
    182183        self.all_data = [] 
     184        # Polydisp widget table default index for function combobox 
     185        self.orig_poly_index = 3 
    183186 
    184187        # Data for chosen model 
     
    15611564        # For the given row, invoke the "array" combo handler 
    15621565        array_caption = 'array' 
    1563         self.onPolyComboIndexChange(array_caption, row_index) 
     1566 
    15641567        # Get the combo box reference 
    15651568        ind = self._poly_model.index(row_index, self.lstPoly.itemDelegate().poly_function) 
    15661569        widget = self.lstPoly.indexWidget(ind) 
     1570 
    15671571        # Update the combo box so it displays "array" 
    15681572        widget.blockSignals(True) 
     
    15701574        widget.blockSignals(False) 
    15711575 
     1576        # Invoke the file reader 
     1577        self.onPolyComboIndexChange(array_caption, row_index) 
     1578 
    15721579    def onPolyComboIndexChange(self, combo_string, row_index): 
    15731580        """ 
     
    15781585        file_index = self._poly_model.index(row_index, self.lstPoly.itemDelegate().poly_function) 
    15791586        combo_box = self.lstPoly.indexWidget(file_index) 
    1580         orig_index = combo_box.currentIndex() 
    15811587 
    15821588        def updateFunctionCaption(row): 
     
    15991605                return 
    16001606            except IOError: 
    1601                 combo_box.setCurrentIndex(orig_index) 
     1607                combo_box.setCurrentIndex(self.orig_poly_index) 
    16021608                # Pass for cancel/bad read 
    16031609                pass 
     
    16211627 
    16221628        self.iterateOverModel(updateFunctionCaption) 
     1629        self.orig_poly_index = combo_box.currentIndex() 
    16231630 
    16241631    def loadPolydispArray(self, row_index): 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    r464cd07 r8222f171  
    9999        # test the delegate a bit 
    100100        delegate = fittingWindow.lstPoly.itemDelegate() 
    101         self.assertEqual(len(delegate.POLYDISPERSE_FUNCTIONS), 4) 
     101        self.assertEqual(len(delegate.POLYDISPERSE_FUNCTIONS), 5) 
    102102        self.assertEqual(delegate.editableParameters(), [2, 3, 4, 5]) 
    103103        self.assertEqual(delegate.poly_function, 6) 
     
    337337        # Check the poly model 
    338338        self.assertEqual(self.widget._poly_model.rowCount(), 4) 
    339         self.assertEqual(self.widget._poly_model.columnCount(), 7) 
     339        self.assertEqual(self.widget._poly_model.columnCount(), 8) 
    340340 
    341341        # Test the header 
    342         self.assertEqual(self.widget.lstPoly.horizontalHeader().count(), 7) 
     342        self.assertEqual(self.widget.lstPoly.horizontalHeader().count(), 8) 
    343343        self.assertFalse(self.widget.lstPoly.horizontalHeader().stretchLastSection()) 
    344344 
     
    346346        for row in xrange(self.widget._poly_model.rowCount()): 
    347347            func_index = self.widget._poly_model.index(row, 6) 
    348             #self.assertTrue(isinstance(self.widget.lstPoly.indexWidget(func_index), QtGui.QComboBox)) 
     348            self.assertTrue(isinstance(self.widget.lstPoly.indexWidget(func_index), QtGui.QComboBox)) 
    349349            self.assertIn('Distribution of', self.widget._poly_model.item(row, 0).text()) 
    350350        #self.widget.close() 
Note: See TracChangeset for help on using the changeset viewer.