Changeset 1884 for trunk/python
- Timestamp:
- 08/20/10 18:46:03 (14 years ago)
- Location:
- trunk/python
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/casatoolbar.py
r1826 r1884 1 1 import os 2 2 import matplotlib 3 3 4 ###################################### 4 5 ## Add CASA custom toolbar ## … … 144 145 mymask.select_mask(once=True,showmask=False) 145 146 147 def _mod_note(self,event): 148 # Do not fire event when in zooming/panning mode 149 if not self.figmgr.toolbar.mode == '': 150 return 151 if event.button ==1: 152 self.notewin.load_textwindow(event) 153 elif event.button == 3 and self._note_picked(event): 154 self.notewin.show_modmenu(event) 155 return 156 157 def _note_picked(self,event): 158 # just briefly check if any texts are picked 159 for textobj in self.canvas.figure.texts: 160 if textobj.contains(event)[0]: 161 return True 162 for ax in self.canvas.figure.axes: 163 for textobj in ax.texts: 164 if textobj.contains(event)[0]: 165 return True 166 #print "No text picked" 167 return False 168 146 169 ##################################### 147 170 ## Backend dependent Classes ## … … 150 173 if matplotlib.get_backend() == 'TkAgg': 151 174 import Tkinter as Tk 175 from notationwindow import NotationWindowTkAgg 152 176 153 177 class CustomToolbarTkAgg(CustomToolbarCommon, Tk.Frame): … … 164 188 self.button=True 165 189 self._add_custom_toolbar() 190 self.notewin=NotationWindowTkAgg(master=self.canvas) 166 191 CustomToolbarCommon.__init__(self,parent) 167 192 … … 174 199 text='statistics', 175 200 command=self.stat_cal) 201 self.bNote=self._NewButton(master=self, 202 text=' note ', 203 command=self.modify_note) 176 204 self.bQuit=self._NewButton(master=self, 177 205 text='Quit', … … 198 226 self.bStat.config(relief='raised') 199 227 self.bSpec.config(relief='sunken') 228 self.bNote.config(relief='raised') 200 229 self.mode='spec' 201 230 self.__disconnect_event() … … 209 238 self.bSpec.config(relief='raised') 210 239 self.bStat.config(relief='sunken') 240 self.bNote.config(relief='raised') 211 241 self.mode='stat' 212 242 self.__disconnect_event() 213 243 self._p.register('button_press',self._single_mask) 244 245 def modify_note(self): 246 if not self.figmgr.toolbar.mode == '' or not self.button: return 247 self.figmgr.toolbar.set_message('text: select a position/text') 248 if self.mode == 'note': return 249 self.bSpec.config(relief='raised') 250 self.bStat.config(relief='raised') 251 self.bNote.config(relief='sunken') 252 self.mode='note' 253 self.__disconnect_event() 254 self._p.register('button_press',self._mod_note) 214 255 215 256 def quit(self):
Note:
See TracChangeset
for help on using the changeset viewer.