def __init__(self, main_menu, parent, tear_it): file_name = 'Publisher' mnFont = tkFont.Font(parent, family=pub_controls.menu_font_type, size=pub_controls.menu_font_size, weight=pub_controls.mnfont_weight) main_menu.addmenu(file_name, 'Publisher Preferences and Options', font=mnFont, tearoff=tear_it) #--------------------------------------------------------------------------------- # Create the "Preferences" menu item #--------------------------------------------------------------------------------- self.evt_preferences_flg = False #""" ganz to remove preferences option.... main_menu.addmenuitem(file_name, 'command', 'Set Publisher Preferences', label='Preferences...', font=mnFont, command=pub_controls.Command( self.evt_preferences, parent)) #--------------------------------------------------------------------------------- # Create the cascade "Exit" menu and its items #--------------------------------------------------------------------------------- main_menu.addmenuitem(file_name, 'separator') #""" main_menu.addmenuitem(file_name, 'command', 'Close Publisher', label="Exit Publisher", font=mnFont, command=pub_controls.Command( exit_publisher, parent))
def __init__(self, top_parent, parent): # create the main toplevel menu self.main_menu = Pmw.MenuBar(top_parent, hull_relief='raised', hull_borderwidth=2, balloon=parent.balloon) self.main_menu.pack(side='top', fill='x') parent.protocol("WM_DELETE_WINDOW", pub_controls.Command(exit_publisher, parent)) tear_it = 1 #------------------------------------------- # menu 1 -- 'Publisher' #------------------------------------------- self.preferences = create_file_menu(self.main_menu, parent, tear_it) #------------------------------------------- # menu 2 -- 'Dataset' #------------------------------------------- self.Dataset = create_dataset_menu(self.main_menu, parent, tear_it) #------------------------------------------- # menu 3 -- 'login' #------------------------------------------- #self.login_menu = create_login_menu( self.main_menu, parent, 0) #------------------------------------------- # menu 4 -- 'Help' #------------------------------------------- create_help_menu(self.main_menu, parent, tear_it)
def evt_login(self, parent): # Create the username/password dialog. self.auth_dialog = Pmw.Dialog(parent, buttons=('OK', 'Cancel'), defaultbutton='OK', title='Authentication Required', command=pub_controls.Command( self.handle_auth_prompt, parent)) self.auth_dialog.withdraw() self.txt_username = Pmw.EntryField(self.auth_dialog.interior(), labelpos=Tkinter.W, label_text='Username:'******'aliceblue', entry_foreground='black', validate=None) self.txt_username.pack(side=Tkinter.TOP, padx=5, pady=2) self.txt_password = Pmw.EntryField( self.auth_dialog.interior(), labelpos=Tkinter.W, label_text='Password:'******'aliceblue', entry_foreground='black', validate=None, entry_show='*', ) self.txt_password.pack(side=Tkinter.TOP, padx=5, pady=2) self.auth_dialog.activate(geometry='centerscreenalways')
def evt_popup_fields_window(self, parent, projectName): if self.evt_fields_flg: return self.evt_fields_flg = True #--------------------------------------------------------------------------------- # Create the Fields dialog window #--------------------------------------------------------------------------------- self.fields = Pmw.Dialog(parent, buttons=('OK', 'Cancel'), defaultbutton='OK', title='Set Additional Mandatory Fields', command=pub_controls.Command( self.close_fields_dialog, parent)) self.fields.withdraw() self.fields.transient(parent) frame = Pmw.ScrolledFrame( self.fields.interior(), usehullsize=1, horizflex='expand', ) # Add additional mandatory fields to allow the user to set default settings handler = getHandlerByName(projectName, None, self.Session) list_fields = getQueryFields(handler) for x in list_fields: if handler.isMandatory(x): if x.lower() != "project": field_options = handler.getFieldOptions(x) if field_options is not None: if x in self.defaultGlobalValues.keys(): set_to = self.defaultGlobalValues[x] else: set_to = x + " (Default Global Setting)" field_options.insert(0, x + " (Default Global Setting)") self.dataset_fields[x] = show_field( parent, frame.interior(), x.capitalize(), field_options, set_to, 1, 1) Pmw.alignlabels(self.dataset_fields.values()) frame.pack(side='top', expand=1, fill='both') #--------------------------------------------------------------------------------- # Position dialog popup #--------------------------------------------------------------------------------- import string parent_geom = parent.geometry() geom = string.split(parent_geom, '+') d1 = string.atoi(geom[1]) d2 = string.atoi(geom[2]) self.fields.geometry("500x200+%d+%d" % (d1, d2)) self.fields.show()
def __init__(self, main_menu, parent, tear_it): self.Session = parent.Session # Set the arrow icons self.on = Tkinter.PhotoImage(file=on_icon) self.off = Tkinter.PhotoImage(file=off_icon) dataset_name = 'Dataset' mnFont = tkFont.Font(parent, family=pub_controls.menu_font_type, size=pub_controls.menu_font_size, weight=pub_controls.mnfont_weight) main_menu.addmenu(dataset_name, 'Publisher Dataset', side='left', font=mnFont, tearoff=tear_it) #----------------------------------------------------------------------------------- # Create the "Select All" menu item #----------------------------------------------------------------------------------- self.remove_dataset = main_menu.addmenuitem( dataset_name, 'command', 'Select All', label='Select All', font=mnFont, command=pub_controls.Command(self.evt_select_all_dataset, parent)) #----------------------------------------------------------------------------------- # Create the "Unselect All" menu item #----------------------------------------------------------------------------------- self.remove_dataset = main_menu.addmenuitem( dataset_name, 'command', 'Unselect All', label='Unselect All', font=mnFont, command=pub_controls.Command(self.evt_unselect_all_dataset, parent))
def evt_preferences(self, parent): if self.evt_preferences_flg: return self.evt_preferences_flg = True #--------------------------------------------------------------------------------- # Create the Preference dialog #--------------------------------------------------------------------------------- self.pref_dialog = Pmw.Dialog(parent, buttons=('OK', 'Cancel'), defaultbutton='OK', title='Preferences', command=pub_controls.Command( self.close_pref_dialog, parent)) self.pref_dialog.withdraw() self.pref_dialog.transient(parent) #--------------------------------------------------------------------------------- # Create and pack the NoteBook #--------------------------------------------------------------------------------- notebook = Pmw.NoteBook(self.pref_dialog.interior()) notebook.pack(fill='both', expand=1, padx=10, pady=10) #--------------------------------------------------------------------------------- # Add the "Appearance" page to the notebook #--------------------------------------------------------------------------------- # ganz disable General tab, this info is not useful, at this time. 3/29/11 #page = notebook.add('General') #self.general_settings = set_general( page, parent ) #notebook.tab('General').focus_set() page = notebook.add('Log Level') # ganz added this code 1/20/11 try: self.log_settings = set_log_preferences(page, parent) except: print "set_log_preferences call failed...", sys.exc_info() return notebook.setnaturalsize() #--------------------------------------------------------------------------------- # Position dialog popup #--------------------------------------------------------------------------------- import string parent_geom = parent.geometry() geom = string.split(parent_geom, '+') d1 = string.atoi(geom[1]) d2 = string.atoi(geom[2]) self.pref_dialog.geometry("650x440+%d+%d" % (d1, d2)) self.pref_dialog.show()
def __init__(self, main_menu, parent, tear_it): L_name = 'Login' mnFont = tkFont.Font(parent, family=pub_controls.menu_font_type, size=pub_controls.menu_font_size, weight=pub_controls.mnfont_weight) main_menu.addmenu(L_name, 'Publisher Login', side='right', font=mnFont, tearoff=tear_it) # Create the "Login" menu item self.login = main_menu.addmenuitem(L_name, 'command', 'Open data file', label='Login...', font=mnFont, command=pub_controls.Command( self.evt_login, parent))
def __init__(self, main_menu, parent, tear_it): H_name = 'Help' mnFont = tkFont.Font(parent, family=pub_controls.menu_font_type, size=pub_controls.menu_font_size, weight=pub_controls.mnfont_weight) main_menu.addmenu(H_name, 'Publisher Help', side='right', font=mnFont, tearoff=tear_it) gui_support.add_balloon_help(main_menu, H_name, font=mnFont) # main_menu.addmenuitem(H_name, 'separator') self.help = main_menu.addmenuitem(H_name, 'command', 'Show Help Package', label='Help HTML', font=mnFont, command=pub_controls.Command( self.evt_helpHTML, parent))
def __init__(self, root): self.parent = root button_parent = root.pane.pane('ControlPane') # Set the arrow icons self.right = Tkinter.PhotoImage(file=blue_right) self.down = Tkinter.PhotoImage(file=blue_down) #---------------------------------------------------------------------------------------- # Create the first control button for "Specify Project and Dataset" #---------------------------------------------------------------------------------------- self.control_toggle1 = 0 bxtFont = tkFont.Font(button_parent, family=pub_controls.button_font_type, size=pub_controls.button_font_size, weight=pub_controls.bnfont_weight) self.ControlButton1 = Tkinter.Button( button_parent, compound=Tkinter.LEFT, justify=Tkinter.LEFT, anchor=Tkinter.W, image=self.right, text='Specify Project and Dataset', font=bxtFont, bg='lightblue', command=pub_controls.Command(self.view_controls1, button_parent)) self.ControlButton1.image = self.right # save the image from garbage collection self.ControlButton1.pack(side='top', fill='x') self.parent.balloon.bind( self.ControlButton1, "Specify on-line or off-line work, project, directory or file \ncontaining dataset locations, and filter file search." ) self.control_frame1 = Tkinter.Frame(button_parent, width=5, height=5) # generate the dataset widgets self.dataset_widgets = pub_expand_dataset_gui.dataset_widgets(self) #---------------------------------------------------------------------------------------- # End the create first control button for "Specify Project and Dataset" #---------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------- # Create the second control button for "Data Extraction" #---------------------------------------------------------------------------------------- self.control_toggle2 = 0 self.ControlButton2 = Tkinter.Button(button_parent, compound=Tkinter.LEFT, justify=Tkinter.LEFT, anchor=Tkinter.W, image=self.right, text='Data Extraction', font=bxtFont, bg='lightblue', command=pub_controls.Command( self.view_controls2, button_parent)) self.ControlButton2.image = self.right # save the image from garbage collection self.ControlButton2.pack(side='top', fill='x') self.parent.balloon.bind( self.ControlButton2, "Extract and scan datasets, then add file information to the database." ) self.control_frame2 = Tkinter.Frame(button_parent, width=5, height=5) # generate the extraction widgets self.extraction_widgets = pub_expand_extraction_gui.dataset_widgets( self) #---------------------------------------------------------------------------------------- # End the create second control button for "Data Extraction" #---------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------- # Create the third control button for "Quality Control" #---------------------------------------------------------------------------------------- self.control_toggle3 = 0 self.ControlButton3 = Tkinter.Button(button_parent, compound=Tkinter.LEFT, justify=Tkinter.LEFT, anchor=Tkinter.W, image=self.right, text='Data Publication', font=bxtFont, state='disabled', bg='lightblue', command=pub_controls.Command( self.view_controls3, button_parent)) self.ControlButton3.image = self.right # save the image from garbage collection self.ControlButton3.pack(side='top', fill='x') self.parent.balloon.bind( self.ControlButton3, 'Publish dataset(s):\nThe "Data Publication" button is only selectable after successful\n"Data Extraction" or "Dataset Query" operations.' ) self.control_frame3 = Tkinter.Frame(button_parent, width=5, height=5) # generate the publication control widgets self.quality_control_widgets = pub_expand_quality_control_gui.quality_control_widgets( self) #---------------------------------------------------------------------------------------- # End the create third control button for "Quality Control" #---------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------- # Create the fourth control button for "Dataset Query" #---------------------------------------------------------------------------------------- self.control_toggle4 = 0 self.ControlButton4 = Tkinter.Button(button_parent, compound=Tkinter.LEFT, justify=Tkinter.LEFT, anchor=Tkinter.W, image=self.right, text='Dataset Query', font=bxtFont, bg='lightblue', command=pub_controls.Command( self.view_controls4, button_parent)) self.ControlButton4.image = self.right # save the image from garbage collection self.ControlButton4.pack(side='top', fill='x') self.parent.balloon.bind(self.ControlButton4, "Query datasets given project information.") self.control_frame4 = Tkinter.Frame(button_parent, width=5, height=5) # generate the query control widgets self.query_widgets = pub_expand_query_gui.query_widgets(self) #---------------------------------------------------------------------------------------- # End the create the fourth control button for "Dataset Query" #---------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------- # Create the fifth control button for "Dataset Deletion" #---------------------------------------------------------------------------------------- self.control_toggle5 = 0 self.ControlButton5 = Tkinter.Button(button_parent, compound=Tkinter.LEFT, justify=Tkinter.LEFT, anchor=Tkinter.W, image=self.right, text='Dataset Deletion', font=bxtFont, bg='lightblue', command=pub_controls.Command( self.view_controls5, button_parent)) self.ControlButton5.image = self.right # save the image from garbage collection self.ControlButton5.pack(side='top', fill='x') self.parent.balloon.bind(self.ControlButton5, "Remove datasets from the system.") self.control_frame5 = Tkinter.Frame(button_parent, width=5, height=5) # generate the deletion control widgets (was query_widgets BUG?) self.deletion_widgets = pub_expand_deletion_control_gui.deletion_widgets( self)
def __init__(self, root, dataset_tab_name, dataset_name, from_tab, Session): self.parent = root self.Session = Session #-------------------------------------------------------------------------------- # Set the color for dataset name button widget and overall font size and style. #-------------------------------------------------------------------------------- keycolor1 = Pmw.Color.changebrightness(self.parent.parent, 'aliceblue', 0.25) keycolor2 = Pmw.Color.changebrightness(self.parent.parent, 'aliceblue', 0.85) tabFont = tkFont.Font(self.parent, family=pub_controls.tab_font_type, size=pub_controls.tab_font_size) self.dataset_tab_name = self.parent.top_notebook.add(dataset_tab_name, tab_bg=keycolor1, tab_fg=keycolor2, tab_font=tabFont) txtFont = tkFont.Font(self.parent, family=pub_controls.text_font_type, size=pub_controls.text_font_size, weight=font_weight) #-------------------------------------------------------------------------------- # Generate the group with the remove page icon #-------------------------------------------------------------------------------- self.group_it = Pmw.Group( self.dataset_tab_name, tag_pyclass=MyButton, tag_text='Remove', tagindent=0, tag_command=pub_controls.Command( self.parent.main_frame.evt_remove_top_tab, dataset_tab_name, "Dataset")) self.group_it.pack(fill='both', expand=1, padx=0, pady=0) #-------------------------------------------------------------------------------- # Display the Query or Collection button -- returns the user to the collection # of datasets #-------------------------------------------------------------------------------- bg_color = "lightgreen" if from_tab[:5] == "Query": bg_color = Pmw.Color.changebrightness(self.parent.parent, pub_controls.query_tab_color, 0.6) elif from_tab[:7] == "Offline": bg_color = "orange" q_frame = Tkinter.Frame(self.group_it.interior()) b = Tkinter.Button(q_frame, text=from_tab + ": ", font=txtFont, background=bg_color, command=pub_controls.Command( self.evt_show_query_page, from_tab)) b.pack(side='left') l = Tkinter.Label( q_frame, text=dataset_name, font=txtFont, ) l.pack(side='left') #-------------------------------------------------------------------------------- # Display the Save Changes button -- save dataset edits #-------------------------------------------------------------------------------- s = Tkinter.Button(q_frame, text="Save Changes", font=txtFont, background=keycolor1, foreground=keycolor2, command=pub_controls.Command( self.evt_save_dataset_page, dataset_name)) s.pack(side='left') q_frame.pack(side='top') self.dataset_sframe = Pmw.ScrolledFrame(self.group_it.interior(), ) self.dataset_sframe.pack(side='top', expand=1, fill='both', pady=2) self.dataset_frame = Tkinter.Frame(self.dataset_sframe.interior())
def __init__(self, page, parent): shared_opt_invoke, db_init_invoke, proj_spec_invoke, md_extract_invoke = return_log_settings_from_ini_file( parent) #--------------------------------------------------------------------------------- # Create and pack a log filename widget, with checkbutton #--------------------------------------------------------------------------------- frame = Tkinter.Frame(page) self.log_dirname_btn = Tkinter.Button(frame, text='Output Log Filename', background='aliceblue', command=pub_controls.Command( self.evt_log_dirname, parent)) self.log_dirname_btn.pack(side='left', expand=1, fill='x', padx=5, pady=5) #--------------------------------------------------------------------------------- # Create and pack the EntryFields to show the log directory and filename #--------------------------------------------------------------------------------- self.log_dirname_str = Pmw.EntryField( frame, entry_state='disabled', entry_disabledbackground="pink", entry_disabledforeground="black", entry_width=160, ) self.log_dirname_str.pack(side='left', expand=1, fill='x', padx=5, pady=5) fn = return_log_file_name(parent).strip() if fn[0] != "#": fn = fn[fn.find("=") + 1:].strip() if fn != '': parent.log_dirname = fn self.log_dirname_str.setvalue(fn) frame.pack(side='top', fill='x') sep1 = Tkinter.Frame(page, relief='raised', height=4, borderwidth=2, background='purple') sep1.pack(side='top', fill='x') #--------------------------------------------------------------------------------- # Create and pack a RadioSelect widget, with radiobuttons for "Echo SQL Commands" #--------------------------------------------------------------------------------- self.echo_sql = Pmw.RadioSelect( page, buttontype='radiobutton', orient='horizontal', labelpos='w', label_text='Echo SQL Commands: ', ) self.echo_sql.pack(side='top', fill='x', padx=10, pady=10) #--------------------------------------------------------------------------------- # Add buttons to the Echo SQL Commands RadioSelect #--------------------------------------------------------------------------------- for text in ('True', 'False'): self.echo_sql.add(text) self.echo_sql.setvalue(str(parent.echoSql)) entries = (self.echo_sql, self.log_dirname_btn) Pmw.alignlabels(entries)
def show_field(parent, gui_parent, field_name, field_options, field_value, isMandatory, tag, for_query=False): text_color = 'black' fcFont = tkFont.Font(gui_parent, family=pub_controls.combobox_font_type, size=pub_controls.combobox_font_size, weight=font_weight) txtFont = tkFont.Font(gui_parent, family=pub_controls.text_font_type, size=pub_controls.text_font_size, weight=font_weight) if isMandatory and for_query is False: field_name = "*" + field_name text_color = "blue" #-------------------------------------------------------------------------------------- # Restrict the user's choice of selection -- can only select items from the # pulldown menu #-------------------------------------------------------------------------------------- if tag == 1: if field_options == None: field_options = ["NO OPTIONS"] field_value = "NO OPTIONS" field_combo = Pmw.ComboBox( gui_parent, label_text=field_name + ': ', label_foreground=text_color, label_font=fcFont, labelpos='w', entryfield_value=field_value, entry_width=17, entry_font=fcFont, entry_background="aliceblue", entry_state="readonly", entry_readonlybackground="aliceblue", listbox_background="aliceblue", listbox_font=fcFont, scrolledlist_items=field_options, ) if field_name == "*Project": field_combo.configure(selectioncommand=pub_controls.Command( evt_reset_project, parent)) field_combo.pack(side='top', fill='x', padx=0, pady=2) return field_combo #-------------------------------------------------------------------------------------- # Allow the user's choice to enter the text in the entry window #-------------------------------------------------------------------------------------- elif tag == 2: # Create and pack the EntryFields. if field_value == None: field_value = "" width = 1 if for_query == False: width = 55 field_entry = Pmw.EntryField( gui_parent, labelpos='w', label_text=field_name + ': ', label_foreground=text_color, label_font=txtFont, entry_font=txtFont, entry_width=width, value=field_value, validate=None, entry_background="aliceblue", ) field_entry.pack(side='top', expand=1, fill='x', padx=0, pady=2) return field_entry #-------------------------------------------------------------------------------------- # Allow the user's see the entered text -- but they cannot edit the entry #-------------------------------------------------------------------------------------- elif tag in [3, None]: # Create and pack the EntryFields. if field_value == None: field_value = "" width = 1 # if field_name.lower() == 'id': field_value = field_value[:-1] # GANZ this is where id gets clipped! if for_query == False: width = 50 state = "normal" if for_query == False: state = "readonly" field_entry = Pmw.EntryField( gui_parent, labelpos='w', label_text=field_name + ': ', label_foreground=text_color, label_font=txtFont, entry_width=width, entry_state=state, entry_readonlybackground='pink', entry_background='pink', entry_font=txtFont, value=field_value, validate=None, ) field_entry.pack(side='top', expand=1, fill='x', padx=0, pady=2) return field_entry #-------------------------------------------------------------------------------------- # Allow the user's see the entered text in a scrolled window #-------------------------------------------------------------------------------------- elif tag == 4: # Create the ScrolledText. scrolled_text = Pmw.ScrolledText( gui_parent, labelpos='w', label_text=field_name + ': ', label_foreground=text_color, label_font=txtFont, text_background="aliceblue", text_font=txtFont, borderframe=1, usehullsize=1, hull_height=60, text_padx=5, text_pady=2, label_background="PaleGreen3", hull_background="PaleGreen3", ) scrolled_text.pack(side='top', expand=1, fill='x', padx=0, pady=2) if field_value is not None: scrolled_text.settext(field_value) return scrolled_text
def __init__(self, page, parent): frame = Tkinter.Frame(page) #--------------------------------------------------------------------------------- # Create and pack the EntryFields to show the initialization file #--------------------------------------------------------------------------------- configFile = getConfigFile() self.init_file = Pmw.EntryField( frame, labelpos='w', label_text='Initialization File: ', entry_background="aliceblue", entry_width=60, value=configFile, ) self.init_file.pack(side='top', expand=1, fill='x', pady=5) self.init_file.component('entry').bind( '<KeyPress>', pub_controls.Command(evt_change_color, self.init_file, parent)) #--------------------------------------------------------------------------------- # Create and pack the EntryFields to show the aggregate dimension #--------------------------------------------------------------------------------- self.aggr_dim = Pmw.EntryField( frame, labelpos='w', label_text='Aggregate Dimension: ', entry_background="aliceblue", entry_width=60, value=parent.aggregateDimension, ) self.aggr_dim.pack(side='top', expand=1, fill='x', pady=5) self.aggr_dim.component('entry').bind( '<KeyPress>', pub_controls.Command(evt_change_color, self.aggr_dim, parent)) frame.pack(side='top', fill='x') sep1 = Tkinter.Frame(page, relief='raised', height=4, borderwidth=2, background='purple') sep1.pack(side='top', fill='x') #-------------------------------------------------------------------------------------- # Create and pack a RadioSelect widget, with radiobuttons for "Validate Standard Name" #-------------------------------------------------------------------------------------- self.validate_std_name = Pmw.RadioSelect( page, buttontype='radiobutton', orient='horizontal', labelpos='w', label_text='Validate Standard Names: ', ) self.validate_std_name.pack(side='top', fill='x', padx=10, pady=10) #--------------------------------------------------------------------------------- # Add buttons to the Echo SQL Commands RadioSelect #--------------------------------------------------------------------------------- for text in ('True', 'False'): self.validate_std_name.add(text) self.validate_std_name.setvalue(str(parent.validateStandardName)) entries = (self.init_file, self.aggr_dim, self.validate_std_name) Pmw.alignlabels(entries)
def __init__(self, parent): self.parent = parent self.Session = self.parent.parent.Session global CheckVar1 deletion_widgets.CheckVar1 = IntVar() # global CheckVar2 deletion_widgets.CheckVar2 = IntVar() # global CheckVar3 deletion_widgets.CheckVar3 = IntVar() # #global CheckVar2 = IntVar() #global CheckVar3 = IntVar() #---------------------------------------------------------------------------------------- # Begin the creation of the button controls #---------------------------------------------------------------------------------------- glFont = tkFont.Font(self.parent.parent, family=pub_controls.button_group_font_type, size=pub_controls.button_group_font_size, weight=font_weight) # Create and pack the LabeledWidgets to "Select All" datasets bnFont = tkFont.Font(self.parent.parent, family=pub_controls.label_button_font_type, size=pub_controls.label_button_font_size, weight=font_weight) # Create and pack the LabeledWidgets to "Select All" datasets # lw_start1 = Pmw.LabeledWidget(self.parent.control_frame5, # labelpos = 'w', # label_font = bnFont, # label_text = 'Dataset: ') # lw_start1.component('hull').configure(relief='sunken', borderwidth=2) # lw_start1.pack(side='top', expand = 1, fill = 'both', padx=10, pady=10) # cw_start = Tkinter.Button(lw_start1.interior(), # text='Select All', # font = bnFont, # background = "aliceblue", # command = pub_controls.Command( self.evt_dataset_select_all )) # cw_start.pack(padx=10, pady=10, expand='yes', fill='both') # Create and pack the LabeledWidgets to "Unselect All" datasets # bnFont=tkFont.Font(self.parent.parent, family = pub_controls.label_button_font_type, size=pub_controls.label_button_font_size, weight=font_weight) # lw_start2 = Pmw.LabeledWidget(self.parent.control_frame5, # labelpos = 'w', # label_font = bnFont, # label_text = 'Dataset: ') # lw_start2.component('hull').configure(relief='sunken', borderwidth=2) # lw_start2.pack(side='top', expand = 1, fill = 'both', padx=10, pady=10) # cw_start = Tkinter.Button(lw_start2.interior(), # text='Unselect All', # font = bnFont, # background = "aliceblue", # command = pub_controls.Command( self.evt_dataset_unselect_all )) # cw_start.pack(padx=10, pady=10, expand='yes', fill='both') # Create and pack the LabeledWidgets to "Remove" selected datasets lw_start1 = Pmw.LabeledWidget( self.parent.control_frame5, labelpos='w', label_font=bnFont, label_text='Select where to Remove Datasets: ') lw_start1.component('hull').configure(relief='flat', borderwidth=2) # lw_start1.pack(side='top', expand = 1, fill = 'both', padx=10, pady=10) lw_start1.grid(row=0, sticky=N) DeleteLocalDB = Checkbutton(self.parent.control_frame5, text = "Local DB", variable = deletion_widgets.CheckVar1, \ onvalue = 1, offvalue = 0, height=2, width = 10) # was 10 DeleteGateway = Checkbutton(self.parent.control_frame5, text = "Gateway", variable = deletion_widgets.CheckVar2, \ onvalue = 1, offvalue = 0, height=2, width = 10) DeleteThredds = Checkbutton(self.parent.control_frame5, text = "Thredds Server", variable = deletion_widgets.CheckVar3, \ onvalue = 1, offvalue = 0, height=2, width = 15) DeleteLocalDB.grid(row=1, column=0, sticky=W) DeleteGateway.grid(row=2, column=0, sticky=W) DeleteThredds.grid(row=3, column=0, sticky=W) bnFont = tkFont.Font(self.parent.parent, family=pub_controls.label_button_font_type, size=pub_controls.label_button_font_size, weight=font_weight) lw_start3 = Pmw.LabeledWidget(self.parent.control_frame5, labelpos='w', label_font=bnFont, label_text='Dataset deletion: ') lw_start3.component('hull').configure(relief='sunken', borderwidth=2) lw_start3.pack(side='bottom', expand=1, fill='both', padx=10, pady=10) cw_start = Tkinter.Button(lw_start3.interior(), text='Remove', font=bnFont, background="lightblue", command=pub_controls.Command( self.evt_remove_selected_dataset)) cw_start.pack(padx=10, pady=10, expand='yes', fill='both') lw_start3.grid(row=4, sticky=W) DeleteLocalDB.select() DeleteGateway.select() DeleteThredds.select()
def start_harvest(self, parent): from esgcet.publish import publishDatasetList from esgcet.model import Dataset, PUBLISH_FAILED_EVENT, ERROR_LEVEL dcolor1 = Pmw.Color.changebrightness(self.parent.parent, 'aliceblue', 0.8) # Make sure the publisher is logged in # if not self.parent.parent.password_flg: # self.parent.parent.menu.login_menu.evt_login( self.parent.parent ) # Start the busy routine to indicate to the users something is happening self.parent.parent.busyCursor = 'watch' self.parent.parent.busyWidgets = [ self.parent.parent.pane2.pane('EditPaneTop'), self.parent.parent.pane2.pane('EditPaneBottom'), self.parent.parent.pane2.pane('EditPaneStatus'), self.parent.parent.pane.pane('ControlPane') ] pub_busy.busyStart(self.parent.parent) try: # Generate the list of datasets to be published datasetNames = [] GUI_line = {} tab_name = self.parent.parent.top_notebook.getcurselection() selected_page = self.parent.parent.main_frame.selected_top_page if (selected_page is None): warning( "Must generate a list of datasets to scan before publishing can occur." ) pub_busy.busyEnd(self.parent.parent) return for x in self.parent.parent.main_frame.top_page_id[selected_page]: if self.parent.parent.main_frame.top_page_id[selected_page][x].cget( 'bg' ) != 'salmon' and self.parent.parent.main_frame.top_page_id2[ selected_page][x].cget('bg') != 'salmon': dset_name = self.parent.parent.main_frame.top_page_id2[ selected_page][x].cget('text') ####################################### # ganz added this 1/18/11 versionNum = self.parent.parent.main_frame.version_label[ selected_page][x].cget('text') dsetTuple = (dset_name, versionNum) #dsetName = generateDatasetVersionId(dsetTuple) ##################################################################################### # dsetTuple = parseDatasetVersionId(dset_name) # ganz no longer necessary datasetNames.append(dsetTuple) GUI_line[dset_name] = x else: if self.parent.parent.main_frame.top_page_id2[ selected_page][x].cget('bg') == 'salmon': self.parent.parent.main_frame.top_page_id[ selected_page][x].configure(relief='raised', background='salmon', image=self.off) # Publish collection of datasets testProgress = (self.parent.parent.statusbar.show, 0, 100) publishThredds = (quality_control_widgets.get_CheckBox3() == 1) publishGateway = (quality_control_widgets.get_CheckBox2() == 1) if (publishThredds): print 'publishing to Thredds' if (publishGateway): print 'publishing to Gateway' status_dict = publishDatasetList(datasetNames, self.Session, publish=publishGateway, thredds=publishThredds, progressCallback=testProgress) # Show the published status for x in status_dict.keys(): status = status_dict[x] dsetName, versionNo = x dsetVersionName = generateDatasetVersionId(x) guiLine = GUI_line[dsetName] # dsetVersionName] self.parent.parent.main_frame.status_label[selected_page][ guiLine].configure( text=pub_controls.return_status_text(status)) dset = Dataset.lookup(dsetName, self.Session) if dset.has_warnings(self.Session): warningLevel = dset.get_max_warning_level(self.Session) if warningLevel >= ERROR_LEVEL: buttonColor = "pink" buttonText = "Error" else: buttonColor = "yellow" buttonText = "Warning" self.parent.parent.main_frame.ok_err[selected_page][ guiLine].configure( text=buttonText, bg=buttonColor, relief='raised', command=pub_controls.Command( self.parent.parent.pub_buttonexpansion. extraction_widgets.error_extraction_button, dset)) else: self.parent.parent.main_frame.ok_err[selected_page][ guiLine].configure( text='Ok', bg=dcolor1, highlightcolor=dcolor1, relief='sunken', ) except: pub_busy.busyEnd( self.parent.parent ) # catch here in order to turn off the busy cursor ganz raise finally: pub_busy.busyEnd(self.parent.parent) self.my_refresh()
def __init__(self, parent): self.parent = parent self.Session = parent.parent.Session #---------------------------------------------------------------------------------------- # Display the Project selection #---------------------------------------------------------------------------------------- self.dataset_fields = {} projectOption = self.parent.parent.config.get('initialize', 'project_options') projectSpecs = splitRecord(projectOption) projectName = projectSpecs[0][0] projectList = [] for x in projectSpecs: projectList.append(x[0]) projectList.sort() self.dataset_fields["Project"] = self.project_dataset = show_field( self.parent, self.parent.control_frame1, "Project", projectList, projectName, 1, 1) # Create and pack the LabeledWidgets for setting additional mandatory fields bnFont = tkFont.Font(self.parent.parent, family=pub_controls.label_button_font_type, size=pub_controls.label_button_font_size, weight=font_weight) self.evt_fields_flg = False self.defaultGlobalValues = {} lw_dir = Pmw.LabeledWidget(self.parent.control_frame1, labelpos='w', label_font=bnFont, label_text='Set additional mandatory: ') lw_dir.component('hull').configure(relief='sunken', borderwidth=2) lw_dir.pack(side='top', expand=1, fill='both', padx=10, pady=10) cw_dir = Tkinter.Button(lw_dir.interior(), text='Fields', font=bnFont, background="lightblue", foreground='black', command=pub_controls.Command( self.evt_popup_fields_window, self.parent.parent, projectName)) cw_dir.pack(padx=10, pady=10, expand='yes', fill='both') self.save_dir_btn_color = cw_dir.cget("background") # Add additional mandatory fields to allow the user to set default settings # handler = getHandlerByName(projectName, None, self.Session) # list_fields = getQueryFields( handler ) # for x in list_fields: # if handler.isMandatory( x ): # if x.lower() != "project": # field_options = handler.getFieldOptions(x) # if field_options is not None: # field_options.insert(0, x+" (Default Global Setting)") # self.dataset_fields[x] = show_field( self.parent, self.parent.control_frame1, x.capitalize(), field_options , x+" (Default Global Setting)", 1, 1 ) # Pmw.alignlabels( self.dataset_fields.values() ) #---------------------------------------------------------------------------------------- # Create and pack a work online or off line RadioSelect widget #---------------------------------------------------------------------------------------- self.parent.parent.offline = False self.parent.parent.offline_directories = None self.parent.parent.offline_datasetName = None self.on_off = Pmw.RadioSelect( self.parent.control_frame1, buttontype='radiobutton', orient='horizontal', labelpos='w', command=pub_controls.Command(self.evt_work_on_or_off_line, ), label_text='Work: ', label_font=bnFont, hull_borderwidth=2, hull_relief='ridge', ) self.on_off.pack(side='top', expand=1, padx=10, pady=10) # Add some buttons to the radiobutton RadioSelect. for text in ('On-line', 'Off-line'): self.on_off.add(text, font=bnFont) self.on_off.setvalue('On-line') #---------------------------------------------------------------------------------------- # Begin the creation of the file type selection #---------------------------------------------------------------------------------------- tagFont = tkFont.Font(self.parent.parent, family=pub_controls.button_group_font_type, size=pub_controls.button_group_font_size, weight=font_weight) self.group_file_filter = Pmw.Group( self.parent.control_frame1, tag_text='Filter File Search', tag_font=tagFont, #hull_background = 'blue', tagindent=25) dfFont = tkFont.Font(self.parent.parent, family=pub_controls.combobox_font_type, size=pub_controls.combobox_font_size, weight=font_weight) self.data_filter = Pmw.ComboBox( self.group_file_filter.interior(), entryfield_value=pub_controls.datatypes[0], entry_font=dfFont, entry_state='readonly', entry_readonlybackground="aliceblue", listbox_font=dfFont, listbox_background="aliceblue", scrolledlist_items=pub_controls.datatypes, ) self.data_filter.pack(side='top', fill='x', pady=5) self.group_file_filter.pack(side='top', fill='x', pady=3) #---------------------------------------------------------------------------------------- # End the creation of the file type selection #---------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------- # Begin the creation of the directory, file, and combo directoy box #---------------------------------------------------------------------------------------- glFont = tkFont.Font(self.parent.parent, family=pub_controls.button_group_font_type, size=pub_controls.button_group_font_size, weight=font_weight) self.group_list_generation = Pmw.Group(self.parent.control_frame1, tag_text='Generate List', tag_font=glFont, tagindent=25) self.parent.control_frame2 = self.group_list_generation.interior() self.directory_icon = Tkinter.PhotoImage(file=file2_gif) self.file_icon = Tkinter.PhotoImage(file=folder2_gif) self.stop_icon = Tkinter.PhotoImage(file=stop_gif) # Create and pack the LabeledWidgets for the directory selction bnFont = tkFont.Font(self.parent.parent, family=pub_controls.label_button_font_type, size=pub_controls.label_button_font_size, weight=font_weight) self.generating_file_list_flg = 0 self.lw_dir = Pmw.LabeledWidget(self.parent.control_frame2, labelpos='w', label_font=bnFont, label_text='Generate list from: ') self.lw_dir.component('hull').configure(relief='sunken', borderwidth=2) self.lw_dir.pack(side='top', expand=1, fill='both', padx=10, pady=10) self.cw_dir = Tkinter.Button(self.lw_dir.interior(), text='Directory', font=bnFont, background="lightblue", foreground='black', command=pub_controls.Command( self.evt_popup_directory_window)) self.cw_dir.pack(padx=10, pady=10, expand='yes', fill='both') self.save_dir_btn_color = self.cw_dir.cget("background") # Create and pack the LabeledWidgets for the file selction self.lw_file = Pmw.LabeledWidget(self.parent.control_frame2, labelpos='w', label_font=bnFont, label_text='Generate list from: ') self.lw_file.component('hull').configure(relief='sunken', borderwidth=2) self.lw_file.pack(side='top', expand=1, fill='both', padx=10, pady=10) self.cw_file = Tkinter.Button(self.lw_file.interior(), text='Map File', font=bnFont, background="lightblue", foreground='black', command=pub_controls.Command( self.evt_popup_file_window)) self.cw_file.pack(padx=10, pady=10, expand='yes', fill='both') self.save_file_btn_color = self.cw_file.cget("background") # Set up directory combo box d, f = _scn_a_dir(self.parent) self.directory_combo = Pmw.ComboBox( self.parent.control_frame2, scrolledlist_items=d, entryfield_value=os.getcwd(), entry_font=('Times', 16, 'bold'), entry_background='white', entry_foreground='black', selectioncommand=pub_controls.Command(self.evt_enter_directory)) self.directory_combo.component('entry').bind( "<Key>", pub_controls.Command(self.evt_change_color)) self.directory_combo.component('entry').bind( "<Return>", pub_controls.Command(self.evt_enter_directory)) self.directory_combo.component('entry').bind( '<Tab>', pub_controls.Command(self.evt_tab)) self.directory_combo.component('entry').bind( "<BackSpace>", pub_controls.Command(self.evt_backspace)) self.parent.control_frame2.pack(side="top", fill='x', pady=5) self.group_list_generation.pack(side='top', fill='x', pady=3) #---------------------------------------------------------------------------------------- # End the creation of the directory, file, and combo directoy box #---------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------- # Begin the regular expression widget # # We've decided that regular expression is no longer needed. #---------------------------------------------------------------------------------------- self.group_list = Pmw.Group(self.parent.control_frame1, tag_text='Regular Expressions', tag_font=('Times', 18, 'bold'), hull_background='orange', tagindent=25) ################################################################################### # To redisplay regular expression widget, just uncomment the 'pack' command below # self.group_list.pack(side='top', fill='x') ################################################################################### self.scl1 = Pmw.ScrolledText(self.group_list.interior(), text_background='aliceblue', text_foreground='black', text_wrap='none', text_padx=5, text_pady=5, usehullsize=1, hull_width=100, hull_height=50) #horizscrollbar_width=50, #vertscrollbar_width=50 ) self.scl1.pack(side='top', expand=1, fill='both') # Create and pack the LabeledWidgets for the compiling of the regular expression self.generating_file_list_flg = 0 self.lw_reg = Pmw.LabeledWidget(self.group_list.interior(), labelpos='w', label_text='Regular expression: ') self.lw_reg.component('hull').configure(relief='sunken', borderwidth=2) self.lw_reg.pack(side='top', expand=1, fill='both', padx=10, pady=10) self.cw_reg = Tkinter.Button(self.lw_reg.interior(), text='Go', command=pub_controls.Command( self.evt_compile_regular_expression)) self.cw_reg.pack(padx=10, pady=10, expand='yes', fill='both') self.save_reg_btn_color = self.cw_reg.cget("background")
def evt_popup_directory_window(self): # Reset the button colors self.cw_dir.configure(background=self.save_dir_btn_color, foreground='black') self.cw_file.configure(background=self.save_file_btn_color, foreground='black') #self.cw_reg.configure( background=self.save_reg_btn_color, foreground='black' ) # Start the busy routine to indicate to the users something is happening self.parent.parent.busyCursor = 'watch' self.parent.parent.busyWidgets = [ self.parent.parent.pane2.pane('EditPaneTop'), self.parent.parent.pane2.pane('EditPaneBottom'), self.parent.parent.pane2.pane('EditPaneStatus'), self.parent.parent.pane.pane('ControlPane') ] pub_busy.busyStart(self.parent.parent) try: # if true, then the dataset is not directly readable and on tertiary storage if self.parent.parent.offline == True: onoff_line = "offline" dirfilename = None # Create the dialog to prompt for the entry input self.dialog = Pmw.Dialog( self.parent.control_frame2, title='Working off-line', buttons=('OK', 'Cancel'), defaultbutton='OK', command=pub_controls.Command( self.evt_work_off_line_directory, ), ) self.entry1 = Pmw.EntryField( self.dialog.interior(), labelpos='w', label_text='Directory:', entry_width=75, entry_background='aliceblue', entry_foreground='black', ) self.entry1.pack(side='top', fill='x', expand=1, padx=10, pady=5) self.entry2 = Pmw.EntryField( self.dialog.interior(), labelpos='w', label_text='Dataset Name:', entry_width=75, entry_background='aliceblue', entry_foreground='black', ) self.entry2.pack(side='top', fill='x', expand=1, padx=10, pady=5) Pmw.alignlabels((self.entry1, self.entry2)) parent_geom = self.parent.parent.geometry() geom = string.split(parent_geom, '+') d1 = string.atoi(geom[1]) d2 = string.atoi(geom[2]) p1 = string.atoi(geom[0].split('x')[0]) * 0.3 p2 = string.atoi(geom[0].split('x')[1]) * 0.3 self.dialog.activate(geometry="+%d+%d" % (p1 + d1, p2 + d2)) if self.parent.parent.offline_directories != "Cancel": # Load up the data information from data extraction self.fill_in_data_information_directory( dirfilename, True, onoff_line=onoff_line) else: onoff_line = "online" if self.generating_file_list_flg == 1: return dialog_icon = tkFileDialog.Directory( master=self.parent.control_frame2, title='Directory and File Selection') dirfilename = dialog_icon.show(initialdir=os.getcwd()) if dirfilename in [(), '']: pub_busy.busyEnd(self.parent.parent) return self.stop_listing_flg = 0 self.parent.parent.extension = [] self.parent.parent.extension.append( (self.data_filter._entryfield.get().split()[-1])) # Load up the data information from data extraction self.fill_in_data_information_directory(dirfilename, True, onoff_line=onoff_line) # Change the color of the selected button bcolorbg = Pmw.Color.changebrightness(self.parent.parent, 'aliceblue', 0.25) bcolorfg = Pmw.Color.changebrightness(self.parent.parent, 'aliceblue', 0.85) self.cw_dir.configure(background=bcolorbg, foreground=bcolorfg) # except: pub_busy.busyEnd( self.parent.parent ) # catch here in order to turn off the busy cursor ganz raise finally: pub_busy.busyEnd(self.parent.parent) # # pub_busy.busyEnd( self.parent.parent ) # Disable the "Data Publication" button self.parent.parent.pub_buttonexpansion.ControlButton3.configure( state='disabled')
def __init__(self, parent): self.parent = parent self.Session = self.parent.parent.Session # Set the arrow icons self.on = Tkinter.PhotoImage(file=on_icon) self.off = Tkinter.PhotoImage(file=off_icon) global CheckVar1 quality_control_widgets.CheckVar1 = IntVar() # local db global CheckVar2 quality_control_widgets.CheckVar2 = IntVar() # gateway global CheckVar3 quality_control_widgets.CheckVar3 = IntVar() # thredds #---------------------------------------------------------------------------------------- # Begin the creation of the button controls #---------------------------------------------------------------------------------------- glFont = tkFont.Font(self.parent.parent, family=pub_controls.button_group_font_type, size=pub_controls.button_group_font_size, weight=font_weight) bnFont = tkFont.Font(self.parent.parent, family=pub_controls.label_button_font_type, size=pub_controls.label_button_font_size, weight=font_weight) #self.button_controls = Pmw.Group(self.parent.control_frame3, # tag_text = 'Button Controls', # tag_font = glFont, # tagindent = 25) # Create and pack the LabeledWidgets to "Select All" datasets # lw_start1 = Pmw.LabeledWidget(self.parent.control_frame3, # labelpos = 'w', # label_font = bnFont, # label_text = 'Dataset: ') # lw_start1.component('hull').configure(relief='sunken', borderwidth=2) # lw_start1.pack(side='top', expand = 1, fill = 'both', padx=10, pady=10) # cw_start = Tkinter.Button(lw_start1.interior(), # text='Select All', # font = bnFont, # background = "aliceblue", # command = pub_controls.Command( self.evt_dataset_select_all )) # cw_start.pack(padx=10, pady=10, expand='yes', fill='both') # Create and pack the LabeledWidgets to "Unselect All" datasets # lw_start2 = Pmw.LabeledWidget(self.parent.control_frame3, # labelpos = 'w', # label_font = bnFont, # label_text = 'Dataset: ') # lw_start2.component('hull').configure(relief='sunken', borderwidth=2) # lw_start2.pack(side='top', expand = 1, fill = 'both', padx=10, pady=10) # cw_start = Tkinter.Button(lw_start2.interior(), # text='Unselect All', # font = bnFont, # background = "aliceblue", # command = pub_controls.Command( self.evt_dataset_unselect_all )) # cw_start.pack(padx=10, pady=10, expand='yes', fill='both') # Create and pack the LabeledWidgets to "Publish" datasets ############################################################################################ lw_start1 = Pmw.LabeledWidget( self.parent.control_frame3, labelpos='w', label_font=bnFont, label_text='Select where to Publish Datasets: ') lw_start1.component('hull').configure(relief='flat', borderwidth=2) lw_start1.pack(side='top', expand=1, fill='both', padx=10, pady=10) lw_start1.grid(row=0, sticky=N) PublishGateway = Checkbutton(self.parent.control_frame3, text = "Gateway", variable = quality_control_widgets.CheckVar2, \ onvalue = 1, offvalue = 0, height=2, width = 10) PublishThredds = Checkbutton(self.parent.control_frame3, text = "Thredds Server", variable = quality_control_widgets.CheckVar3, \ onvalue = 1, offvalue = 0, height=2, width = 15) #PublishLocalDB = Checkbutton(self.parent.control_frame3, text = "Local DB", variable = quality_control_widgets.CheckVar1, \ # onvalue = 1, offvalue = 0, height=2, width = 10) # was 10 PublishGateway.pack(side='left', expand=1, fill='both', padx=3, pady=10) PublishThredds.pack(side='left', expand=1, fill='both', padx=3, pady=10) #PublishLocalDB.pack(side='left', expand = 1, fill = 'both', padx=3, pady=10) PublishGateway.grid(row=1, column=0, sticky=W) PublishThredds.grid(row=2, column=0, sticky=W) #PublishLocalDB.grid(row=3, column=0, sticky=W) ############################################################################## self.generating_file_list_flg = 0 lw_start3 = Pmw.LabeledWidget(self.parent.control_frame3, labelpos='w', label_font=bnFont, label_text='Release Data: ') lw_start3.component('hull').configure(relief='sunken', borderwidth=2) lw_start3.pack(side='bottom', expand=1, fill='both', padx=10, pady=10) cw_start = Tkinter.Button(lw_start3.interior(), text='Publish', font=bnFont, background="lightblue", command=pub_controls.Command( self.start_harvest, parent)) cw_start.pack(padx=10, pady=10, expand='yes', fill='both') lw_start3.grid(row=3, sticky=W) # added set to 4 if checking for Local DB PublishGateway.select() PublishThredds.select() #PublishLocalDB.select() # Pmw.alignlabels( (lw_start1, lw_start2, lw_start3) ) #########===================================================================== #Removing this since I don't know why it's here...ganz 1/25/11 # Create and pack the LabeledWidgets to THREDDS catalog the data self.generating_file_list_flg = 0 lw_catalog = Pmw.LabeledWidget(self.parent.control_frame3, labelpos='w', label_text='Generate: ') lw_catalog.component('hull').configure(relief='sunken', borderwidth=2) cw_catalog = Tkinter.Button(lw_catalog.interior(), text='THREDDS', command=pub_controls.Command( self.catalog_thredds, parent)) cw_catalog.pack(padx=10, pady=10, expand='yes', fill='both')
def __init__(self, parent): self.parent = parent #---------------------------------------------------------------------------------------- # Begin the creation of the file type selection #---------------------------------------------------------------------------------------- self.group_file_filter = Pmw.Group(self.parent.control_frame1, tag_text='Filter File Search', tag_font=('Times', 18, 'bold'), tagindent=25) self.data_filter = Pmw.ComboBox( self.group_file_filter.interior(), scrolledlist_items=pub_controls.datatypes, entryfield_value=pub_controls.datatypes[0], # label_text = 'Filter File Search:', # labelpos = 'w', entry_state='readonly', entry_font=('Times', 16, 'bold'), entry_background='white', entry_foreground='black', #selectioncommand=pub_controls.Command(self.evt_data_filter) ) #self.parent.balloon.bind(self.data_filter, "Return specific files.") #self.parent.balloon.bind( self.data_filter._arrowBtn, 'Files types.' ) self.data_filter.pack(side='top', fill='x', pady=5) self.group_file_filter.pack(side='top', fill='x', pady=3) #---------------------------------------------------------------------------------------- # End the creation of the file type selection #---------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------- # Begin the creation of the directory, file, and combo directoy box #---------------------------------------------------------------------------------------- #self.parent.control_frame2 = Tkinter.Frame(self.parent.control_frame1, width=5,height=5, background='aliceblue') self.group_list_generation = Pmw.Group(self.parent.control_frame1, tag_text='Generate List', tag_font=('Times', 18, 'bold'), tagindent=25) self.parent.control_frame2 = self.group_list_generation.interior() self.directory_icon = Tkinter.PhotoImage(file=file2_gif) self.file_icon = Tkinter.PhotoImage(file=folder2_gif) self.stop_icon = Tkinter.PhotoImage(file=stop_gif) # Create the directory button icon lw = Pmw.LabeledWidget( self.parent.control_frame2, labelpos='w', label_text="Generate list from directory: ", label_font=('Times', 16, 'bold'), hull_relief='raised', hull_borderwidth=2, ) lw.pack(fill='x', padx=1, pady=3) self.generating_file_list_flg = 0 self.directory_button = Tkinter.Button( lw.interior(), image=self.directory_icon, bg='lightblue', command=pub_controls.Command(self.evt_popup_directory_window)) self.directory_button.image = self.directory_icon # save the image from garbage collection #self.parent.balloon.bind(self.directory_button, "Popup directory selection window.") self.directory_button.pack(side='left', fill='x') # Create the file button icon lw = Pmw.LabeledWidget( self.parent.control_frame2, labelpos='w', label_text="Generate list from file: ", label_font=('Times', 16, 'bold'), hull_relief='raised', hull_borderwidth=2, ) lw.pack(fill='x', padx=1, pady=3) self.file_button = Tkinter.Button(lw.interior(), image=self.file_icon, bg='lightblue', command=pub_controls.Command( self.evt_popup_file_window)) self.file_button.image = self.file_icon # save the image from garbage collection #self.parent.balloon.bind(self.file_button, "Popup text file selection window.") self.file_button.pack(side='left', fill='x') # Set up directory combo box d, f = _scn_a_dir(self.parent) self.directory_combo = Pmw.ComboBox( self.parent.control_frame2, scrolledlist_items=d, entryfield_value=os.getcwd(), entry_font=('Times', 16, 'bold'), entry_background='white', entry_foreground='black', selectioncommand=pub_controls.Command(self.evt_enter_directory)) #self.directory_combo.configure( menubutton_text=gui_control.dbdchlst[0] ) #self.parent.balloon.bind(self.directory_combo, "Enter directory and/or text file.") #self.parent.balloon.bind( self.directory_combo._arrowBtn, 'View and select directories to generate dataset list.' ) self.directory_combo.component('entry').bind( "<Key>", pub_controls.Command(self.evt_change_color)) self.directory_combo.component('entry').bind( "<Return>", pub_controls.Command(self.evt_enter_directory)) self.directory_combo.component('entry').bind( '<Tab>', pub_controls.Command(self.evt_tab)) self.directory_combo.component('entry').bind( "<BackSpace>", pub_controls.Command(self.evt_backspace)) #self.directory_combo.pack(side = 'left', expand = 1, fill='x') # Create the stop button icon lw = Pmw.LabeledWidget( self.parent.control_frame2, labelpos='w', label_text="Stop list generation: ", label_font=('Times', 16, 'bold'), hull_relief='raised', hull_borderwidth=2, ) lw.pack(fill='x', padx=1, pady=3) self.stop_listing_flg = 0 self.stop_button = Tkinter.Button(lw.interior(), image=self.stop_icon, bg='lightblue', command=pub_controls.Command( self.stop_listing)) self.stop_button.image = self.stop_icon # save the image from garbage collection #self.parent.balloon.bind( self.stop_button, "Stop the generation of the dataset list.") self.stop_button.pack(side='left', fill='x') self.parent.control_frame2.pack(side="top", fill='x', pady=5) self.group_list_generation.pack(side='top', fill='x', pady=3) #---------------------------------------------------------------------------------------- # End the creation of the directory, file, and combo directoy box #---------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------- # Begin the regular expression widget #---------------------------------------------------------------------------------------- self.group_list = Pmw.Group(self.parent.control_frame1, tag_text='Regular Expressions', tag_font=('Times', 18, 'bold'), tagindent=25) self.group_list.pack(side='top', fill='x') self.scl1 = Pmw.ScrolledText(self.group_list.interior(), text_background='aliceblue', text_foreground='black', text_wrap='none', usehullsize=1, hull_width=100, hull_height=100) #horizscrollbar_width=50, #vertscrollbar_width=50 ) #self.scl1.grid(row=0, column=0 ) self.scl1.pack(side='top', expand=1, fill='both') # Create and pack a vertical RadioSelect widget, with checkbuttons. self.checkbuttons = Pmw.RadioSelect( self.group_list.interior(), buttontype='checkbutton', orient='horizontal', labelpos='w', # command = self.checkbuttoncallback, hull_borderwidth=2, hull_relief='ridge', ) self.checkbuttons.pack(side='top', expand=1, padx=10, pady=10) # Add some buttons to the checkbutton RadioSelect. for text in ('Ignore Case', 'Multi-Line', 'Verbose'): self.checkbuttons.add(text)