Changeset d5c5d3d in sasview for src/sas


Ignore:
Timestamp:
Oct 17, 2017 3:25:17 PM (7 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:
f0bb711
Parents:
d6e5b31
Message:

Implemented new GUI for data operation panel

Location:
src/sas/qtgui
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/GUITests.py

    r01cda57 rd5c5d3d  
    3838from Calculators.UnitTesting import SlitSizeCalculatorTest 
    3939from Calculators.UnitTesting import ResolutionCalculatorPanelTest 
     40from Calculators.UnitTesting import DataOperationUtilityTest 
    4041 
    4142# Utilities 
     
    9495        unittest.makeSuite(SlitSizeCalculatorTest.SlitSizeCalculatorTest, 'test'), 
    9596        unittest.makeSuite(ResolutionCalculatorPanelTest.ResolutionCalculatorPanelTest, 'test'), 
     97        unittest.makeSuite(DataOperationUtilityTest.DataOperationUtilityTest, 'test'), 
    9698 
    9799        # Perspectives 
  • src/sas/qtgui/MainWindow/DataExplorer.py

    r7d8bebf rd5c5d3d  
    9393        self.communicator.activeGraphName.connect(self.updatePlotName) 
    9494        self.communicator.plotUpdateSignal.connect(self.updatePlot) 
     95 
    9596        self.cbgraph.editTextChanged.connect(self.enableGraphCombo) 
    9697        self.cbgraph.currentIndexChanged.connect(self.enableGraphCombo) 
     
    869870        self.txt_widget.setWindowIcon(QtGui.QIcon(":/res/ball.ico")) 
    870871        self.txt_widget.setWindowTitle("Data Info: %s" % data.filename) 
     872        self.txt_widget.clear() 
    871873        self.txt_widget.insertPlainText(text_to_show) 
    872874 
     
    10121014        self.model.appendRow(checkbox_item) 
    10131015 
    1014  
    10151016    def updateModelFromPerspective(self, model_item): 
    10161017        """ 
  • src/sas/qtgui/MainWindow/GuiManager.py

    r01cda57 rd5c5d3d  
    3131from sas.qtgui.Calculators.GenericScatteringCalculator import GenericScatteringCalculator 
    3232from sas.qtgui.Calculators.ResolutionCalculatorPanel import ResolutionCalculatorPanel 
    33  
     33from sas.qtgui.Calculators.DataOperationUtilityPanel import DataOperationUtilityPanel 
    3434 
    3535# Perspectives 
     
    4747    Main SasView window functionality 
    4848    """ 
     49 
    4950    def __init__(self, parent=None): 
    5051        """ 
     
    142143        self.GENSASCalculator = GenericScatteringCalculator(self) 
    143144        self.ResolutionCalculator = ResolutionCalculatorPanel(self) 
     145        self.DataOperation = DataOperationUtilityPanel(self) 
    144146 
    145147    def statusBarSetup(self): 
     
    337339        self.communicate.updateTheoryFromPerspectiveSignal.connect(self.updateTheoryFromPerspective) 
    338340        self.communicate.plotRequestedSignal.connect(self.showPlot) 
     341        self.communicate.updateModelFromDataOperationPanelSignal.connect(self.updateModelFromDataOperationPanel) 
    339342 
    340343    def addTriggers(self): 
     
    531534        """ 
    532535        """ 
    533         print("actionData_Operation TRIGGERED") 
    534         pass 
     536        self.communicate.sendDataToPanel.emit(self._data_manager.get_all_data()) 
     537 
     538        self.DataOperation.show() 
    535539 
    536540    def actionSLD_Calculator(self): 
     
    731735        self.filesWidget.updateTheoryFromPerspective(index) 
    732736 
     737    def updateModelFromDataOperationPanel(self, new_item, new_datalist_item): 
     738        """ 
     739        :param new_item: item to be added to list of loaded files 
     740        :param new_datalist_item: 
     741        """ 
     742        if not isinstance(new_item, QtGui.QStandardItem) or \ 
     743                not isinstance(new_datalist_item, dict): 
     744            msg = "Wrong data type returned from calculations." 
     745            raise AttributeError, msg 
     746 
     747        self.filesWidget.model.appendRow(new_item) 
     748        self._data_manager.add_data(new_datalist_item) 
     749 
    733750    def showPlot(self, plot): 
    734751        """ 
     
    737754        if hasattr(self, "filesWidget"): 
    738755            self.filesWidget.displayData(plot) 
    739  
  • src/sas/qtgui/Plotting/Plotter.py

    rfef38e8 rd5c5d3d  
    5858        self.title(title=value.name) 
    5959 
    60     def plot(self, data=None, color=None, marker=None, hide_error=False): 
     60    def plot(self, data=None, color=None, marker=None, hide_error=False, show_legend=True): 
    6161        """ 
    6262        Add a new plot of self._data to the chart. 
     
    145145 
    146146        # Now add the legend with some customizations. 
    147         self.legend = ax.legend(loc='upper right', shadow=True) 
    148         if self.legend: 
    149             self.legend.set_picker(True) 
     147        if show_legend: 
     148            self.legend = ax.legend(loc='upper right', shadow=True) 
     149            if self.legend: 
     150                self.legend.set_picker(True) 
    150151 
    151152        # Current labels for axes 
  • src/sas/qtgui/Plotting/Plotter2D.py

    r01cda57 rd5c5d3d  
    8787        self._item = item 
    8888 
    89     def plot(self, data=None, marker=None): 
     89    def plot(self, data=None, marker=None, show_colorbar=True): 
    9090        """ 
    9191        Plot 2D self._data 
     
    109109                      ymin=self.ymin, ymax=self.ymax, 
    110110                      cmap=self.cmap, zmin=zmin_2D_temp, 
    111                       zmax=zmax_2D_temp) 
     111                      zmax=zmax_2D_temp, show_colorbar=show_colorbar) 
    112112 
    113113    def calculateDepth(self): 
     
    379379 
    380380    def showPlot(self, data, qx_data, qy_data, xmin, xmax, ymin, ymax, 
    381                  zmin, zmax, label='data2D', cmap=DEFAULT_CMAP): 
     381                 zmin, zmax, label='data2D', cmap=DEFAULT_CMAP, show_colorbar=True): 
    382382        """ 
    383383        Render and show the current data 
     
    457457            self.vmax = cb.vmax 
    458458 
     459            if show_colorbar is False: 
     460                cb.remove() 
     461 
    459462        else: 
    460463            # clear the previous 2D from memory 
  • src/sas/qtgui/Utilities/GuiUtils.py

    re694f0f rd5c5d3d  
    230230    dataDeletedSignal = QtCore.pyqtSignal(list) 
    231231 
     232    # Send data to Data Operation Utility panel 
     233    sendDataToPanel = QtCore.pyqtSignal(dict) 
     234 
     235    # Send result of Data Operation Utility panel to Data Explorer 
     236    updateModelFromDataOperationPanelSignal = QtCore.pyqtSignal(QtGui.QStandardItem, dict) 
    232237 
    233238def updateModelItemWithPlot(item, update_data, name=""): 
     
    430435    text += 'X_min = %s:  X_max = %s\n' % (xmin, max(data.x)) 
    431436    text += 'Y_min = %s:  Y_max = %s\n' % (ymin, max(data.y)) 
    432     if data.dy != None: 
     437    if data.dy is not None: 
    433438        text += 'dY_min = %s:  dY_max = %s\n' % (min(data.dy), max(data.dy)) 
    434439    text += '\nData Points:\n' 
    435440    x_st = "X" 
    436441    for index in range(len(data.x)): 
    437         if data.dy != None and len(data.dy) > index: 
     442        if data.dy is not None and len(data.dy) > index: 
    438443            dy_val = data.dy[index] 
    439444        else: 
    440445            dy_val = 0.0 
    441         if data.dx != None and len(data.dx) > index: 
     446        if data.dx is not None and len(data.dx) > index: 
    442447            dx_val = data.dx[index] 
    443448        else: 
    444449            dx_val = 0.0 
    445         if data.dxl != None and len(data.dxl) > index: 
     450        if data.dxl is not None and len(data.dxl) > index: 
    446451            if index == 0: 
    447452                x_st = "Xl" 
    448453            dx_val = data.dxl[index] 
    449         elif data.dxw != None and len(data.dxw) > index: 
     454        elif data.dxw is not None and len(data.dxw) > index: 
    450455            if index == 0: 
    451456                x_st = "Xw" 
     
    486491        y_val = data.qy_data[index] 
    487492        i_val = data.data[index] 
    488         if data.err_data != None: 
     493        if data.err_data is not None: 
    489494            di_val = data.err_data[index] 
    490         if data.dqx_data != None: 
     495        if data.dqx_data is not None: 
    491496            dx_val = data.dqx_data[index] 
    492         if data.dqy_data != None: 
     497        if data.dqy_data is not None: 
    493498            dy_val = data.dqy_data[index] 
    494499 
  • src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py

    r464cd07 rd5c5d3d  
    6969            'progressBarUpdateSignal', 
    7070            'activeGraphName', 
     71            'sendDataToPanel', 
     72            'updateModelFromDataOperationPanelSignal' 
    7173        ] 
    7274 
     
    412414        self.assertEqual(yscale, "log") 
    413415 
     416 
    414417class FormulaValidatorTest(unittest.TestCase): 
    415418    """ Test the formula validator """ 
Note: See TracChangeset for help on using the changeset viewer.