Changeset 2117 for trunk/python/flagtoolbar.py
- Timestamp:
- 04/07/11 17:37:27 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/flagtoolbar.py
r2115 r2117 19 19 self._thisregion = None 20 20 self.xdataold=None 21 21 22 22 ### select the nearest spectrum in pick radius 23 23 ### and display spectral value on the toolbar. … … 34 34 return 35 35 36 xclick =event.xdata37 yclick =event.ydata38 dist2 =1000.39 pickline =None36 xclick = event.xdata 37 yclick = event.ydata 38 dist2 = 1000. 39 pickline = None 40 40 # If the pannel has picable objects 41 pflag =False41 pflag = False 42 42 for lin in event.inaxes.lines: 43 43 if not lin.pickable(): 44 44 continue 45 pflag =True45 pflag = True 46 46 flag,pind = lin.contains(event) 47 47 if not flag: … … 61 61 # Pickable but too far from mouse position 62 62 elif pickline is None: 63 picked ='No line selected.'63 picked = 'No line selected.' 64 64 self.figmgr.toolbar.set_message(picked) 65 65 return … … 75 75 xdata = pickline.get_xdata() 76 76 ydata = pickline.get_ydata() 77 titl =pickline.get_label()78 titp =event.inaxes.title.get_text()79 panel0 =event.inaxes80 picked ="Selected: '"+titl+"' in panel '"+titp+"'."77 titl = pickline.get_label() 78 titp = event.inaxes.title.get_text() 79 panel0 = event.inaxes 80 picked = "Selected: '"+titl+"' in panel '"+titp+"'." 81 81 thetoolbar.set_message(picked) 82 82 # Generate a navigation window … … 86 86 def spec_data(event): 87 87 # Getting spectrum data of neiboring point 88 xclick =event.xdata88 xclick = event.xdata 89 89 if event.inaxes != panel0: 90 90 return 91 ipoint =len(xdata)-191 ipoint = len(xdata)-1 92 92 for i in range(len(xdata)-1): 93 xl =xclick-xdata[i]94 xr =xclick-xdata[i+1]93 xl = xclick-xdata[i] 94 xr = xclick-xdata[i+1] 95 95 if xl*xr <= 0.: 96 96 ipoint = i 97 97 break 98 98 # Output spectral value on the navigation window 99 posi ='[ %s, %s ]: x = %.2f value = %.2f'\99 posi = '[ %s, %s ]: x = %.2f value = %.2f'\ 100 100 %(titl,titp,xdata[ipoint],ydata[ipoint]) 101 101 #naviwin.posi.set(posi) … … 123 123 if not self.figmgr.toolbar.mode == '': 124 124 return 125 if event.button == 1:125 if event.button == 1: 126 126 self.notewin.load_textwindow(event) 127 127 elif event.button == 3 and self._note_picked(event): … … 195 195 if event.button != 1: 196 196 return 197 197 198 198 try: self.lastspan 199 199 except AttributeError: pass … … 417 417 asaplog.post("ERROR") 418 418 mathobj = stmath( rcParams['insitu'] ) 419 statval ={}419 statval = {} 420 420 statstr = ['max', 'min', 'mean', 'median', 'sum', 'stddev', 'rms'] 421 421 if isinstance(rows,list) and len(rows) > 0: … … 506 506 asaplog.post('WARN') 507 507 goback = False 508 508 509 509 self.plotter._plotter.hold() 510 510 self.plotter._plotter.legend(1) … … 538 538 # the number of current subplots 539 539 currpnum = len(self.plotter._plotter.subplots) 540 540 541 541 # the nuber of previous subplots 542 542 start_ipanel = None … … 573 573 def show_pagenum(self,pagenum,formatstr): 574 574 # passed to backend dependent class 575 pass 575 pass 576 576 577 577 def _get_pagenum(self): … … 616 616 def _add_custom_toolbar(self): 617 617 Tk.Frame.__init__(self,master=self.figmgr.window) 618 #self.bSpec =self._NewButton(master=self,619 # text='spec value',620 # command=self.spec_show)621 622 self.bRegion =self._NewButton(master=self,623 text='region',624 command=self.select_region)625 self.bPanel =self._NewButton(master=self,626 text='panel',627 command=self.select_panel)628 self.bClear =self._NewButton(master=self,629 text='clear',630 command=self.cancel_select)631 self.bFlag =self._NewButton(master=self,632 text='flag',633 command=self.flag)634 self.bUnflag =self._NewButton(master=self,635 text='unflag',636 command=self.unflag)618 #self.bSpec = self._NewButton(master=self, 619 # text='spec value', 620 # command=self.spec_show) 621 622 self.bRegion = self._NewButton(master=self, 623 text='region', 624 command=self.select_region) 625 self.bPanel = self._NewButton(master=self, 626 text='panel', 627 command=self.select_panel) 628 self.bClear = self._NewButton(master=self, 629 text='clear', 630 command=self.cancel_select) 631 self.bFlag = self._NewButton(master=self, 632 text='flag', 633 command=self.flag) 634 self.bUnflag = self._NewButton(master=self, 635 text='unflag', 636 command=self.unflag) 637 637 638 self.bStat =self._NewButton(master=self,639 text='statistics',640 command=self.stat_cal)641 642 self.bNote =self._NewButton(master=self,643 text='notation',644 command=self.modify_note)645 646 self.bQuit =self._NewButton(master=self,647 text='Quit',648 #file="stock_close.ppm",649 command=self.quit,650 side=Tk.RIGHT)651 638 self.bStat = self._NewButton(master=self, 639 text='statistics', 640 command=self.stat_cal) 641 642 self.bNote = self._NewButton(master=self, 643 text='notation', 644 command=self.modify_note) 645 646 self.bQuit = self._NewButton(master=self, 647 text='Quit', 648 #file="stock_close.ppm", 649 command=self.quit, 650 side=Tk.RIGHT) 651 652 652 # page change oparations 653 653 frPage = Tk.Frame(master=self,borderwidth=2,relief=Tk.GROOVE) … … 661 661 padx=5,bg='white') 662 662 self.lPagecount.pack(side=Tk.LEFT,padx=3) 663 663 664 664 self.bNext=self._NewButton(master=frPage, 665 665 text=' + ', … … 685 685 file = os.path.join(matplotlib.rcParams['datapath'], 'images', file) 686 686 img = Tk.PhotoImage(master=master, file=file) 687 687 688 688 if os.uname()[0] == 'Darwin': 689 689 b = Tk.Button(master=master, text=text, image=img, … … 704 704 self.figmgr.toolbar.set_message('spec value: drag on a spec') 705 705 if self.mode == 'spec': return 706 self.mode ='spec'706 self.mode = 'spec' 707 707 self.notewin.close_widgets() 708 708 self.__disconnect_event() … … 714 714 if self.mode == 'note': 715 715 self.bNote.config(relief='raised') 716 self.mode ='none'716 self.mode = 'none' 717 717 self.spec_show() 718 718 return … … 720 720 self.bRegion.config(relief='raised') 721 721 self.bPanel.config(relief='raised') 722 self.mode ='note'722 self.mode = 'note' 723 723 self.__disconnect_event() 724 724 self._p.register('button_press',self._mod_note) … … 729 729 if self.mode == 'region': 730 730 self.bRegion.config(relief='raised') 731 self.mode ='none'731 self.mode = 'none' 732 732 self.spec_show() 733 733 return … … 735 735 self.bRegion.config(relief='sunken') 736 736 self.bPanel.config(relief='raised') 737 self.mode ='region'737 self.mode = 'region' 738 738 self.notewin.close_widgets() 739 739 self.__disconnect_event() … … 745 745 if self.mode == 'panel': 746 746 self.bPanel.config(relief='raised') 747 self.mode ='none'747 self.mode = 'none' 748 748 self.spec_show() 749 749 return … … 751 751 self.bRegion.config(relief='raised') 752 752 self.bPanel.config(relief='sunken') 753 self.mode ='panel'753 self.mode = 'panel' 754 754 self.notewin.close_widgets() 755 755 self.__disconnect_event() … … 770 770 self.bUnflag.config(state=Tk.NORMAL) 771 771 self.bStat.config(state=Tk.NORMAL) 772 self.button =True772 self.button = True 773 773 self.spec_show() 774 774 … … 786 786 self.bNext.config(state=Tk.DISABLED) 787 787 self.bPrev.config(state=Tk.DISABLED) 788 self.button =False789 self.mode =''788 self.button = False 789 self.mode = '' 790 790 self.notewin.close_widgets() 791 791 self.__disconnect_event() … … 814 814 getattr(self,btn).config(state=state) 815 815 self.figmgr.toolbar.set_message(msg) 816 817 816 818 817 def delete_bar(self): 819 818 self.__disconnect_event()
Note: See TracChangeset
for help on using the changeset viewer.