Changeset 2062


Ignore:
Timestamp:
03/23/11 21:48:11 (14 years ago)
Author:
Kana Sugimoto
Message:

Merged a bug fix in trunk (r2061)

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

    r2000 r2062  
    294294        del regions,panels,strow,enrow
    295295
    296     def _clear_selection_plot(self):
     296    def _clear_selection_plot(self, refresh=True):
    297297        ### clear up polygons which mark selected spectra and regions ###
    298298        if len(self._polygons) > 0:
    299299            for shadow in self._polygons:
    300300                shadow.remove()
    301             self.plotter._plotter.canvas.draw()
     301            if refresh: self.plotter._plotter.canvas.draw()
    302302        self._polygons = []
    303303
    304     def _clearup_selections(self):
     304    def _clearup_selections(self, refresh=True):
    305305        # clear-up selection and polygons
    306306        self._selpanels = []
    307307        self._selregions = {}
    308         self._clear_selection_plot()
     308        self._clear_selection_plot(refresh=refresh)
    309309
    310310    ### clear up selections
     
    312312        self.figmgr.toolbar.set_message('selections canceled')
    313313        # clear-up selection and polygons
    314         self._clearup_selections()
     314        self._clearup_selections(refresh=True)
    315315
    316316    ### flag selected spectra/regions
     
    323323            asaplog.post('WARN')
    324324            return
     325        self._pause_buttons(operation="start",msg="Flagging data...")
    325326        self._flag_operation(rows=self._selpanels,
    326327                             regions=self._selregions,unflag=False)
     
    330331        asaplog.push(sout)
    331332        del sout
    332         self._clearup_selections()
     333        self._clearup_selections(refresh=False)
    333334        self._plot_page(pagemode="current")
     335        self._pause_buttons(operation="end")
    334336
    335337    ### unflag selected spectra/regions
     
    341343            asaplog.post('WARN')
    342344            return
     345        self._pause_buttons(operation="start",msg="Unflagging data...")
    343346        self._flag_operation(rows=self._selpanels,
    344347                             regions=self._selregions,unflag=True)
     
    348351        asaplog.push(sout)
    349352        del sout
    350         self._clearup_selections()
     353        self._clearup_selections(refresh=False)
    351354        self._plot_page(pagemode="current")
     355        self._pause_buttons(operation="end")
    352356
    353357    ### actual flag operation
     
    389393        #print "- rows: ",self._selpanels
    390394        #print "- regions:\n   ",self._selregions
    391         self._clearup_selections()
     395        self._clearup_selections(refresh=True)
    392396
    393397    @asaplog_post_dec
     
    463467    ### go to the previous page
    464468    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)
    467472        self._plot_page(pagemode="prev")
    468473        self._plot_selections()
     474        self._pause_buttons(operation="end")
    469475
    470476    ### go to the next page
    471477    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)
    474481        self._plot_page(pagemode="next")
    475482        self._plot_selections()
     483        self._pause_buttons(operation="end")
    476484
    477485    ### actual plotting of the new page
     
    562570            ppp = maxpanel
    563571        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
    564576
    565577#####################################
     
    750762        ## disable buttons which don't work for plottp
    751763        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)
    754768        self.bClear.config(state=Tk.DISABLED)
    755769        self.bFlag.config(state=Tk.DISABLED)
     
    775789        self.bPrev.config(state=Tk.DISABLED)
    776790
     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       
    777804    def delete_bar(self):
    778805        self.__disconnect_event()
Note: See TracChangeset for help on using the changeset viewer.