Changeset 6295 for cdat/trunk/Packages/browser/Lib/gui_menu.py
- Timestamp:
- 11/19/07 14:16:17 (1 year ago)
- Files:
-
- cdat/trunk/Packages/browser/Lib/gui_menu.py (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cdat/trunk/Packages/browser/Lib/gui_menu.py
r6104 r6295 53 53 import gui_graphics_control 54 54 import gui_thermo 55 import gui_wk 56 55 57 56 58 # Get the previously saved state of the GUI … … 495 497 ) 496 498 main_menu.addmenuitem('Save VCS Canvas As', 'command', 'Save current VCS Canvas as', 497 label = 'EPS...', 498 command = gui_control.Command(self.evt_save_plot_to_eps, parent) 499 label = 'PNG...', 500 command = gui_control.Command(self.evt_save_plot_to_png, parent) 501 ) 502 main_menu.addmenuitem('Save VCS Canvas As', 'command', 'Save current VCS Canvas as', 503 label = 'SVG...', 504 command = gui_control.Command(self.evt_save_plot_to_svg, parent) 505 ) 506 main_menu.addmenuitem('Save VCS Canvas As', 'command', 'Save current VCS Canvas as', 507 label = 'PDF...', 508 command = gui_control.Command(self.evt_save_plot_to_pdf, parent) 499 509 ) 500 510 main_menu.addmenuitem('Save VCS Canvas As', 'command', 'Save current VCS Canvas as', 501 511 label = 'GIF...', 502 512 command = gui_control.Command(self.evt_save_plot_to_gif, parent) 513 ) 514 main_menu.addmenuitem('Save VCS Canvas As', 'command', 'Save current VCS Canvas as', 515 label = 'EPS...', 516 command = gui_control.Command(self.evt_save_plot_to_eps, parent) 503 517 ) 504 518 main_menu.addmenuitem('Save VCS Canvas As', 'command', 'Save current VCS Canvas as', … … 704 718 def evt_save_plot_to_cgm( self, parent ): 705 719 gui_busy.busyStart( self, parent ) 706 filetypes = [ (" PostscriptFile", ".cgm") ]720 filetypes = [ ("CGM File", ".cgm") ] 707 721 # Show the popup directory dialog 708 722 sfile = tkFileDialog.asksaveasfilename( master=parent, filetypes = filetypes, … … 719 733 gui_busy.busyEnd( self, parent ) 720 734 # 735 ####### event to save "Plot" in a 'PDF' file 736 # 737 def evt_save_plot_to_pdf( self, parent ): 738 gui_busy.busyStart( self, parent ) 739 filetypes = [ ("PDF File", ".pdf") ] 740 # Show the popup directory dialog 741 sfile = tkFileDialog.asksaveasfilename( master=parent, filetypes = filetypes, 742 title = 'Save VCS Canvas in PDF File' ) 743 if sfile in ['', ()]: gui_busy.busyEnd( self, parent ); return 744 if sfile[-4:] != '.pdf': sfile += '.pdf' 745 746 parent.vcs[ parent.vcs_id ].pdf( sfile ) 747 gui_control.record_command( parent, "\n# Save VCS Canvas in PDF File" ) 748 gui_control.record_command( parent, "vcs_canvas_list[ %d ].pdf( '%s', '%s' )" % (parent.vcs_id, sfile)) 749 gui_busy.busyEnd( self, parent ) 750 # 751 # 752 ####### event to save "Plot" in a 'SVG' file 753 # 754 def evt_save_plot_to_svg( self, parent ): 755 gui_busy.busyStart( self, parent ) 756 filetypes = [ ("SVG File", ".svg") ] 757 # Show the popup directory dialog 758 sfile = tkFileDialog.asksaveasfilename( master=parent, filetypes = filetypes, 759 title = 'Save VCS Canvas in SVG File' ) 760 if sfile in ['', ()]: gui_busy.busyEnd( self, parent ); return 761 if sfile[-4:] != '.svg': sfile += '.svg' 762 763 parent.vcs[ parent.vcs_id ].svg( sfile ) 764 gui_control.record_command( parent, "\n# Save VCS Canvas in PDF File" ) 765 gui_control.record_command( parent, "vcs_canvas_list[ %d ].svg( '%s', '%s' )" % (parent.vcs_id, sfile)) 766 gui_busy.busyEnd( self, parent ) 767 # 768 # 769 ####### event to save "Plot" in a 'PNG' file 770 # 771 def evt_save_plot_to_png( self, parent ): 772 gui_busy.busyStart( self, parent ) 773 filetypes = [ ("PNG File", ".png") ] 774 # Show the popup directory dialog 775 sfile = tkFileDialog.asksaveasfilename( master=parent, filetypes = filetypes, 776 title = 'Save VCS Canvas in PNG File' ) 777 if sfile in ['', ()]: gui_busy.busyEnd( self, parent ); return 778 if sfile[-4:] != '.png': sfile += '.png' 779 780 parent.vcs[ parent.vcs_id ].png( sfile ) 781 gui_control.record_command( parent, "\n# Save VCS Canvas in PDF File" ) 782 gui_control.record_command( parent, "vcs_canvas_list[ %d ].png( '%s', '%s' )" % (parent.vcs_id, sfile)) 783 gui_busy.busyEnd( self, parent ) 784 # 721 785 ####### event to plot VCS Canvas to desinated printer 722 786 # … … 725 789 if parent.panelGC.page_orientation_flg == 0: o = 'p' 726 790 try: 727 parent.vcs[ parent.vcs_id ].printer( printer_name , o)791 parent.vcs[ parent.vcs_id ].printer( printer_name ) 728 792 gui_control.record_command( parent, "\n# Send VCS Canvas to %s Printer" % printer_name ) 729 gui_control.record_command( parent, "vcs.printer( '%s' , '%s')" % (printer_name , o) )793 gui_control.record_command( parent, "vcs.printer( '%s' )" % (printer_name ,) ) 730 794 except: 731 795 gui_message.error( 'Error in printing.' ) … … 1258 1322 def setdefaultfont(self,parent,name,dialog): 1259 1323 parent.vcs[ parent.vcs_id ].setdefaultfont(name) 1324 parent.default_font = name 1260 1325 dialog.destroy() 1261 1326 … … 1279 1344 dialog.transient( parent ) # Keep widget on top of its parent 1280 1345 dialog.activate() 1346 ## dialog.destroy() 1281 1347 1282 1348 def evt_add_font(self,parent): … … 1288 1354 filetypes=datatypes, title = 'File Select') 1289 1355 font=dialog_icon.show(initialdir=os.getcwd()) 1290 parent.vcs[ parent.vcs_id ].addfont(font) 1356 try: 1357 parent.vcs[ parent.vcs_id ].addfont(font) 1358 except: 1359 pass 1291 1360 1292 1361 … … 2940 3009 2941 3010 class create_external_plot_tools_menu: 2942 ## def evt_thermo_options( self, parent ):2943 ## if parent.menu.thermo_flg == 1:2944 ## parent.menu.thermo_flg = 02945 ## else:2946 ## parent.menu.thermo_flg = 12947 3011 def __init__( self, main_menu, parent, tear_it ): 2948 PT_name = ' PlottingTools'3012 PT_name = 'SpecializedDiagnosis' 2949 3013 if ((sys.platform == 'darwin') and (gui_control.do_aqua == 1)): PT_name += ' ' 2950 3014 main_menu.addmenu(PT_name, 'Plotting Tools', tearoff = tear_it) 2951 3015 # 2952 # Create the cascade " PCMDITools" menu and its items3016 # Create the cascade "Thermo Tools" menu and its items 2953 3017 main_menu.addcascademenu(PT_name, 'thermo', 2954 3018 'PCMDI thermodynamic Tools', … … 2964 3028 variable = main_menu.thermo_options, 2965 3029 ) 3030 main_menu.addmenuitem('thermo', 'command', 'dew', 3031 label = 'Dewpoint (K)', 3032 command = gui_control.Command(gui_thermo.dewpoint, self,parent) 3033 ) 3034 main_menu.addmenuitem('thermo', 'command', 'es', 3035 label = 'Saturated Pressure (Pa)', 3036 command = gui_control.Command(gui_thermo.es, self,parent) 3037 ) 3038 main_menu.addmenuitem('thermo', 'command', 'lapse', 3039 label = 'Moist Adiabatic Lapse Rate (K/Pa)', 3040 command = gui_control.Command(gui_thermo.lapse, self,parent) 3041 ) 3042 main_menu.addmenuitem('thermo', 'command', 'lift', 3043 label = 'Lift Moist Adiabatically', 3044 command = gui_control.Command(gui_thermo.lift, self,parent) 3045 ) 3046 main_menu.addmenuitem('thermo', 'command', 'ws', 3047 label = 'Saturated Mixing Ratio', 3048 command = gui_control.Command(gui_thermo.ws, self,parent) 3049 ) 2966 3050 main_menu.addmenuitem('thermo', 'command', 'SkewT', 2967 3051 label = 'Skew-T', … … 2995 3079 label = 'Stuve with Wind', 2996 3080 command = gui_control.Command(gui_thermo.stuveWind, self,parent) 3081 ) 3082 # Create the cascade "Thermo Tools" menu and its items 3083 main_menu.addcascademenu(PT_name, 'wk', 3084 'Wheeler-Koladis 99 Tools', 3085 label = 'Wheeler-Koladis 99', 3086 traverseSpec = 'z', tearoff = tear_it 3087 ) 3088 3089 main_menu.wk_options = Tkinter.IntVar() 3090 main_menu.wk_options.set(0) 3091 main_menu.addmenuitem('wk', 'checkbutton', 'Toggle me on/off', 3092 label = 'Show options dialog', 3093 selectcolor=gui_color.one, 3094 variable = main_menu.wk_options, 3095 ) 3096 main_menu.addmenuitem('wk', 'command', 'power', 3097 label = 'Process ALL', 3098 command = gui_control.Command(gui_wk.process, self,parent) 3099 ) 3100 main_menu.addmenuitem('wk', 'command', 'power', 3101 label = 'Compute Power', 3102 command = gui_control.Command(gui_wk.power, self,parent) 3103 ) 3104 main_menu.addmenuitem('wk', 'command', 'split', 3105 label = 'Split Power bet Sym/ASym components', 3106 command = gui_control.Command(gui_wk.split, self,parent) 3107 ) 3108 main_menu.addmenuitem('wk', 'command', 'bg', 3109 label = 'Compute background power', 3110 command = gui_control.Command(gui_wk.background, self,parent) 3111 ) 3112 main_menu.addmenuitem('wk', 'command', 'fig1', 3113 label = 'Draw Figure 1 (Sym/ASym power)', 3114 command = gui_control.Command(gui_wk.fig1, self,parent) 3115 ) 3116 main_menu.addmenuitem('wk', 'command', 'fig2', 3117 label = 'Draw Figure 2 (background)', 3118 command = gui_control.Command(gui_wk.fig2, self,parent) 3119 ) 3120 main_menu.addmenuitem('wk', 'command', 'fig3', 3121 label = 'Draw Figure 3 (Sym/ASym power with waves)', 3122 command = gui_control.Command(gui_wk.fig3, self,parent) 2997 3123 ) 2998 3124 … … 3010 3136 main_menu.addmenuitem(H_name, 'separator') 3011 3137 3138 main_menu.addmenuitem(H_name, 'command', "run demo", 3139 label = 'Run CDAT Demo', 3140 command = self.evt_cdat_demo 3141 ) 3012 3142 main_menu.addmenuitem(H_name, 'command', "Go to CDAT's Web site", 3013 3143 label = 'CDAT Web Site', … … 3041 3171 #---------------------------------------------------- 3042 3172 # 3173 ####### event to bring up a web browser that is displaying the CDAT search web page 3174 # 3175 def evt_cdat_demo( self ): 3176 os.popen("cdatdemo -hide_vcdat &") 3177 # 3178 # 3043 3179 ####### event to bring up a web browser that is displaying the CDAT web page 3044 3180 #