Changeset 2061
- Timestamp:
- 03/23/11 21:09:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/flagtoolbar.py
r2000 r2061 294 294 del regions,panels,strow,enrow 295 295 296 def _clear_selection_plot(self ):296 def _clear_selection_plot(self, refresh=True): 297 297 ### clear up polygons which mark selected spectra and regions ### 298 298 if len(self._polygons) > 0: 299 299 for shadow in self._polygons: 300 300 shadow.remove() 301 self.plotter._plotter.canvas.draw()301 if refresh: self.plotter._plotter.canvas.draw() 302 302 self._polygons = [] 303 303 304 def _clearup_selections(self ):304 def _clearup_selections(self, refresh=True): 305 305 # clear-up selection and polygons 306 306 self._selpanels = [] 307 307 self._selregions = {} 308 self._clear_selection_plot( )308 self._clear_selection_plot(refresh=refresh) 309 309 310 310 ### clear up selections … … 312 312 self.figmgr.toolbar.set_message('selections canceled') 313 313 # clear-up selection and polygons 314 self._clearup_selections( )314 self._clearup_selections(refresh=True) 315 315 316 316 ### flag selected spectra/regions … … 323 323 asaplog.post('WARN') 324 324 return 325 self._pause_buttons(operation="start",msg="Flagging data...") 325 326 self._flag_operation(rows=self._selpanels, 326 327 regions=self._selregions,unflag=False) … … 330 331 asaplog.push(sout) 331 332 del sout 332 self._clearup_selections( )333 self._clearup_selections(refresh=False) 333 334 self._plot_page(pagemode="current") 335 self._pause_buttons(operation="end") 334 336 335 337 ### unflag selected spectra/regions … … 341 343 asaplog.post('WARN') 342 344 return 345 self._pause_buttons(operation="start",msg="Unflagging data...") 343 346 self._flag_operation(rows=self._selpanels, 344 347 regions=self._selregions,unflag=True) … … 348 351 asaplog.push(sout) 349 352 del sout 350 self._clearup_selections( )353 self._clearup_selections(refresh=False) 351 354 self._plot_page(pagemode="current") 355 self._pause_buttons(operation="end") 352 356 353 357 ### actual flag operation … … 389 393 #print "- rows: ",self._selpanels 390 394 #print "- regions:\n ",self._selregions 391 self._clearup_selections( )395 self._clearup_selections(refresh=True) 392 396 393 397 @asaplog_post_dec … … 463 467 ### go to the previous page 464 468 def prev_page(self): 465 self.figmgr.toolbar.set_message('plotting the previous page') 466 self._clear_selection_plot() 469 #self.figmgr.toolbar.set_message('plotting the previous page') 470 self._pause_buttons(operation="start",msg='plotting the previous page') 471 self._clear_selection_plot(refresh=False) 467 472 self._plot_page(pagemode="prev") 468 473 self._plot_selections() 474 self._pause_buttons(operation="end") 469 475 470 476 ### go to the next page 471 477 def next_page(self): 472 self.figmgr.toolbar.set_message('plotting the next page') 473 self._clear_selection_plot() 478 #self.figmgr.toolbar.set_message('plotting the next page') 479 self._pause_buttons(operation="start",msg='plotting the next page') 480 self._clear_selection_plot(refresh=False) 474 481 self._plot_page(pagemode="next") 475 482 self._plot_selections() 483 self._pause_buttons(operation="end") 476 484 477 485 ### actual plotting of the new page … … 562 570 ppp = maxpanel 563 571 return int(idlastpanel/ppp)+1 572 573 # pause buttons for slow operations. implemented at a backend dependent class 574 def _pause_buttons(self,operation="end",msg=""): 575 pass 564 576 565 577 ##################################### … … 750 762 ## disable buttons which don't work for plottp 751 763 if not self.button: return 752 self.bRegion.config(relief='raised', state=Tk.DISABLED) 753 self.bPanel.config(relief='raised', state=Tk.DISABLED) 764 self.bRegion.config(relief='raised') 765 self.bPanel.config(relief='raised') 766 self.bRegion.config(state=Tk.DISABLED) 767 self.bPanel.config(state=Tk.DISABLED) 754 768 self.bClear.config(state=Tk.DISABLED) 755 769 self.bFlag.config(state=Tk.DISABLED) … … 775 789 self.bPrev.config(state=Tk.DISABLED) 776 790 791 # pause buttons for slow operations 792 def _pause_buttons(self,operation="end",msg=""): 793 buttons = ["bRegion","bPanel","bClear","bFlag","bUnflag","bStat", 794 "bNote","bQuit"] 795 if operation == "start": 796 state=Tk.DISABLED 797 else: 798 state=Tk.NORMAL 799 for btn in buttons: 800 getattr(self,btn).config(state=state) 801 self.figmgr.toolbar.set_message(msg) 802 803 777 804 def delete_bar(self): 778 805 self.__disconnect_event()
Note:
See TracChangeset
for help on using the changeset viewer.