Changeset 6cb305a in sasview


Ignore:
Timestamp:
Nov 29, 2017 5:39:41 AM (6 years ago)
Author:
celinedurniak <celine.durniak@…>
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:
fca1f50
Parents:
f4480f0
Message:

Fixed bugs related to plots, units, labels and data in DataExplorer? (SasView?-795, 796, 797)

Location:
src/sas/qtgui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py

    rd1955d67 r6cb305a  
    6363        self._model_item = QtGui.QStandardItem() 
    6464 
    65         #self._helpView = QtWebKit.QWebView() 
     65        self._helpView = QtWebKit.QWebView() 
    6666        self.detailsDialog = DetailsDialog(self) 
    6767        self.detailsDialog.cmdOK.clicked.connect(self.enabling) 
     
    8282        # no reason to have this widget resizable 
    8383        self.resize(self.minimumSizeHint()) 
    84         #self.setFixedSize(self.sizeHint()) 
    8584 
    8685        self.communicate = self._manager.communicator() 
     
    232231        # Send the modified model item to DE for keeping in the model 
    233232        # Currently -unused 
    234         #self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item) 
     233        # self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item) 
    235234 
    236235        plot_data = GuiUtils.plotsFromCheckedItems(self._manager.filesWidget.model) 
     
    365364            if self._high_extrapolate: 
    366365                # for presentation in InvariantDetails 
    367                 qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) # self._data.x) 
     366                qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) 
    368367 
    369368                if qmax_plot > Q_MAXIMUM: 
  • src/sas/qtgui/Utilities/GuiUtils.py

    rcb4d219 r6cb305a  
    5858    # clean all these module variables and put them into a config class 
    5959    # that can be passed by sasview.py. 
    60     #logging.info(sys.executable) 
    61     #logging.info(str(sys.argv)) 
     60    # logging.info(sys.executable) 
     61    # logging.info(str(sys.argv)) 
    6262    from sas import sasview as sasview 
    6363    app_path = os.path.dirname(sasview.__file__) 
    64     #logging.info("Using application path: %s", app_path) 
     64    # logging.info("Using application path: %s", app_path) 
    6565    return app_path 
    6666 
     
    249249        if plot_item.isCheckable(): 
    250250            plot_data = plot_item.child(0).data() 
    251             if plot_data.id is not None and plot_data.id == update_data.id: 
     251            if plot_data.id is not None and \ 
     252                   (plot_data.name == update_data.name or plot_data.id == update_data.id): 
     253            # if plot_data.id is not None and plot_data.id == update_data.id: 
    252254                # replace data section in item 
    253255                plot_item.child(0).setData(update_data) 
     
    343345    for index in range(model_item.rowCount()): 
    344346        item = model_item.item(index) 
    345         if item.text() == filename and item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 
     347        if item.text() == filename and item.isCheckable() \ 
     348                and item.checkState() == QtCore.Qt.Checked: 
    346349            # Going 1 level deeper only 
    347350            for index_2 in range(item.rowCount()): 
     
    360363 
    361364    # Iterate over model looking for named items 
    362     item = list([i for i in [model_item.item(index) for index in range(model_item.rowCount())] if str(i.text()) == filename]) 
     365    item = list([i for i in [model_item.item(index) 
     366                             for index in range(model_item.rowCount())] 
     367                 if str(i.text()) == filename]) 
    363368    return item[0] if len(item)>0 else None 
    364369 
     
    396401    for index in range(model_item.rowCount()): 
    397402        item = model_item.item(index) 
    398         if item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 
    399             # TODO: assure item type is correct (either data1/2D or Plotter) 
    400             plot_data.append((item, item.child(0).data())) 
     403 
    401404        # Going 1 level deeper only 
    402405        for index_2 in range(item.rowCount()): 
     
    405408                # TODO: assure item type is correct (either data1/2D or Plotter) 
    406409                plot_data.append((item_2, item_2.child(0).data())) 
     410 
     411        if item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 
     412            # TODO: assure item type is correct (either data1/2D or Plotter) 
     413            plot_data.append((item, item.child(0).data())) 
    407414 
    408415    return plot_data 
  • src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py

    r0261bc1 r6cb305a  
    100100        Test the QModelItem checkbox update method 
    101101        """ 
     102        # test_item = QtGui.QStandardItem() 
     103        # test_list = ['aa','11'] 
     104        # update_data = test_list 
     105        # name = "Black Sabbath" 
     106 
     107        # # update the item 
     108        # updateModelItemWithPlot(test_item, update_data, name) 
     109 
    102110        test_item = QtGui.QStandardItem() 
    103         test_list = ['aa','11'] 
    104         update_data = test_list 
     111        update_data = Data1D(x=[1.0, 2.0, 3.0], y=[10.0, 11.0, 12.0]) 
    105112        name = "Black Sabbath" 
    106  
     113        update_data.id = '[0]data0' 
     114        update_data.name = 'data0' 
    107115        # update the item 
    108116        updateModelItemWithPlot(test_item, update_data, name) 
    109          
     117 
    110118        # Make sure test_item got all data added 
    111119        self.assertEqual(test_item.child(0).text(), name) 
    112120        self.assertTrue(test_item.child(0).isCheckable()) 
    113         list_from_item = test_item.child(0).child(0).data() 
    114         self.assertIsInstance(list_from_item, list) 
    115         self.assertEqual(str(list_from_item[0]), test_list[0]) 
    116         self.assertEqual(str(list_from_item[1]), test_list[1]) 
     121        data_from_item = test_item.child(0).child(0).data() 
     122        self.assertIsInstance(data_from_item, Data1D) 
     123        self.assertSequenceEqual(list(data_from_item.x), [1.0, 2.0, 3.0]) 
     124        self.assertSequenceEqual(list(data_from_item.y), [10.0, 11.0, 12.0]) 
     125        self.assertEqual(test_item.rowCount(), 1) 
     126 
     127        # add another dataset (different from the first one) 
     128        update_data1 = Data1D(x=[1.1, 2.1, 3.1], y=[10.1, 11.1, 12.1]) 
     129        update_data1.id = '[0]data1' 
     130        update_data1.name = 'data1' 
     131        name1 = "Black Sabbath1" 
     132        # update the item and check number of rows 
     133        updateModelItemWithPlot(test_item, update_data1, name1) 
     134 
     135        self.assertEqual(test_item.rowCount(), 2) 
     136 
     137        # add another dataset (with the same name as the first one) 
     138        # check that number of rows was not changed but data have been updated 
     139        update_data2 = Data1D(x=[4.0, 5.0, 6.0], y=[13.0, 14.0, 15.0]) 
     140        update_data2.id = '[1]data0' 
     141        update_data2.name = 'data0' 
     142        name2 = "Black Sabbath2" 
     143        updateModelItemWithPlot(test_item, update_data2, name2) 
     144        self.assertEqual(test_item.rowCount(), 2) 
     145 
     146        data_from_item = test_item.child(0).child(0).data() 
     147        self.assertSequenceEqual(list(data_from_item.x), [4.0, 5.0, 6.0]) 
     148        self.assertSequenceEqual(list(data_from_item.y), [13.0, 14.0, 15.0]) 
    117149 
    118150 
     
    162194        # Make sure only the checked data is present 
    163195        # FRIDAY IN 
    164         self.assertIn(test_list0, plot_list[0]) 
     196        self.assertIn(test_list0, plot_list[1]) 
    165197        # SATURDAY IN 
    166         self.assertIn(test_list1, plot_list[1]) 
     198        self.assertIn(test_list1, plot_list[0]) 
    167199        # MONDAY NOT IN 
    168200        self.assertNotIn(test_list2, plot_list[0]) 
Note: See TracChangeset for help on using the changeset viewer.