Ignore:
Timestamp:
Aug 24, 2017 5:36:00 AM (7 years ago)
Author:
lewis
Branches:
master, 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, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
13991957
Parents:
467068d
Message:

Ensure all P(Q) and S(Q) plot are updated correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/fitting.py

    r467068d r62a6a78  
    17621762            plot_ids = {} 
    17631763            for plot_panel in self.parent.plot_panels.values(): 
    1764                 for plot in plot_panel.plots.keys(): 
    1765                     if plot in plot_ids.keys(): 
    1766                         plot_ids[plot].append(plot_panel.group_id) 
     1764                for data_id in plot_panel.plots.keys(): 
     1765                    if data_id in plot_ids.keys(): 
     1766                        plot_ids[data_id].append(plot_panel.group_id) 
    17671767                    else: 
    1768                         plot_ids[plot] = [plot_panel.group_id] 
     1768                        plot_ids[data_id] = [plot_panel.group_id] 
    17691769            # Create/Update the theories 
    17701770            sq_id = str(page_id) + " " + data.name + " S(q)" 
     
    17791779            if sq_id in plot_ids.keys(): 
    17801780                # If the S(Q) theory has been plotted, update its plots 
     1781                sq_plot.list_group_id = plot_ids[sq_id] 
    17811782                for group_id in plot_ids[sq_id]: 
    1782                     sq_plot.group_id = group_id 
    1783                     wx.PostEvent(self.parent, NewPlotEvent(plot=sq_plot, 
    1784                         title=str(sq_plot.title))) 
     1783                    # Only create a copy of the data object if more than one plot of it exists 
     1784                    if len(plot_ids[sq_id]) > 1: 
     1785                        to_plot = deepcopy(sq_plot) 
     1786                    else: 
     1787                        to_plot = sq_plot 
     1788                    to_plot.group_id = group_id 
     1789                    wx.PostEvent(self.parent, NewPlotEvent(plot=to_plot, 
     1790                        title=str(to_plot.title), group_id=to_plot.group_id)) 
    17851791            if pq_id in plot_ids.keys(): 
    17861792                # If the P(Q) theory has been plotted, update its plots 
     1793                pq_plot.list_group_id = plot_ids[pq_id] 
    17871794                for group_id in plot_ids[pq_id]: 
    1788                     pq_plot.group_id = group_id 
    1789                     wx.PostEvent(self.parent, NewPlotEvent(plot=pq_plot, 
    1790                         title=str(pq_plot.title))) 
     1795                    # Only create a copy of the data object if more than one plot of it exists 
     1796                    if len(plot_ids[pq_id]) > 1: 
     1797                        to_plot = deepcopy(pq_plot) 
     1798                    else: 
     1799                        to_plot = pq_plot 
     1800                    to_plot.group_id = group_id 
     1801                    wx.PostEvent(self.parent, NewPlotEvent(plot=to_plot, 
     1802                        title=str(to_plot.title), group_id=to_plot.group_id)) 
    17911803 
    17921804        current_pg = self.fit_panel.get_page_by_id(page_id) 
Note: See TracChangeset for help on using the changeset viewer.