Ignore:
Timestamp:
Jan 10, 2009 11:41:43 AM (16 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
24ea33c
Parents:
9b05b2f
Message:

Fixed the updating problem for 2D model plots. Read comment for clean up refactoring suggestions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/local_perspectives/plotting/Plotter2D.py

    rc73d871 r4b91fd1  
    101101        """ 
    102102            Data is ready to be displayed 
     103             
     104            #TODO: this name should be changed to something more appropriate 
     105            # Don't forget that changing this name will mean changing code 
     106            # in plotting.py 
     107              
    103108            @param event: data event 
    104109        """ 
     
    113118        if hasattr(event, "reset"): 
    114119            self._reset() 
    115         #print "model2 d event",event.plot.name, event.plot.id, event.plot.group_id 
    116         #print "plottable list ",self.plots.keys() 
    117         #print self.plots 
    118120        is_new = True 
    119121        if event.plot.name in self.plots.keys(): 
     
    121123            if not event.plot.__class__==self.plots[event.plot.name].__class__: 
    122124                #overwrite a plottable using the same name 
    123                 print "is deleting the new plottable" 
    124125                self.graph.delete(self.plots[event.plot.name]) 
    125126            else: 
    126127                # plottable is already draw on the panel 
    127128                is_new = False 
    128  
    129129            
    130130        if is_new: 
    131131            # a new plottable overwrites a plotted one  using the same id 
    132             #print "went here",self.plots.itervalues() 
    133132            for plottable in self.plots.itervalues(): 
    134133                if event.plot.id==plottable.id : 
     
    138137            self.graph.add(self.plots[event.plot.name]) 
    139138        else: 
    140             #replot the graph 
    141             self.plots[event.plot.name].x = event.plot.x     
    142             self.plots[event.plot.name].y = event.plot.y     
    143             self.plots[event.plot.name].dy = event.plot.dy   
    144             if hasattr(event.plot, 'dx') and hasattr(self.plots[event.plot.name], 'dx'): 
    145                 self.plots[event.plot.name].dx = event.plot.dx     
     139            # Update the plottable with the new data 
     140             
     141            #TODO: we should have a method to do this,  
     142            #      something along the lines of: 
     143            #      plottable1.update_data_from_plottable(plottable2) 
     144             
     145            self.plots[event.plot.name].xmin = event.plot.xmin 
     146            self.plots[event.plot.name].xmax = event.plot.xmax 
     147            self.plots[event.plot.name].ymin = event.plot.ymin 
     148            self.plots[event.plot.name].ymax = event.plot.ymax 
     149            self.plots[event.plot.name].data = event.plot.data 
     150            self.plots[event.plot.name].err_data = event.plot.err_data 
     151             
    146152  
    147153         
Note: See TracChangeset for help on using the changeset viewer.