source: trunk/python/asaplotgui.py@ 2412

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

New Development: No

JIRA Issue: No (minor fixes and improvements)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: interactive testing

Put in Release Notes: No

Module(s): asapplotter, asaplotbase, flagplotter, sdplot, and sdflag

Description:

Misc bug fixes and minor modifications:
+ fixed bug in customgui_base (scantable class referenced but not imported)
+ minor improvement of toolbar message in customgui_tkagg
+ added a new method _set_window_title(string title) to asaplotgui_qt4 and asaplotgui modules

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
RevLine 
[707]1"""
2ASAP plotting class based on matplotlib.
3"""
4
5from asap.asaplotbase import *
6import Tkinter as Tk
[1422]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
[1563]18 def __init__(self, rows=1, cols=0, title='', size=None, buffering=False):
[1826]19 """
20 Create a new instance of the ASAPlot plotting class.
[707]21
[1826]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 """
[707]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)
[2170]39 self._set_window_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):
[1826]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()
[707]57
58 def quit(self):
[1826]59 """
60 Destroy the ASAPlot graphics window.
61 """
[2149]62 self.is_dead = True
[1826]63 self.window.destroy()
[707]64
[1153]65 def show(self, hardrefresh=True):
[1826]66 """
67 Show graphics dependent on the current buffering state.
68 """
69 if not self.buffering:
[1153]70 if hardrefresh:
71 asaplotbase.show(self)
[1826]72 self.window.wm_deiconify()
73 self.canvas.show()
[707]74
75 def terminate(self):
[1826]76 """
77 Clear the figure.
78 """
79 self.window.destroy()
[707]80
81 def unmap(self):
[1826]82 """
83 Hide the ASAPlot graphics window.
84 """
85 self.window.wm_withdraw()
[2170]86
87 def _set_window_title(self,title):
88 # Set title to main window title bar
89 self.window.wm_title(title)
Note: See TracBrowser for help on using the repository browser.