Changeset 2066
- Timestamp:
- 03/24/11 19:41:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/flagtoolbar.py
r2061 r2066 158 158 return 159 159 #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, 161 162 'worldx': [event.xdata,event.xdata]} 162 163 self.plotter._plotter.register('button_press',None) … … 166 167 def _xspan_draw(self,event): 167 168 if event.inaxes == self._thisregion['axes']: 168 xnow = event.xdata 169 #xnow = event.xdata 170 xnow = event.x 169 171 self.xdataold = xnow 170 172 else: … … 172 174 try: self.lastspan 173 175 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") 177 181 #self.plotter._plotter.show(False) 178 self.plotter._plotter.canvas.draw()182 #self.plotter._plotter.canvas.draw() 179 183 del xnow 180 184 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 181 192 def _xspan_end(self,event): 182 193 if not self.figmgr.toolbar.mode == '': … … 188 199 except AttributeError: pass 189 200 else: 190 self.lastspan.remove() 201 #self.lastspan.remove() 202 self._remove_span(self.lastspan) 191 203 del self.lastspan 192 204 if event.inaxes == self._thisregion['axes']: … … 809 821 self._p.register('button_press',None) 810 822 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.