Changeset 2067 for branches


Ignore:
Timestamp:
03/24/11 19:47:01 (14 years ago)
Author:
Kana Sugimoto
Message:

merged a bug fix in trunk (r2066)

Location:
branches/casa-prerelease/pre-asap/python
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/casa-prerelease/pre-asap/python

  • branches/casa-prerelease/pre-asap/python/flagtoolbar.py

    r2062 r2067  
    158158            return
    159159        #print "add the region to selections"
    160         self._thisregion = {'axes': event.inaxes,'xs': event.xdata,
     160        #self._thisregion = {'axes': event.inaxes,'xs': event.xdata,
     161        self._thisregion = {'axes': event.inaxes,'xs': event.x,
    161162                            'worldx': [event.xdata,event.xdata]}
    162163        self.plotter._plotter.register('button_press',None)
     
    166167    def _xspan_draw(self,event):
    167168        if event.inaxes == self._thisregion['axes']:
    168             xnow = event.xdata
     169            #xnow = event.xdata
     170            xnow = event.x
    169171            self.xdataold = xnow
    170172        else:
     
    172174        try: self.lastspan
    173175        except AttributeError: pass
    174         else: self.lastspan.remove()
    175 
    176         self.lastspan = self._thisregion['axes'].axvspan(self._thisregion['xs'],xnow,facecolor='0.7')
     176        #else: self.lastspan.remove()
     177        else: self._remove_span(self.lastspan)
     178
     179        #self.lastspan = self._thisregion['axes'].axvspan(self._thisregion['xs'],xnow,facecolor='0.7')
     180        self.lastspan = self._draw_span(self._thisregion['axes'],self._thisregion['xs'],xnow,fill="#555555",stipple="gray50")
    177181        #self.plotter._plotter.show(False)
    178         self.plotter._plotter.canvas.draw()
     182        #self.plotter._plotter.canvas.draw()
    179183        del xnow
    180184
     185    def _draw_span(self,axes,x0,x1,**kwargs):
     186        pass
     187
     188    def _remove_span(self,span):
     189        pass
     190
     191    @asaplog_post_dec
    181192    def _xspan_end(self,event):
    182193        if not self.figmgr.toolbar.mode == '':
     
    188199        except AttributeError: pass
    189200        else:
    190             self.lastspan.remove()
     201            #self.lastspan.remove()
     202            self._remove_span(self.lastspan)
    191203            del self.lastspan
    192204        if event.inaxes == self._thisregion['axes']:
     
    809821        self._p.register('button_press',None)
    810822        self._p.register('button_release',None)
     823
     824    def _draw_span(self,axes,x0,x1,**kwargs):
     825        height = self._p.figure.bbox.height
     826        y0 = height - axes.bbox.y0
     827        y1 = height - axes.bbox.y1
     828        return self._p.canvas._tkcanvas.create_rectangle(x0,y0,x1,y1,**kwargs)
     829
     830    def _remove_span(self,span):
     831        self._p.canvas._tkcanvas.delete(span)
Note: See TracChangeset for help on using the changeset viewer.