Changeset ab8f936 in sasview


Ignore:
Timestamp:
Dec 18, 2008 12:07:37 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:
ef0c170
Parents:
6bcdad1
Message:

override a plot update —> model can be plotted with unik name

Location:
guiframe
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_loader.py

    r169460a rab8f936  
    118118        new_plot.xaxis(output._xaxis,output._xunit) 
    119119        new_plot.yaxis(output._yaxis,output._yunit) 
    120         new_plot.group_id = filename 
    121         new_plot.id =None 
     120        new_plot.group_id = output.filename 
     121        new_plot.id = output.filename 
    122122        wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=filename)) 
    123123    else: 
     
    146146            new_plot.xaxis(item._xaxis,item._xunit) 
    147147            new_plot.yaxis(item._yaxis,item._yunit) 
    148             new_plot.group_id = filename 
     148            new_plot.group_id = str(item.run[0]) 
     149            new_plot.id = str(item.run[0]) 
     150             
    149151            wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=filename)) 
    150152            i+=1 
  • guiframe/local_perspectives/plotting/Plotter1D.py

    r1bf33c1 rab8f936  
    104104         
    105105        is_new = True 
    106         #print "model panel name",event.plot.name 
    107106        if event.plot.name in self.plots.keys(): 
    108107            # Check whether the class of plottable changed 
    109             #print "model panel",event.plot.name,event.plot.__class__ 
    110108            if not event.plot.__class__==self.plots[event.plot.name].__class__: 
     109                #overwrite a plottable using the same name 
    111110                self.graph.delete(self.plots[event.plot.name]) 
    112111            else: 
     112                # plottable is already draw on the panel 
    113113                is_new = False 
    114          
     114 
     115            
    115116        if is_new: 
     117            # a new plottable overwrites a plotted one  using the same id 
     118            for plottable in self.plots.itervalues(): 
     119                if event.plot.id==plottable.id : 
     120                    self.graph.delete(plottable) 
     121             
    116122            self.plots[event.plot.name] = event.plot 
    117123            self.graph.add(self.plots[event.plot.name]) 
    118124        else: 
     125            #replot the graph 
    119126            self.plots[event.plot.name].x = event.plot.x     
    120127            self.plots[event.plot.name].y = event.plot.y     
  • guiframe/local_perspectives/plotting/Plotter2D.py

    r1bf33c1 rab8f936  
    103103        """ 
    104104        #TODO: Check for existence of plot attribute 
     105 
    105106        # Check whether this is a replot. If we ask for a replot 
    106107        # and the plottable no longer exists, ignore the event. 
     
    108109            and event.plot.name not in self.plots.keys(): 
    109110            return 
     111         
    110112        if hasattr(event, "reset"): 
    111113            self._reset() 
     114        print "model2 d event",event.plot.name, event.plot.id, event.plot.group_id 
     115        print "plottable list ",self.plots.keys() 
     116        print self.plots 
    112117        is_new = True 
    113118        if event.plot.name in self.plots.keys(): 
    114119            # Check whether the class of plottable changed 
    115120            if not event.plot.__class__==self.plots[event.plot.name].__class__: 
     121                #overwrite a plottable using the same name 
     122                print "is deleting the new plottable" 
    116123                self.graph.delete(self.plots[event.plot.name]) 
    117124            else: 
     125                # plottable is already draw on the panel 
    118126                is_new = False 
    119         self.plots[event.plot.name] = event.plot 
    120         #if is_new: 
    121         self.graph.add(self.plots[event.plot.name]) 
    122          
    123  
     127 
     128            
     129        if is_new: 
     130            # a new plottable overwrites a plotted one  using the same id 
     131            print "went here",self.plots.itervalues() 
     132            for plottable in self.plots.itervalues(): 
     133                if event.plot.id==plottable.id : 
     134                    self.graph.delete(plottable) 
     135             
     136            self.plots[event.plot.name] = event.plot 
     137            self.graph.add(self.plots[event.plot.name]) 
     138        else: 
     139            #replot the graph 
     140            self.plots[event.plot.name].x = event.plot.x     
     141            self.plots[event.plot.name].y = event.plot.y     
     142            self.plots[event.plot.name].dy = event.plot.dy   
     143            if hasattr(event.plot, 'dx') and hasattr(self.plots[event.plot.name], 'dx'): 
     144                self.plots[event.plot.name].dx = event.plot.dx     
     145  
     146         
    124147        # Check axis labels 
    125148        #TODO: Should re-factor this 
    126149        #if event.plot._xunit != self.graph.prop["xunit"]: 
    127         
    128150        self.graph.xaxis(event.plot._xaxis, event.plot._xunit) 
     151             
    129152        #if event.plot._yunit != self.graph.prop["yunit"]: 
    130153        self.graph.yaxis(event.plot._yaxis, event.plot._yunit) 
     154       
    131155        self.graph.render(self) 
    132156        self.subplot.figure.canvas.draw_idle() 
  • guiframe/local_perspectives/plotting/plotting.py

    r1bf33c1 rab8f936  
    9797        # Check whether we already have a graph with the same units 
    9898        # as the plottable we just received.  
     99         
    99100        is_available = False 
    100101        for panel in self.plot_panels: 
Note: See TracChangeset for help on using the changeset viewer.