Changeset 2453 for trunk/python


Ignore:
Timestamp:
03/31/12 01:22:43 (13 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: Yes (CAS-3749/Trac-266)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: renamed a parameter of asapplotter._assert_plotter from mode to action

Test Programs:

Put in Release Notes: No

Module(s):

Description: renamed a parameter of asapplotter._assert_plotter from mode to action


Location:
trunk/python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapplotter.py

    r2452 r2453  
    121121        return False
    122122
    123     def _assert_plotter(self,mode="status",errmsg=None):
    124         """
    125         Check asaplot status. Returns True if plot window is alive.
     123    def _assert_plotter(self,action="status",errmsg=None):
     124        """
     125        Check plot window status. Returns True if plot window is alive.
    126126        Parameters
    127             mode:      Mode of operation. ['status'|'reload'|'halt']
    128                        The mode 'status' simply returns if asaplot is
    129                        alive (True/False). When asaplot is not alive,
    130                        asaplot is reloaded when mode='reload', while
    131                        an error raised when mode='halt'
     127            action:    An action to take if the plotter window is not alive.
     128                       ['status'|'reload'|'halt']
     129                       The action 'status' simply returns False if asaplot
     130                       is not alive. When action='reload', plot window is
     131                       reloaded and the method returns True. Finally, an
     132                       error is raised when action='halt'.
    132133            errmsg:    An error (warning) message to send to the logger,
    133                        when asaplot is dead.       
     134                       when plot window is not alive.
    134135        """
    135136        if self._plotter and not self._plotter.is_dead:
     
    140141            haltmsg = errmsg
    141142       
    142         if mode.upper().startswith("R"):
     143        if action.upper().startswith("R"):
    143144            # reload plotter
    144145            self._reload_plotter()
    145146            return True
    146         elif mode.upper().startswith("H"):
     147        elif action.upper().startswith("H"):
    147148            # halt
    148149            asaplog.push(haltmsg)
     
    176177        self._panelrows = []
    177178
    178         self._assert_plotter(mode="reload")
     179        self._assert_plotter(action="reload")
    179180        if self.casabar_exists():
    180181            self._plotter.figmgr.casabar.set_pagecounter(1)
     
    199200    def gca(self):
    200201        errmsg = "No axis to retun. Need to plot first."
    201         if not self._assert_plotter(mode="status",errmsg=errmsg):
     202        if not self._assert_plotter(action="status",errmsg=errmsg):
    202203            return None
    203204        return self._plotter.figure.gca()
     
    206207        """Do a soft refresh"""
    207208        errmsg = "No figure to re-plot. Need to plot first."
    208         self._assert_plotter(mode="halt",errmsg=errmsg)
     209        self._assert_plotter(action="halt",errmsg=errmsg)
    209210
    210211        self._plotter.figure.show()
     
    221222        """
    222223        ## this method relies on already plotted figure
    223         if not self._assert_plotter(mode="status") or (self._data is None):
     224        if not self._assert_plotter(action="status") or (self._data is None):
    224225            msg = "Cannot create mask interactively on plot. Can only create mask after plotting."
    225226            asaplog.push( msg )
     
    271272    # forwards to matplotlib axes
    272273    def text(self, *args, **kwargs):
    273         self._assert_plotter(mode="reload")
     274        self._assert_plotter(action="reload")
    274275        if kwargs.has_key("interactive"):
    275276            if kwargs.pop("interactive"):
     
    281282
    282283    def arrow(self, *args, **kwargs):
    283         self._assert_plotter(mode="reload")
     284        self._assert_plotter(action="reload")
    284285        if kwargs.has_key("interactive"):
    285286            if kwargs.pop("interactive"):
     
    294295
    295296    def annotate(self, text, xy=None, xytext=None, **kwargs):
    296         self._assert_plotter(mode="reload")
     297        self._assert_plotter(action="reload")
    297298        if kwargs.has_key("interactive"):
    298299            if kwargs.pop("interactive"):
     
    306307
    307308    def axvline(self, *args, **kwargs):
    308         self._assert_plotter(mode="reload")
     309        self._assert_plotter(action="reload")
    309310        if kwargs.has_key("interactive"):
    310311            if kwargs.pop("interactive"):
     
    316317
    317318    def axhline(self, *args, **kwargs):
    318         self._assert_plotter(mode="reload")
     319        self._assert_plotter(action="reload")
    319320        if kwargs.has_key("interactive"):
    320321            if kwargs.pop("interactive"):
     
    326327
    327328    def axvspan(self, *args, **kwargs):
    328         self._assert_plotter(mode="reload")
     329        self._assert_plotter(action="reload")
    329330        if kwargs.has_key("interactive"):
    330331            if kwargs.pop("interactive"):
     
    341342
    342343    def axhspan(self, *args, **kwargs):
    343         self._assert_plotter(mode="reload")
     344        self._assert_plotter(action="reload")
    344345        if kwargs.has_key("interactive"):
    345346            if kwargs.pop("interactive"):
     
    356357
    357358    def _axes_callback(self, axesfunc, *args, **kwargs):
    358         self._assert_plotter(mode="reload")
     359        self._assert_plotter(action="reload")
    359360        panel = 0
    360361        if kwargs.has_key("panel"):
     
    786787        """
    787788        errmsg = "Cannot plot spectral lines. Need to plot scantable first."
    788         self._assert_plotter(mode="halt",errmsg=errmsg)
     789        self._assert_plotter(action="halt",errmsg=errmsg)
    789790        if not self._data:
    790791            raise RuntimeError("No scantable has been plotted yet.")
     
    865866        """
    866867        errmsg = "Cannot save figure. Need to plot first."
    867         self._assert_plotter(mode="halt",errmsg=errmsg)
     868        self._assert_plotter(action="halt",errmsg=errmsg)
    868869       
    869870        self._plotter.save(filename,orientation,dpi)
     
    13881389    @asaplog_post_dec
    13891390    def plottp(self, scan=None, outfile=None):
    1390         self._assert_plotter(mode="reload")
     1391        self._assert_plotter(action="reload")
    13911392        self._plotter.hold()
    13921393        self._plotter.clear()
     
    14781479        See the method help for detailed information.
    14791480        """
    1480         self._assert_plotter(mode="reload")
     1481        self._assert_plotter(action="reload")
    14811482        self._plotter.text(*args, **kwargs)
    14821483    # end matplotlib.Figure.text forwarding function
     
    15181519        if plot:
    15191520            errmsg = "Can plot header only after the first call to plot()."
    1520             self._assert_plotter(mode="halt",errmsg=errmsg)
     1521            self._assert_plotter(action="halt",errmsg=errmsg)
    15211522            self._plotter.hold()
    15221523            self._header_plot(headstr,fontsize=fontsize)
     
    15511552            asaplog.push("No header has been plotted. Exit without any operation")
    15521553            asaplog.post("WARN")
    1553         elif self._assert_plotter(mode="status"):
     1554        elif self._assert_plotter(action="status"):
    15541555            self._plotter.hold()
    15551556            for textobj in self._headtext['textobj']:
  • trunk/python/flagplotter.py

    r2451 r2453  
    2727        self._scan = None
    2828        asapplotter.__init__(self,visible=visible, **kwargs)
    29         self._assert_plotter(mode='reload')
     29        self._assert_plotter(action='reload')
    3030        self._plotter._set_window_title('Flag Plotter')
    3131        self._panelling = 'r'
  • trunk/python/interactivemask.py

    r2451 r2453  
    163163            self.p = asapplotter()
    164164            self.newplot = True
    165         self.p._assert_plotter(mode='reload')
     165        self.p._assert_plotter(action='reload')
    166166       
    167167        # Plot selected spectra if needed
Note: See TracChangeset for help on using the changeset viewer.