source: branches/alma/python/asaplotgui.py@ 2032

Last change on this file since 2032 was 1757, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
RevLine 
[707]1"""
2ASAP plotting class based on matplotlib.
3"""
4
5from asap.asaplotbase import *
6import Tkinter as Tk
[1603]7import matplotlib
[707]8from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, \
9 FigureManagerTkAgg
10# Force use of the newfangled toolbar.
11matplotlib.rcParams['toolbar'] = 'toolbar2'
12
13class asaplotgui(asaplotbase):
14 """
15 ASAP plotting class based on matplotlib.
16 """
17
[1757]18 def __init__(self, rows=1, cols=0, title='', size=None, buffering=False):
[707]19 """
20 Create a new instance of the ASAPlot plotting class.
21
22 If rows < 1 then a separate call to set_panels() is required to define
23 the panel layout; refer to the doctext for set_panels().
24 """
25 v = vars()
26 del v['self']
[1153]27
[707]28 asaplotbase.__init__(self, **v)
29 self.window = Tk.Tk()
30 def dest_callback():
31 self.is_dead = True
32 self.window.destroy()
33
34 self.window.protocol("WM_DELETE_WINDOW", dest_callback)
35 self.canvas = FigureCanvasTkAgg(self.figure, master=self.window)
36 self.canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
37 # Simply instantiating this is enough to get a working toolbar.
38 self.figmgr = FigureManagerTkAgg(self.canvas, 1, self.window)
[1153]39 self.window.wm_title('ASAP Plotter - Tk')
[707]40
41 self.events = {'button_press':None,
42 'button_release':None,
43 'motion_notify':None}
44
[1153]45 matplotlib.rcParams["interactive"] = True
46 #self.buffering = buffering
[707]47
48 self.canvas.show()
49
50 def map(self):
51 """
52 Reveal the ASAPlot graphics window and bring it to the top of the
53 window stack.
54 """
55 self.window.wm_deiconify()
56 self.window.lift()
57
58 def quit(self):
59 """
60 Destroy the ASAPlot graphics window.
61 """
62 self.window.destroy()
63
[1153]64 def show(self, hardrefresh=True):
[707]65 """
66 Show graphics dependent on the current buffering state.
67 """
68 if not self.buffering:
[1153]69 if hardrefresh:
70 asaplotbase.show(self)
[707]71 self.window.wm_deiconify()
[1153]72 self.canvas.show()
[707]73
74 def terminate(self):
75 """
76 Clear the figure.
77 """
78 self.window.destroy()
79
80 def unmap(self):
81 """
82 Hide the ASAPlot graphics window.
83 """
84 self.window.wm_withdraw()
Note: See TracBrowser for help on using the repository browser.