Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/spst/UnixTransition/doc/regen_prd_menu.py
Дата изменения: Fri Feb 28 14:46:11 2014
Дата индексирования: Sat Mar 1 17:13:40 2014
Кодировка:

Поисковые слова: п п п п п п п п п п
#!/usr/bin/env python
#
#***********************************************************************
"""

**PURPOSE** --

This is the gui interface to regenerating a PRD file.

python regen_prd_menu.py

**DEVELOPER** --
K. Clark

**MODIFICATION HISTORY** --

o Initial implementation 7/29/02
o Updated 8/ 8/03 KWC - Use new data model, pickle_selection_menu and
select_option_menu.
o Updated 1/28/04 KWC - Add optional pickle and file browse menu.
o Updated 4/ 6/04 KWC - SOIF menu now only for use_input_files=None.

"""
#***********************************************************************


# Invocation
# python regen_prd_menu.py
#
# Description
# This is the gui interface to regenerating a PRD file.

__version__ = " 1/28/04"

import sys
import Tix
from Tkconstants import *
from Tkinter import *
import Pmw

from boolean import *
import prd_gridware, PRD_input_Selection_menu, pickle_selection_menu
import select_option_menu, data_model

class Main_menu:

def __init__(self, use_pickles='yes', use_input_files=None):
""" Class Constructor.
use_pickles indicates that PDBMAN pickle selection menu is needed.
use_input_files indicates that all user input comes from
the PRD_input_Selection_menu widget.
"""

self.program_version = "6.0"
self.program_date = "April 6, 2004"

# Initialise Tkinter and Pmw.
root = Tix.Tk()

# Set the title for this tool.
root.title('PDBMAN Version ' + self.program_version + ' ' +
self.program_date)

# Create a dictionary for storing pointers to the final user
# selections.
Select_val = {}
Select_val['PDBMAN'] = {}

# Create a frame for a menubar.
menu_bar = Frame(root, relief=RAISED, borderwidth=2)

# Create a file menu.
file_menu = self.File_menu(menu_bar)

# Create a help menu.
Help_menu = self.Help_menu(menu_bar)

menu_bar.pack (fill=X)

# Create a Program description label.
test_table = "PASS PDBMAN Configuration " + self.program_version
Label (root, text=test_table, padx=10).pack()

# Create a PASS software version selection menu.
comment = "PASS SW version to use "
option_list = ["OLD", "OPS", "NEW", "SPEC"]
PASS_sel_menu = select_option_menu.select_option_menu(root,
comment, option_list)
# Override the default selection of the 1st element of the list.
PASS_sel_menu.val.set(option_list[1])
PASS_sel_menu.frame.pack(pady=10)
Select_val['PDBMAN']['PASS_SW_Ver'] = data_model.gui_record(
PASS_sel_menu.val.set,
PASS_sel_menu.val.get,
comment, option_list[1], true)

# Create a frame for the SI and SOIF selection menus.
button_frame = Frame(root)

# Create a SI selection menu.
comment = "Preconfigured PRD file(s) to build upon: "
option_list = ["OPS", "SM4"]
SI_sel_menu = select_option_menu.select_option_menu(button_frame,
comment, option_list)
SI_sel_menu.frame.pack(side=LEFT, padx="100")
Select_val['PDBMAN']['SI'] = data_model.gui_record(
SI_sel_menu.val.set,
SI_sel_menu.val.get,
comment, option_list[0], true)


if (use_input_files == None):
# Create an SOIF selection menu.
comment = "SOIF file to test"
option_list = ["SOI0", "SOI1", "SOI2", "SOI3"]
SOIF_sel_menu = select_option_menu.select_option_menu(button_frame,
comment, option_list)
Select_val['PDBMAN']['SOIF'] = data_model.gui_record(
SOIF_sel_menu.val.set,
SOIF_sel_menu.val.get,
comment, option_list[0], true)
SOIF_sel_menu.frame.pack(side=RIGHT, padx="100")

button_frame.pack()
else:
# Create a file selection menu. User will select SOIF file from
# this instead.
Browse_dir = "/data/palpatine3/clark_dev/uvm/build_tools/gui/input"
comment1 = "Enter directory to search for PRD changes: "
comment2 = "Choose PRD element(s) to change: "
file_sel_menu = PRD_input_Selection_menu.PRD_input_Selection_menu(
root, Browse_dir, comment1, comment2)
Select_val['PDBMAN']['New_PRD_Files'] = file_sel_menu.get_Checklist_dict()
file_sel_menu.frame.pack()

# Create a PDBMAN pickle selection menu.
if (use_pickles != None):
comment = "Preconfigured PRD ODB\'s"
ODB_sel_menu = pickle_selection_menu.pickle_selection_menu(root,
'prd')
Select_val['PDBMAN']['ODB_pickle'] = data_model.gui_record(
ODB_sel_menu.pickle_value.set,
ODB_sel_menu.pickle_value.get,
comment,
ODB_sel_menu.find_default_pickle,
true)
ODB_sel_menu.frame.pack(pady=10)

# Create a Gridware submit menu.
Submit_sel_menu = prd_gridware.Submit_menu(root, Select_val)
Submit_sel_menu.frame.pack()

root.mainloop()


def exit_menu(self):
""" Method to exit main loop.
"""
sys.exit()

def File_menu(self, menu_bar):
""" Method to build the file menu.
"""
filemenu = Menubutton(menu_bar, text='File')
filemenu.pack(side=LEFT)
filemenu.menu = Menu(filemenu)
filemenu.menu.add_command(label="Exit", command=self.exit_menu)
filemenu['menu'] = filemenu.menu
return filemenu

def Help_menu (self, menu_bar):
""" Method to build the help menu.
"""
Helpmenu = Menubutton(menu_bar, text='Help')
Helpmenu.pack(side=RIGHT)
Helpmenu.menu = Menu(Helpmenu)
Helpmenu.menu.add_command(label="Version", command=self.version_popup)
Helpmenu['menu'] = Helpmenu.menu
return Helpmenu

def version_popup (self):
""" Method to build the version popup box.
"""
root = Pmw.initialise(fontScheme = 'pmw1')
Pmw.aboutversion (self.program_version)
Pmw.aboutcontact('Developer: Kerry Clark \n' +
' clark@stsci.edu')
version_popup = Pmw.AboutDialog(root, \
applicationname='Version Info')