Ignore:
File:
1 edited

Legend:

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

    r60d55a7 rfd7ef36  
    560560        # Now query the model item for available plots 
    561561        plots = GuiUtils.plotsFromFilename(filename, model) 
     562        ids_keys = list(self.active_plots.keys()) 
     563        ids_vals = [val.data.id for val in self.active_plots.values()] 
    562564 
    563565        new_plots = [] 
    564566        for item, plot in plots.items(): 
    565             if not self.updatePlot(plot): 
     567            plot_id = plot.id 
     568            if plot_id in ids_keys: 
     569                self.active_plots[plot_id].replacePlot(plot_id, plot) 
     570            elif plot_id in ids_vals: 
     571                list(self.active_plots.values())[ids_vals.index(plot_id)].replacePlot(plot_id, plot) 
     572            else: 
    566573                # Don't plot intermediate results, e.g. P(Q), S(Q) 
    567                 match = GuiUtils.theory_plot_ID_pattern.match(plot.id) 
     574                match = GuiUtils.theory_plot_ID_pattern.match(plot_id) 
    568575                # 2nd match group contains the identifier for the intermediate result, if present (e.g. "[P(Q)]") 
    569576                if match and match.groups()[1] != None: 
     
    699706                self.active_plots[plot_set.id] = old_plot 
    700707 
    701     def updatePlot(self, data): 
    702         """ 
    703         Modify existing plot for immediate response and returns True. 
    704         Returns false, if the plot does not exist already. 
    705         """ 
    706         try: # there might be a list or a single value being passed 
    707             data = data[0] 
    708         except TypeError: 
    709             pass 
     708    def updatePlot(self, new_data): 
     709        """ 
     710        Modify existing plot for immediate response 
     711        """ 
     712        data = new_data[0] 
    710713        assert type(data).__name__ in ['Data1D', 'Data2D'] 
    711714 
     
    716719        if data_id in ids_keys: 
    717720            self.active_plots[data_id].replacePlot(data_id, data) 
    718             return True 
    719721        elif data_id in ids_vals: 
    720722            list(self.active_plots.values())[ids_vals.index(data_id)].replacePlot(data_id, data) 
    721             return True 
    722         return False 
    723723 
    724724    def chooseFiles(self): 
Note: See TracChangeset for help on using the changeset viewer.