Show
Ignore:
Timestamp:
11/19/07 14:16:17 (1 year ago)
Author:
doutriaux1
Message:

integrating from devel, in preparation for official release of 4.3!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cdat/trunk/Packages/browser/Lib/gui_menu.py

    r6104 r6295  
    5353import gui_graphics_control 
    5454import gui_thermo 
     55import gui_wk 
     56 
    5557 
    5658# Get the previously saved state of the GUI 
     
    495497                         ) 
    496498      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) 
    499509                         ) 
    500510      main_menu.addmenuitem('Save VCS Canvas As', 'command', 'Save current VCS Canvas as', 
    501511                          label = 'GIF...', 
    502512                          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) 
    503517                         ) 
    504518      main_menu.addmenuitem('Save VCS Canvas As', 'command', 'Save current VCS Canvas as', 
     
    704718   def evt_save_plot_to_cgm( self, parent ): 
    705719      gui_busy.busyStart( self, parent ) 
    706       filetypes = [ ("Postscript File", ".cgm") ] 
     720      filetypes = [ ("CGM File", ".cgm") ] 
    707721      # Show the popup directory dialog 
    708722      sfile = tkFileDialog.asksaveasfilename( master=parent, filetypes = filetypes, 
     
    719733      gui_busy.busyEnd( self, parent ) 
    720734   # 
     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   # 
    721785   ####### event to plot VCS Canvas to desinated printer 
    722786   # 
     
    725789      if parent.panelGC.page_orientation_flg == 0: o = 'p' 
    726790      try: 
    727          parent.vcs[ parent.vcs_id ].printer( printer_name , o
     791         parent.vcs[ parent.vcs_id ].printer( printer_name
    728792         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 ,) ) 
    730794      except: 
    731795            gui_message.error( 'Error in printing.' ) 
     
    12581322   def setdefaultfont(self,parent,name,dialog): 
    12591323      parent.vcs[ parent.vcs_id ].setdefaultfont(name) 
     1324      parent.default_font = name 
    12601325      dialog.destroy() 
    12611326      
     
    12791344      dialog.transient( parent ) # Keep widget on top of its parent 
    12801345      dialog.activate() 
     1346##       dialog.destroy() 
    12811347       
    12821348   def evt_add_font(self,parent): 
     
    12881354                                      filetypes=datatypes, title = 'File Select') 
    12891355      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 
    12911360       
    12921361 
     
    29403009 
    29413010class create_external_plot_tools_menu: 
    2942 ##    def evt_thermo_options( self, parent ): 
    2943 ##       if parent.menu.thermo_flg == 1: 
    2944 ##          parent.menu.thermo_flg = 0 
    2945 ##       else: 
    2946 ##          parent.menu.thermo_flg = 1 
    29473011   def __init__( self, main_menu, parent, tear_it ): 
    2948       PT_name = 'PlottingTools' 
     3012      PT_name = 'SpecializedDiagnosis' 
    29493013      if ((sys.platform == 'darwin') and (gui_control.do_aqua == 1)): PT_name += '  ' 
    29503014      main_menu.addmenu(PT_name, 'Plotting Tools', tearoff = tear_it) 
    29513015      # 
    2952       # Create the cascade "PCMDI Tools" menu and its items 
     3016      # Create the cascade "Thermo Tools" menu and its items 
    29533017      main_menu.addcascademenu(PT_name, 'thermo', 
    29543018                              'PCMDI thermodynamic Tools', 
     
    29643028                variable = main_menu.thermo_options, 
    29653029              ) 
     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                      ) 
    29663050      main_menu.addmenuitem('thermo', 'command', 'SkewT', 
    29673051                       label = 'Skew-T', 
     
    29953079                       label = 'Stuve with Wind', 
    29963080                       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) 
    29973123                      ) 
    29983124 
     
    30103136      main_menu.addmenuitem(H_name, 'separator') 
    30113137 
     3138      main_menu.addmenuitem(H_name, 'command', "run demo", 
     3139                            label = 'Run CDAT Demo', 
     3140                            command = self.evt_cdat_demo 
     3141                           ) 
    30123142      main_menu.addmenuitem(H_name, 'command', "Go to CDAT's Web site", 
    30133143                            label = 'CDAT Web Site', 
     
    30413171   #---------------------------------------------------- 
    30423172   # 
     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   # 
    30433179   ####### event to bring up a web browser that is displaying the CDAT web page 
    30443180   #