Changeset f5fda87 in sasview


Ignore:
Timestamp:
Mar 5, 2010 7:04:33 PM (15 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:
2e94cbde
Parents:
53b6b74
Message:

guiframe: ensure that the legend (and the whole plottable) is removed from the graph when an empty plottable is sent in a plotting event

File:
1 edited

Legend:

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

    ra85f622 rf5fda87  
    106106            self._reset() 
    107107         
     108        # Check whether the plottable is empty 
     109        is_empty = len(event.plot.x)==0 
     110                 
    108111        is_new = True 
    109112        if event.plot.name in self.plots.keys(): 
     113            # If the plottable is empty, just remove the plottable from the graph 
     114            if is_empty: 
     115                self.graph.delete(self.plots[event.plot.name]) 
     116                 
    110117            # Check whether the class of plottable changed 
    111118            if not event.plot.__class__==self.plots[event.plot.name].__class__: 
     
    116123                is_new = False 
    117124         
    118         if is_new: 
    119             # a new plottable overwrites a plotted one  using the same id 
    120             for plottable in self.plots.itervalues(): 
    121                 if hasattr(event.plot,"id") and hasattr(plottable, "id"): 
    122                     if event.plot.id==plottable.id : 
    123                         self.graph.delete(plottable) 
    124              
    125             self.plots[event.plot.name] = event.plot 
    126             self.graph.add(self.plots[event.plot.name]) 
    127         else: 
    128             #replot the graph 
    129             self.plots[event.plot.name].x = event.plot.x     
    130             self.plots[event.plot.name].y = event.plot.y     
    131             self.plots[event.plot.name].dy = event.plot.dy   
    132             if hasattr(event.plot, 'dx') and hasattr(self.plots[event.plot.name], 'dx'): 
    133                 self.plots[event.plot.name].dx = event.plot.dx     
     125        if not is_empty: 
     126            if is_new: 
     127                # a new plottable overwrites a plotted one  using the same id 
     128                for plottable in self.plots.itervalues(): 
     129                    if hasattr(event.plot,"id") and hasattr(plottable, "id"): 
     130                        if event.plot.id==plottable.id : 
     131                            self.graph.delete(plottable) 
     132                 
     133                self.plots[event.plot.name] = event.plot 
     134                self.graph.add(self.plots[event.plot.name]) 
     135            else: 
     136                #replot the graph 
     137                self.plots[event.plot.name].x = event.plot.x     
     138                self.plots[event.plot.name].y = event.plot.y     
     139                self.plots[event.plot.name].dy = event.plot.dy   
     140                if hasattr(event.plot, 'dx') and hasattr(self.plots[event.plot.name], 'dx'): 
     141                    self.plots[event.plot.name].dx = event.plot.dx     
    134142           
    135143        #TODO: Should re-factor this 
Note: See TracChangeset for help on using the changeset viewer.