Ignore:
Timestamp:
02/21/12 14:11:09 (12 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: Yes (CAS-3749)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: an interactive test

  1. load casapy (or standalone asap)
  2. matplotlib.pyplot.show() ---> 2 plotters (ASAP plotter and matplotlib plotter) are displayed and casapy prompt is paused.
  3. close all plotter windows ---> casapy prompt should be back

Put in Release Notes: No

Module(s): sdplot, asap.plotter

Description:

Fixed a bug in asapplotter with Tk backend which caused scripts and python shells
freeze after the initial invocation of matplotlib.pyplot.show() (known as pl.show() on CASA).
plus minor fixes which handle backend dependencies.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asaplotgui.py

    r2170 r2416  
    1010# Force use of the newfangled toolbar.
    1111matplotlib.rcParams['toolbar'] = 'toolbar2'
     12from matplotlib import _pylab_helpers
    1213
    1314class asaplotgui(asaplotbase):
     
    2829        asaplotbase.__init__(self, **v)
    2930        self.window = Tk.Tk()
    30         def dest_callback():
    31             self.is_dead = True
    32             self.window.destroy()
     31        #def dest_callback():
     32        #    print "dest_callback"
     33        #    self.is_dead = True
     34        #    self.window.destroy()
    3335
    34         self.window.protocol("WM_DELETE_WINDOW", dest_callback)
     36        self.window.protocol("WM_DELETE_WINDOW", self.quit)
    3537        self.canvas = FigureCanvasTkAgg(self.figure, master=self.window)
    3638        self.canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
    3739        # Simply instantiating this is enough to get a working toolbar.
    38         self.figmgr = FigureManagerTkAgg(self.canvas, 1, self.window)
     40        self.figmgr = FigureManagerTkAgg(self.canvas, 0, self.window)
     41        # Register this plot to matplotlib without activating it
     42        #_pylab_helpers.Gcf.set_active(self.figmgr)
     43        _pylab_helpers.Gcf.figs[self.figmgr.num] = self.figmgr
    3944        self._set_window_title('ASAP Plotter - Tk')
    4045
     
    6166        """
    6267        self.is_dead = True
    63         self.window.destroy()
     68        #self.window.destroy()
     69        _pylab_helpers.Gcf.destroy(self.figmgr.num)
     70        del self.window, self.canvas
     71        self.window = None
     72        self.canvas = None
     73       
    6474
    6575    def show(self, hardrefresh=True):
Note: See TracChangeset for help on using the changeset viewer.