Changeset c71b20a in sasview


Ignore:
Timestamp:
Sep 9, 2018 4:23:00 AM (6 years ago)
Author:
ibressler
Children:
8e674ccf
Parents:
2b8286c
git-author:
Ingo Breßler <dev@…> (09/09/18 03:45:26)
git-committer:
Ingo Breßler <dev@…> (09/09/18 04:23:00)
Message:

FittingWidget?: showing also new plots on recalc conditionally

  • cherry-picked from ESS_GUI_poly_plot branch
Location:
src/sas/qtgui
Files:
2 edited

Legend:

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

    r2b8286c rc71b20a  
    9595        self.communicator.activeGraphsSignal.connect(self.updateGraphCount) 
    9696        self.communicator.activeGraphName.connect(self.updatePlotName) 
    97         self.communicator.plotUpdateSignal.connect(self.updatePlot) 
     97        self.communicator.plotUpdateSignal.connect(self.displayData) 
    9898        self.communicator.maskEditorSignal.connect(self.showEditDataMask) 
    9999        self.communicator.extMaskEditorSignal.connect(self.extShowEditDataMask) 
     
    572572        # Each fitpage contains the name based on fit widget number 
    573573        fitpage_name = "" if id is None else "M"+str(id) 
    574         new_plots = [] 
     574        # groups plots which move into an own window 
     575        new_plots = dict(int = [], res = [], pd = []) 
    575576        for item, plot in plots.items(): 
    576577            if self.updatePlot(plot) and filename != plot.name: 
     
    578579            # Don't plot intermediate results, e.g. P(Q), S(Q) 
    579580            match = GuiUtils.theory_plot_ID_pattern.match(plot.id) 
    580             # 2nd match group contains the identifier for the intermediate result, if present (e.g. "[P(Q)]") 
     581            # 2nd match group contains the identifier for the intermediate 
     582            # result, if present (e.g. "[P(Q)]") 
    581583            if match and match.groups()[1] != None: 
    582584                continue 
     
    584586            if fitpage_name in plot.name or filename == plot.name: 
    585587                # 'sophisticated' test to generate standalone plot for residuals 
     588                # this should be done by some kind of grouping by lists 
     589                # which helps to indicate which go into a single plot window 
    586590                if 'esiduals' in plot.title: 
    587                     plot.yscale='linear' 
    588                     self.plotData([(item, plot)]) 
     591                    plot.yscale = 'linear' 
     592                    new_plots['res'].append((item, plot)) 
     593                elif 'olydispersity' in plot.title: 
     594                    plot.yscale = 'linear' 
     595                    new_plots['pd'].append((item, plot)) 
    589596                else: 
    590                     new_plots.append((item, plot)) 
    591  
    592         if new_plots: 
    593             self.plotData(new_plots) 
     597                    new_plots['int'].append((item, plot)) 
     598 
     599        # create entirely new plots for those which could not be updated 
     600        for plots in new_plots.values(): 
     601            if len(plots): 
     602                self.plotData(plots) 
    594603 
    595604    def displayData(self, data_list, id=None): 
     
    597606        Forces display of charts for the given data set 
    598607        """ 
    599         plot_to_show = data_list[0] 
    600         # passed plot is used ONLY to figure out its title, 
    601         # so all the charts related by it can be pulled from  
    602         # the data explorer indices. 
    603         filename = plot_to_show.filename 
    604         self.displayFile(filename=filename, is_data=plot_to_show.is_data, id=id) 
     608        for plot_to_show in data_list: 
     609            # may there be duplicates? list(OrderedDict.fromkeys(data_list)) 
     610            # passed plot is used ONLY to figure out its title, 
     611            # so all the charts related by it can be pulled from 
     612            # the data explorer indices. 
     613            filename = plot_to_show.filename 
     614            self.displayFile(filename=filename, is_data=plot_to_show.is_data, id=id) 
    605615 
    606616    def addDataPlot2D(self, plot_set, item): 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r0dcb71d rc71b20a  
    10881088            return True 
    10891089 
     1090    def updateDataVisibility(self, updateOnly): 
     1091        self.dataUpdateOnly = updateOnly 
     1092        for dataitem in self.all_data: 
     1093            data = GuiUtils.dataFromItem(dataitem) 
     1094            data.hidden = self.dataUpdateOnly 
     1095            self.updateModelIndex(data) 
     1096 
    10901097    def updateData(self): 
    10911098        """ 
     
    10931100        """ 
    10941101        # Update the chart 
     1102        self.updateDataVisibility(True) 
    10951103        if self.data_is_loaded: 
    10961104            self.cmdPlot.setText("Show Plot") 
     
    18131821        self.cmdPlot.setText("Show Plot") 
    18141822        # Force data recalculation so existing charts are updated 
    1815         self.showPlot() 
     1823#        self.showPlot() 
    18161824        # This is an important processEvent. 
    18171825        # This allows charts to be properly updated in order 
    18181826        # of plots being applied. 
    1819         QtWidgets.QApplication.processEvents() 
     1827#        QtWidgets.QApplication.processEvents() 
    18201828        self.recalculatePlotData() 
    18211829 
     
    22702278        Create a model or theory index with passed Data1D/Data2D 
    22712279        """ 
     2280        # set some flag which decides if new plots should be created or 
     2281        # just existing ones updated, selectively hiding indiv. plot will also work 
     2282        fitted_data.hidden = getattr(self, 'dataUpdateOnly', True) 
    22722283        if self.data_is_loaded: 
    22732284            if not fitted_data.name: 
     
    24402451        for plot in new_plots: 
    24412452            self.communicate.plotUpdateSignal.emit([plot]) 
     2453        # enable plots to be shown next time if updateData() wasn't called 
     2454        self.updateDataVisibility(False) 
    24422455 
    24432456    def complete2D(self, return_data): 
Note: See TracChangeset for help on using the changeset viewer.