Changeset 1a2dc10 in sasview


Ignore:
Timestamp:
Jan 21, 2010 5:21:12 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
1702180
Parents:
91db958
Message:

add a way to delete a graph for invariant

Location:
sansview/perspectives/fitting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/fitting.py

    r662da312 r1a2dc10  
    524524        self.parent._mgr.Update() 
    525525                
     526   
    526527    def _compute_invariant(self, event):     
    527528        """ 
     
    537538                print "_compute_invariant" ,data._yunit 
    538539                from invariant_panel import InvariantWindow 
    539                 frame = InvariantWindow(base=self.parent, data=plottable)    
     540                frame = InvariantWindow(base=self.parent, data=plottable, graph=self.panel.graph)    
    540541                frame.Show(True) 
    541542                #from invariant_panel import InvariantDialog 
  • sansview/perspectives/fitting/invariant_panel.py

    rdeeba75 r1a2dc10  
    4949    ## Flag to tell the AUI manager to put this panel in the center pane 
    5050    CENTER_PANE = True 
    51     def __init__(self, parent, data=None, base=None): 
     51    def __init__(self, parent, graph, data=None, base=None): 
    5252        wx.ScrolledWindow.__init__(self, parent, style= wx.FULL_REPAINT_ON_RESIZE ) 
    5353        #Font size  
     
    5555        #Object that receive status event 
    5656        self.parent = base 
    57        
     57        self.graph = graph 
    5858        #Default power value 
    5959        self.power_law_exponant = 4  
     
    8383                                      background=float(background), 
    8484                                       scale=float(scale)) 
    85              
    86             low_q = self.enable_low_cbox.GetValue()  
    87             high_q = self.enable_high_cbox.GetValue() 
    8885             
    8986            #Get the number of points to extrapolated 
     
    112109            #check the type of extrapolation 
    113110            extrapolation = None 
     111            low_q = self.enable_low_cbox.GetValue() 
     112            high_q = self.enable_high_cbox.GetValue() 
    114113            if low_q  and not high_q: 
    115114                extrapolation = "low" 
     
    138137            #Compute qstar extrapolated to low q range 
    139138            #Clear the previous extrapolated plot 
    140             self._plot_data( name=self.data.name+" Extra_low_Q") 
    141             self._plot_data( name=self.data.name+" Extra_high_Q") 
     139        
    142140            if low_q: 
    143141                try:  
     
    214212            return 
    215213         
    216     def _plot_data(self, data=None, name="Unknown"): 
     214    def _plot_data(self, data, name="Unknown"): 
    217215        """ 
    218216            Receive a data and post a NewPlotEvent to parent 
     
    220218            @param name: Data's name to use for the legend 
    221219        """ 
     220        plottable = self.graph.get_plottable(name=name) 
     221        if plottable is not None: 
     222            self.graph.delete(plottable) 
    222223        # Create a plottable data 
    223224        new_plot = Data1D(x=[], y=[], dx=None, dy=None) 
    224         if data is not None: 
    225             new_plot.copy_from_datainfo(data)  
    226             data.clone_without_data(clone=new_plot)  
     225        new_plot.copy_from_datainfo(data)  
     226        data.clone_without_data(clone=new_plot)  
    227227             
    228228        new_plot.name = name 
     
    241241            @param name: Data's name to use for the legend 
    242242        """ 
     243        plottable = self.graph.get_plottable(name=name) 
     244        if plottable is not None: 
     245            self.graph.delete(plottable) 
    243246        # Create a plottable data 
    244247        new_plot = Theory1D(x=[], y=[], dy=None) 
    245         if data is not None: 
    246             new_plot.copy_from_datainfo(data)  
    247             data.clone_without_data(clone=new_plot)  
     248        new_plot.copy_from_datainfo(data)  
     249        data.clone_without_data(clone=new_plot)  
    248250             
    249251        new_plot.name = name 
     
    637639     
    638640class InvariantDialog(wx.Dialog): 
    639     def __init__(self, parent=None, id=1,data=None, title="Invariant",base=None): 
     641    def __init__(self, parent=None, id=1,graph=None, 
     642                 data=None, title="Invariant",base=None): 
    640643        wx.Dialog.__init__(self, parent, id, title, size=( PANEL_WIDTH, 
    641644                                                             PANEL_HEIGHT)) 
    642         self.panel = InvariantPanel(self, data=data, base=base) 
     645        self.panel = InvariantPanel(self,graph=graph, data=data, base=base) 
    643646        self.Centre() 
    644647        self.Show(True) 
    645648         
    646649class InvariantWindow(wx.Frame): 
    647     def __init__(self, parent=None, id=1,data=None, title="Invariant",base=None): 
     650    def __init__(self, parent=None, id=1,graph=None,  
     651                 data=None, title="Invariant",base=None): 
     652         
    648653        wx.Frame.__init__(self, parent, id, title, size=( PANEL_WIDTH, 
    649654                                                             PANEL_HEIGHT)) 
    650655         
    651         self.panel = InvariantPanel(self, data=data, base=base) 
     656        self.panel = InvariantPanel(self,graph=graph, data=data, base=base) 
    652657        self.Centre() 
    653658        self.Show(True) 
Note: See TracChangeset for help on using the changeset viewer.