Changeset f9be147 in sasview


Ignore:
Timestamp:
Sep 20, 2018 8:25:53 AM (6 years ago)
Author:
ibressler
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
33d5956
Parents:
114c29f
git-author:
Ingo Breßler <dev@…> (09/20/18 08:24:59)
git-committer:
Ingo Breßler <dev@…> (09/20/18 08:25:53)
Message:

FittingWidget?.showTheoryPlot() should plot all matching items instead just one SASVIEW-1099

  • FittingWidget?._requestPlots() to handle basic behaviour of showPlot() and showTheoryPlot(), avoiding duplicate code
File:
1 edited

Legend:

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

    r114c29f rf9be147  
    18601860        """ 
    18611861        # Show the chart if ready 
    1862         data_to_show = self.model_data 
    18631862        if self.theory_item is None: 
    18641863            self.recalculatePlotData() 
    1865         else: 
    1866             self.communicate.plotRequestedSignal.emit([self.theory_item, data_to_show], self.tab_id) 
     1864            return 
     1865        if self.model_data: 
     1866            self._requestPlots(self.model_data.filename, self.theory_item.model()) 
    18671867 
    18681868    def showPlot(self): 
     
    18741874        # Any models for this page 
    18751875        current_index = self.all_data[self.data_index] 
    1876         fitpage_name = "" if id is None else "M"+str(self.tab_id) 
    1877         plots = GuiUtils.plotsFromFilename(self.data.filename, current_index.model()) 
     1876        item = self._requestPlots(self.data.filename, current_index.model()) 
     1877        if item: 
     1878            # fit+data has not been shown - show just data 
     1879            self.communicate.plotRequestedSignal.emit([item, data_to_show], self.tab_id) 
     1880 
     1881    def _requestPlots(self, item_name, item_model): 
     1882        """ 
     1883        Emits plotRequestedSignal for all plots found in the given model under the provided item name. 
     1884        """ 
     1885        fitpage_name = "" if self.tab_id is None else "M"+str(self.tab_id) 
     1886        plots = GuiUtils.plotsFromFilename(item_name, item_model) 
    18781887        # Has the fitted data been shown? 
    18791888        data_shown = False 
    1880         #for plot in plots: 
     1889        item = None 
    18811890        for item, plot in plots.items(): 
    18821891            if fitpage_name in plot.name: 
    18831892                data_shown = True 
    18841893                self.communicate.plotRequestedSignal.emit([item, plot], self.tab_id) 
    1885         if not data_shown: 
    1886             # fit+data has not been shown - show just data 
    1887             self.communicate.plotRequestedSignal.emit([item, data_to_show], self.tab_id) 
     1894        # return the last data item seen, if nothing was plotted; supposed to be just data) 
     1895        return None if data_shown else item 
    18881896 
    18891897    def onOptionsUpdate(self): 
Note: See TracChangeset for help on using the changeset viewer.