Changeset 428c3b2 in sasview


Ignore:
Timestamp:
Sep 26, 2018 4:50:56 AM (6 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
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:
009c7a4
Parents:
8eea1b1
git-author:
Piotr Rozyczko <piotr.rozyczko@…> (09/26/18 04:49:19)
git-committer:
Piotr Rozyczko <piotr.rozyczko@…> (09/26/18 04:50:56)
Message:

Pay attention to 2D charts lifetime. SASVIEW-1175

File:
1 edited

Legend:

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

    r6ae7466 r428c3b2  
    624624        new_plots = [] 
    625625 
     626        # Get the main data plot 
     627        main_data = GuiUtils.dataFromItem(plot_item.parent()) 
     628        if main_data is None: 
     629            # Try the current item 
     630            main_data = GuiUtils.dataFromItem(plot_item) 
     631 
     632        # Make sure main data for 2D is always displayed 
     633        if main_data and not self.isPlotShown(main_data): 
     634            if isinstance(main_data, Data2D): 
     635                self.plotData([(plot_item, main_data)]) 
     636 
    626637        # Check if this is merely a plot update 
    627638        if self.updatePlot(plot_to_show): 
     
    638649            # Plots with main data points on the same chart 
    639650            # Get the main data plot 
    640             main_data = GuiUtils.dataFromItem(plot_item.parent()) 
    641             if main_data is None: 
    642                 # Try the current item 
    643                 main_data = GuiUtils.dataFromItem(plot_item) 
    644             if main_data is not None: 
     651            if main_data and not self.isPlotShown(main_data): 
    645652                new_plots.append((plot_item, main_data)) 
    646653            new_plots.append((plot_item, plot_to_show)) 
     
    648655        if new_plots: 
    649656            self.plotData(new_plots) 
     657 
     658    def isPlotShown(self, plot): 
     659        """ 
     660        Checks currently shown plots and returns true if match 
     661        """ 
     662        if not hasattr(plot, 'name'): 
     663            return False 
     664        ids_vals = [val.data.name for val in self.active_plots.values()] 
     665 
     666        return plot.name in ids_vals 
    650667 
    651668    def addDataPlot2D(self, plot_set, item): 
Note: See TracChangeset for help on using the changeset viewer.