Changeset 1623 for branches/alma
- Timestamp:
- 08/18/09 17:57:23 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma/python/interactivemask.py
r1622 r1623 184 184 185 185 def _region_start(self,event): 186 print "_region_start called" 186 187 # Do not fire event when in zooming/panning mode 187 188 mode = self.p._plotter.figmgr.toolbar.mode … … 197 198 'pixel': [event.x, event.y, 198 199 event.x, event.y]} 200 ### Start mod: 2009/08/17 kana ### 201 #self._default_motion('stop') 202 ### End mod ###################### 199 203 self.p._plotter.register('motion_notify', self._region_draw) 200 204 self.p._plotter.register('button_release', self._region_end) … … 214 218 215 219 self.p._plotter.figmgr.toolbar.draw_rubberband(event, xnow, ynow, self.rect['x'], self.rect['y']) 216 220 ### Start mod: 2009/08/17 kana ### 221 #self.p._plotter.figmgr.toolbar.mouse_move(event) 222 ### End mod ###################### 217 223 218 224 def _region_end(self,event): 219 225 self.p._plotter.register('motion_notify', None) 226 ### Start mod: 2009/08/17 kana ### 227 #self._default_motion('start') 228 ### End mod ###################### 220 229 self.p._plotter.register('button_release', None) 221 230 … … 236 245 self.rect['pixel'][2:4] = [xend, yend] 237 246 self._update_mask() 247 # Clear up region selection 248 self.rect={} 249 self.xold=None 250 self.yold=None 251 self.xdataold=None 252 self.ydataold=None 238 253 if self.once: self.finish_selection(callback=self.callback) 239 254 … … 295 310 self.p._plotter.canvas.draw() 296 311 312 ### Start mod: 2009/08/17 kana ### 313 def _default_motion(self,action): 314 if not isinstance(action,str): 315 print "WARN: Either 'stop' or 'start' is valid." 316 return 317 318 canvas=self.p._plotter.canvas 319 toolbar=self.p._plotter.figmgr.toolbar 320 if action == 'stop': 321 if toolbar._idDrag: 322 print "WARN: No default event. Nothing to be done." 323 return 324 canvas.mpl_disconnect(toolbar._idDrag) 325 print "Disconnecting default motion event ", toolbar._idDrag 326 elif action == 'start': 327 if toolbar._idDrag: 328 print "WARN: Default event already exists. Disconnecting the event." 329 canvas.mpl_disconnect(toolbar._idDrag) 330 toolbar._idDrag=canvas.mpl_connect('motion_notify_event',toolbar.mouse_move) 331 print "Connecting default motion event ", toolbar._idDrag 332 else: 333 print "WARN: Either 'stop' or 'start' is valid." 334 335 ### End mod ###################### 336 297 337 def finish_selection(self, callback=None): 338 """ 339 Execute callback function, reset or close plotter window as 340 necessary. 341 342 Parameters: 343 callback: The post processing function to run after 344 the mask selections are completed. 345 Specifying the callback function here will overwrite 346 the one set by set_callback(func) 347 348 Note this function is automatically called at the end of 349 select_mask() if once=True. 350 """ 298 351 if callback: self.callback=callback 299 352 if self.callback: self.callback() … … 307 360 del self.p 308 361 self.p=None 362 self._polygons=[] 309 363 310 364
Note:
See TracChangeset
for help on using the changeset viewer.