Changeset 7d077d1 in sasview for src/sas


Ignore:
Timestamp:
Mar 31, 2017 3:29:50 AM (8 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:
0274aea
Parents:
0268aed
Message:

When chart is shown - react and show changes to Qmodel

Location:
src/sas/qtgui
Files:
5 edited

Legend:

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

    r0268aed r7d077d1  
    4949 
    5050        # Active plots 
    51         self.active_plots = [] 
     51        self.active_plots = {} 
    5252 
    5353        # Connect the buttons 
     
    8787        self.communicator.activeGraphsSignal.connect(self.updateGraphCombo) 
    8888        self.communicator.activeGraphName.connect(self.updatePlotName) 
     89        self.communicator.plotUpdateSignal.connect(self.updatePlot) 
    8990        self.cbgraph.editTextChanged.connect(self.enableGraphCombo) 
    9091        self.cbgraph.currentIndexChanged.connect(self.enableGraphCombo) 
     
    473474 
    474475        # Update the active chart list 
    475         self.active_plots.append(title) 
     476        self.active_plots[new_plot.data.id] = new_plot 
     477        print "ADDING ", new_plot.data.id 
    476478 
    477479    def appendPlot(self): 
     
    494496                old_plot.data = plot_set 
    495497                old_plot.plot() 
     498 
     499    def updatePlot(self, new_data): 
     500        """ 
     501        Modify existing plot for immediate response 
     502        """ 
     503        data = new_data[0] 
     504        assert type(data).__name__ in ['Data1D', 'Data2D'] 
     505 
     506        id = data.id 
     507        if data.id in self.active_plots.keys(): 
     508            self.active_plots[id].replacePlot(id, data) 
    496509 
    497510    def chooseFiles(self): 
     
    940953        # Reset the view 
    941954        self.model.reset() 
    942  
    943955        # Pass acting as a debugger anchor 
    944956        pass 
  • src/sas/qtgui/GuiUtils.py

    r5236449 r7d077d1  
    228228    plotRequestedSignal = QtCore.pyqtSignal(str) 
    229229 
     230    # Plot update requested from a perspective 
     231    plotUpdateSignal = QtCore.pyqtSignal(list) 
     232 
    230233    # Progress bar update value 
    231234    progressBarUpdateSignal = QtCore.pyqtSignal(int) 
     
    255258        if plot_item.isCheckable(): 
    256259            plot_data = plot_item.child(0).data().toPyObject() 
    257             if plot_data.id == py_update_data.id: 
    258                 item.removeRow(index) 
    259                 break 
     260            if plot_data.id is not None and plot_data.id == py_update_data.id: 
     261                # replace data section in item 
     262                plot_item.child(0).setData(update_data) 
     263                plot_item.setText(name) 
     264                # Force redisplay 
     265                return 
    260266 
    261267    # Create the new item 
  • src/sas/qtgui/Perspectives/Fitting/FittingLogic.py

    r0268aed r7d077d1  
    103103        self._data.ymax = ymax 
    104104 
    105     def new1DPlot(self, return_data): 
     105    def new1DPlot(self, return_data, tab_id): 
    106106        """ 
    107107        Create a new 1D data instance based on fitting results 
     
    121121 
    122122        new_plot.group_id = data.group_id 
    123         #new_plot.id = str(self.tab_id) + " " + data.name 
     123        new_plot.id = str(tab_id) + " " + data.name 
    124124        new_plot.name = model.name + " [" + data.name + "]" 
    125125        new_plot.title = new_plot.name 
     
    135135        Create a new 2D data instance based on fitting results 
    136136        """ 
    137  
    138137        image, data, page_id, model, state, toggle_mode_on,\ 
    139138        elapsed, index, fid, qmin, qmax, weight, \ 
  • src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py

    r0268aed r7d077d1  
    224224def residualsData1D(reference_data, current_data): 
    225225    """ 
     226    Calculate the residuals for difference of two Data1D sets 
    226227    """ 
    227228    # temporary default values for index and weight 
     
    265266def residualsData2D(reference_data, current_data): 
    266267    """ 
     268    Calculate the residuals for difference of two Data2D sets 
    267269    """ 
    268270    # temporary default values for index and weight 
     
    304306    data_copy = deepcopy(current_data) 
    305307    # Get data: data I, theory I, and data dI in order 
    306  
    307308    method_name = current_data.__class__.__name__ 
    308309    residuals_dict = {"Data1D": residualsData1D, 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r0268aed r7d077d1  
    586586        # multishell params in self.kernel_module.details[??] = value 
    587587 
     588        # Force the chart update 
     589        self.onPlot() 
     590 
    588591    def nameForFittedData(self, name): 
    589592        """ 
     
    605608                fitted_data.name = name 
    606609                fitted_data.filename = name 
     610                fitted_data.symbol = "Line" 
    607611            self.updateModelIndex(fitted_data) 
    608612        else: 
     
    625629            name = fitted_data.name 
    626630        # Make this a line if no other defined 
    627         if fitted_data.symbol is None: 
     631        if hasattr(fitted_data, 'symbol') and fitted_data.symbol is None: 
    628632            fitted_data.symbol = 'Line' 
    629633        # Notify the GUI manager so it can update the main model in DataExplorer 
    630634        GuiUtils.updateModelItemWithPlot(self._index, QtCore.QVariant(fitted_data), name) 
     635        # Force redisplay 
    631636 
    632637    def createTheoryIndex(self, fitted_data): 
     
    680685        Plot the current 1D data 
    681686        """ 
    682         fitted_plot = self.logic.new1DPlot(return_data) 
     687        fitted_plot = self.logic.new1DPlot(return_data, self.tab_id) 
    683688        self.calculateResiduals(fitted_plot) 
    684689 
     
    695700        """ 
    696701        # Create a new index for holding data 
     702        fitted_data.symbol = "Line" 
    697703        self.createNewIndex(fitted_data) 
    698704        # Calculate difference between return_data and logic.data 
     
    704710        if self.data_is_loaded: 
    705711            residuals_plot = FittingUtilities.plotResiduals(self.data, fitted_data) 
     712            residuals_plot.id = "Residual " + residuals_plot.id 
    706713            self.createNewIndex(residuals_plot) 
     714 
     715        self.communicate.plotUpdateSignal.emit([fitted_data]) 
    707716 
    708717    def calcException(self, etype, value, tb): 
Note: See TracChangeset for help on using the changeset viewer.